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

2.19.x: Exception thrown when a disabled check is passed to -XepPatchChecks #3908

Closed
AlexLandau opened this issue May 14, 2023 · 0 comments · Fixed by #4310
Closed

2.19.x: Exception thrown when a disabled check is passed to -XepPatchChecks #3908

AlexLandau opened this issue May 14, 2023 · 0 comments · Fixed by #4310

Comments

@AlexLandau
Copy link

AlexLandau commented May 14, 2023

Standalone repro: https://github.com/AlexLandau/errorprone-disabled-and-patch-issue

We have some odd situations involving automated tooling where sometimes, we will run patch creation on checks that have also been disabled; that is, we end up with both -Xep:CheckName:OFF and -XepPatchChecks:CheckName. In 2.18.0, this resulted in the patch being created as if it weren't disabled. Starting in 2.19.0 (and through the current version, 2.19.1), an exception is thrown instead:

/home/alandau/code/gradle-disabled-and-patch-issue/lib/src/main/java/com/github/alexlandau/repro/Library.java:5: error: An unhandled exception was thrown by the Error Prone static analysis plugin.
    public String toString() {
                  ^
     Please report this at https://github.com/google/error-prone/issues/new and include the following:

     error-prone version: 2.19.1
     BugPattern: MissingOverride
     Stack Trace:
     java.util.NoSuchElementException: No value present
        at java.base/java.util.Optional.get(Optional.java:143)
        at com.google.errorprone.matchers.Description.severity(Description.java:78)
        at com.google.errorprone.ErrorProneAnalyzer.lambda$finished$1(ErrorProneAnalyzer.java:138)
        at com.google.errorprone.VisitorState.reportMatch(VisitorState.java:301)
        at com.google.errorprone.scanner.Scanner.reportMatch(Scanner.java:127)
        at com.google.errorprone.scanner.ErrorProneScanner.processMatchers(ErrorProneScanner.java:448)
        at com.google.errorprone.scanner.ErrorProneScanner.visitMethod(ErrorProneScanner.java:739)
        (etc., full stacktrace in repo linked above)

We can work around this for the time being (editing the -Xep args to make sure the check isn't disabled).

oxkitsune added a commit to PicnicSupermarket/error-prone that referenced this issue Jul 31, 2023
Rather than throwing an `NoSuchElementException`.

Fixes google#3908.
copybara-service bot pushed a commit that referenced this issue Jul 31, 2023
Rather than throwing an `NoSuchElementException`.

Fixes #3908.

Fixes #4028

FUTURE_COPYBARA_INTEGRATE_REVIEW=#4028 from PicnicSupermarket:gdejong/remove-disabled-checks 4d502e0
PiperOrigin-RevId: 552531114
copybara-service bot pushed a commit that referenced this issue Jul 31, 2023
Rather than throwing an `NoSuchElementException`.

Fixes #3908.

Fixes #4028

FUTURE_COPYBARA_INTEGRATE_REVIEW=#4028 from PicnicSupermarket:gdejong/remove-disabled-checks 4d502e0
PiperOrigin-RevId: 552531114
oxkitsune added a commit to PicnicSupermarket/error-prone that referenced this issue Aug 14, 2023
Rather than throwing an `NoSuchElementException`.

Fixes google#3908.
oxkitsune added a commit to PicnicSupermarket/error-prone that referenced this issue Aug 30, 2023
Rather than throwing an `NoSuchElementException`.

Fixes google#3908.
copybara-service bot pushed a commit that referenced this issue Sep 7, 2023
Rather than throwing an `NoSuchElementException`.

Fixes #3908.

Fixes #4028

FUTURE_COPYBARA_INTEGRATE_REVIEW=#4028 from PicnicSupermarket:gdejong/remove-disabled-checks 4d502e0
PiperOrigin-RevId: 563489997
copybara-service bot pushed a commit that referenced this issue Sep 8, 2023
Rather than throwing an `NoSuchElementException`.

Fixes #3908.

Fixes #4028

FUTURE_COPYBARA_INTEGRATE_REVIEW=#4028 from PicnicSupermarket:gdejong/remove-disabled-checks 4d502e0
PiperOrigin-RevId: 563488388
copybara-service bot pushed a commit that referenced this issue Sep 8, 2023
Rather than throwing an `NoSuchElementException`.

Fixes #3908.

Fixes #4028

FUTURE_COPYBARA_INTEGRATE_REVIEW=#4028 from PicnicSupermarket:gdejong/remove-disabled-checks 4d502e0
PiperOrigin-RevId: 563488388
copybara-service bot pushed a commit that referenced this issue Sep 8, 2023
Rather than throwing an `NoSuchElementException`.

Fixes #3908.

Fixes #4028

FUTURE_COPYBARA_INTEGRATE_REVIEW=#4028 from PicnicSupermarket:gdejong/remove-disabled-checks 4d502e0
PiperOrigin-RevId: 563488388
copybara-service bot pushed a commit that referenced this issue Sep 8, 2023
Rather than throwing an `NoSuchElementException`.

Fixes #3908.

Fixes #4028

FUTURE_COPYBARA_INTEGRATE_REVIEW=#4028 from PicnicSupermarket:gdejong/remove-disabled-checks 4d502e0
PiperOrigin-RevId: 563488388
copybara-service bot pushed a commit that referenced this issue Sep 8, 2023
Rather than throwing an `NoSuchElementException`.

Fixes #3908.

Fixes #4028

FUTURE_COPYBARA_INTEGRATE_REVIEW=#4028 from PicnicSupermarket:gdejong/remove-disabled-checks 4d502e0
PiperOrigin-RevId: 563488388
copybara-service bot pushed a commit that referenced this issue Sep 8, 2023
Rather than throwing an `NoSuchElementException`.

Fixes #3908.

Fixes #4028

FUTURE_COPYBARA_INTEGRATE_REVIEW=#4028 from PicnicSupermarket:gdejong/remove-disabled-checks 4d502e0
PiperOrigin-RevId: 563488388
Stephan202 pushed a commit to PicnicSupermarket/error-prone that referenced this issue Sep 13, 2023
Rather than throwing an `NoSuchElementException`.

Fixes google#3908.
copybara-service bot pushed a commit that referenced this issue Sep 13, 2023
Rather than throwing an `NoSuchElementException`.

Fixes #3908.

Fixes #4028

FUTURE_COPYBARA_INTEGRATE_REVIEW=#4028 from PicnicSupermarket:gdejong/remove-disabled-checks 5865373
PiperOrigin-RevId: 563488388
copybara-service bot pushed a commit that referenced this issue Sep 13, 2023
Rather than throwing an `NoSuchElementException`.

Fixes #3908.

Fixes #4028

FUTURE_COPYBARA_INTEGRATE_REVIEW=#4028 from PicnicSupermarket:gdejong/remove-disabled-checks 5865373
PiperOrigin-RevId: 563488388
copybara-service bot pushed a commit that referenced this issue Sep 13, 2023
Rather than throwing an `NoSuchElementException`.

Fixes #3908.

Fixes #4028

FUTURE_COPYBARA_INTEGRATE_REVIEW=#4028 from PicnicSupermarket:gdejong/remove-disabled-checks 5865373
PiperOrigin-RevId: 563488388
copybara-service bot pushed a commit that referenced this issue Mar 5, 2024
Rather than throwing an `NoSuchElementException`.

Fixes #3908.

Fixes #4028

FUTURE_COPYBARA_INTEGRATE_REVIEW=#4028 from PicnicSupermarket:gdejong/remove-disabled-checks 3a75f22
PiperOrigin-RevId: 612947943
benkard pushed a commit to benkard/jgvariant that referenced this issue Mar 12, 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.25.0` -> `2.26.1` |
| [com.google.errorprone:error_prone_annotations](https://errorprone.info) ([source](https://github.com/google/error-prone)) | compile | minor | `2.25.0` -> `2.26.1` |

---

### Release Notes

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

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

[Compare Source](google/error-prone@v2.26.0...v2.26.1)

Changes:

-   Fix the module name of the annotations artifact: `com.google.errorprone.annotations` (google/error-prone@9d99ee7)

Full Changelog: google/error-prone@v2.26.0...v2.26.1

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

[Compare Source](google/error-prone@v2.25.0...v2.26.0)

Changes:

-   The 'annotations' artifact now includes a `module-info.java` for Java Platform Module System support, thanks to [@&#8203;sgammon](https://github.com/sgammon) in [#&#8203;4311](google/error-prone#4311).
-   Disabled checks passed to `-XepPatchChecks` are now ignored, instead of causing a crash. Thanks to [@&#8203;oxkitsune](https://github.com/oxkitsune) in [#&#8203;4028](google/error-prone#4028).

New checks:

-   [`SystemConsoleNull`](https://errorprone.info/bugpattern/SystemConsoleNull): Null-checking `System.console()` is not a reliable way to detect if the console is connected to a terminal.
-   [`EnumOrdinal`](https://errorprone.info/bugpattern/EnumOrdinal): Discourage uses of `Enum.ordinal()`

Closed issues: [#&#8203;2649](google/error-prone#2649), [#&#8203;3908](google/error-prone#3908), [#&#8203;4028](google/error-prone#4028), [#&#8203;4311](google/error-prone#4311), [#&#8203;4314](google/error-prone#4314)

Full Changelog: google/error-prone@v2.25.0...v2.26.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