Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lazily load plugin checks when running auto-patching #4467

Conversation

msridhar
Copy link
Contributor

When running in normal checking mode, Error Prone loads plugin checks lazily to delay the loading until after the javac file manager is initialized; see here. This change introduces the same lazy loading when running Error Prone in auto-patching mode. In most scenarios I've seen, applying suggested fixes from plugin checks works fine, but when trying to generate patches on Bazel (see bazelbuild/bazel#21640), things do not work without this change. The previous code was "forcing" a Supplier and then re-wrapping the result in a Supplier again; this change mostly just gets rid of that.

copybara-service bot pushed a commit that referenced this pull request Jul 15, 2024
When running in normal checking mode, Error Prone loads plugin checks lazily to delay the loading until after the javac file manager is initialized; see [here](https://github.com/google/error-prone/blob/8f9e7da16b81b9fd65cca5fef9a79a4e6019eabd/check_api/src/main/java/com/google/errorprone/ErrorProneAnalyzer.java#L145-L159).  This change introduces the same lazy loading when running Error Prone in auto-patching mode.  In most scenarios I've seen, applying suggested fixes from plugin checks works fine, but when trying to generate patches on Bazel (see bazelbuild/bazel#21640), things do not work without this change.  The previous code was "forcing" a `Supplier` and then re-wrapping the result in a `Supplier` again; this change mostly just gets rid of that.

Fixes #4467

FUTURE_COPYBARA_INTEGRATE_REVIEW=#4467 from msridhar:lazy-load-plugin-checks-when-autopatching 728e3f9
PiperOrigin-RevId: 652625022
copybara-service bot pushed a commit that referenced this pull request Jul 15, 2024
When running in normal checking mode, Error Prone loads plugin checks lazily to delay the loading until after the javac file manager is initialized; see [here](https://github.com/google/error-prone/blob/8f9e7da16b81b9fd65cca5fef9a79a4e6019eabd/check_api/src/main/java/com/google/errorprone/ErrorProneAnalyzer.java#L145-L159).  This change introduces the same lazy loading when running Error Prone in auto-patching mode.  In most scenarios I've seen, applying suggested fixes from plugin checks works fine, but when trying to generate patches on Bazel (see bazelbuild/bazel#21640), things do not work without this change.  The previous code was "forcing" a `Supplier` and then re-wrapping the result in a `Supplier` again; this change mostly just gets rid of that.

Fixes #4467

FUTURE_COPYBARA_INTEGRATE_REVIEW=#4467 from msridhar:lazy-load-plugin-checks-when-autopatching 728e3f9
PiperOrigin-RevId: 652625022
@msridhar msridhar deleted the lazy-load-plugin-checks-when-autopatching branch July 16, 2024 00:01
benkard pushed a commit to benkard/jgvariant that referenced this pull request Jul 19, 2024
This MR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [com.google.errorprone:error_prone_core](https://errorprone.info) ([source](https://github.com/google/error-prone)) |  | minor | `2.28.0` -> `2.29.2` |
| [com.google.errorprone:error_prone_annotations](https://errorprone.info) ([source](https://github.com/google/error-prone)) | compile | minor | `2.28.0` -> `2.29.2` |

---

### Release Notes

<details>
<summary>google/error-prone</summary>

### [`v2.29.2`](https://github.com/google/error-prone/releases/tag/v2.29.2): Error Prone 2.29.2

[Compare Source](google/error-prone@v2.29.1...v2.29.2)

This release contains all of the changes in [2.29.0](https://github.com/google/error-prone/releases/tag/v2.29.0) and [2.29.1](https://github.com/google/error-prone/releases/tag/v2.29.1), plus:

-   a bug fix for a crash in `TraditionalSwitchExpression` (google/error-prone#4479)
-   restores the `module-info` for the annotations jar, which was accidentally removed (google/error-prone#4480)

Full Changelog: google/error-prone@v2.29.1...v2.29.2

### [`v2.29.1`](https://github.com/google/error-prone/releases/tag/v2.29.1): Error Prone 2.29.1

[Compare Source](google/error-prone@v2.29.0...v2.29.1)

This release contains all of the changes in [2.29.0](https://github.com/google/error-prone/releases/tag/v2.29.0), plus:

-   a bug fix to `UnusedVariable` to handle unnamed `_` variables (google/error-prone#4451)
-   a bug fix for a crash in `SetUnrecognized` (google/error-prone#4475)

Full Changelog: google/error-prone@v2.29.0...v2.29.1

### [`v2.29.0`](https://github.com/google/error-prone/releases/tag/v2.29.0): Error Prone 2.29.0

[Compare Source](google/error-prone@v2.28.0...v2.29.0)

New checks:

-   [`MissingRuntimeRetention`](https://errorprone.info/bugpattern/MissingRuntimeRetention)
-   [`SetUnrecognized`](https://errorprone.info/bugpattern/SetUnrecognized)
-   [`StatementSwitchToExpressionSwitch`](https://errorprone.info/bugpattern/StatementSwitchToExpressionSwitch)

Closed issues: [#&#8203;4318](google/error-prone#4318), [#&#8203;4429](google/error-prone#4429), [#&#8203;4467](google/error-prone#4467)

Full Changelog: google/error-prone@v2.28.0...v2.29.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever MR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about these updates again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4yNC4wIiwidXBkYXRlZEluVmVyIjoiMzQuMjQuMCJ9-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants