-
Notifications
You must be signed in to change notification settings - Fork 751
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
IndexOutOfBoundsException in FallThrough.matchSwitch caused by Lombok annotations #613
Comments
Thanks for the report. Do you have a self-contained example that reproduces the problem? |
Attached: Compile with
And you will get a
|
This could be issue with lombok as well, please check projectlombok/lombok#985. For @ewirch's example, if you change the errorprone version to 2.0.15, the error is no longer happening. |
The issue with |
While building orca with upgraded spring boot version 2.3.12, google error-prone package throwing IndexOutOfBoundException as given below: orca/orca-api/src/main/java/com/netflix/spinnaker/orca/api/pipeline/TaskResult.java:32: error: An unhandled exception was thrown by the Error Prone static analysis plugin. @builder ^ Please report this at https://github.com/google/error-prone/issues/new and include the following: error-prone version: 2.4.0 BugPattern: FallThrough Stack Trace: java.lang.IndexOutOfBoundsException at java.base/java.nio.HeapCharBuffer.subSequence(HeapCharBuffer.java:633) at java.base/java.nio.HeapCharBuffer.subSequence(HeapCharBuffer.java:41) at com.google.errorprone.bugpatterns.FallThrough.matchSwitch(FallThrough.java:70) at com.google.errorprone.scanner.ErrorProneScanner.processMatchers(ErrorProneScanner.java:451) at com.google.errorprone.scanner.ErrorProneScanner.visitSwitch(ErrorProneScanner.java:825) at com.google.errorprone.scanner.ErrorProneScanner.visitSwitch(ErrorProneScanner.java:152) at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCSwitch.accept(JCTree.java:1229) at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82) The error is due to Lombok lib upgrade from 1.18.16 to 1.18.20 as transitive dependency of Spring boot. Similar to the issue mentioned below google/error-prone#2575 Further investigation reveal that bug pattern "FallThrough" for lombok annotations (like @Singular) could be a false positive, because Lombok modifies the AST on the fly causing trouble to errorprone checks, as mentioned in below issue and PR. google/error-prone#613 google/error-prone#1573 Considering the above points, we can suppress warning of "FallThrough" bug pattern reported by errorprone for @Builder/@Singular annotations.
…#4194) * Remove @Singular annotation While building orca with upgraded spring boot version 2.3.12, google error-prone package throwing IndexOutOfBoundException as given below: orca/orca-api/src/main/java/com/netflix/spinnaker/orca/api/pipeline/TaskResult.java:32: error: An unhandled exception was thrown by the Error Prone static analysis plugin. @builder ^ Please report this at https://github.com/google/error-prone/issues/new and include the following: error-prone version: 2.4.0 BugPattern: FallThrough Stack Trace: java.lang.IndexOutOfBoundsException at java.base/java.nio.HeapCharBuffer.subSequence(HeapCharBuffer.java:633) at java.base/java.nio.HeapCharBuffer.subSequence(HeapCharBuffer.java:41) at com.google.errorprone.bugpatterns.FallThrough.matchSwitch(FallThrough.java:70) at com.google.errorprone.scanner.ErrorProneScanner.processMatchers(ErrorProneScanner.java:451) at com.google.errorprone.scanner.ErrorProneScanner.visitSwitch(ErrorProneScanner.java:825) at com.google.errorprone.scanner.ErrorProneScanner.visitSwitch(ErrorProneScanner.java:152) at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCSwitch.accept(JCTree.java:1229) at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82) The error is due to Lombok lib upgrade from 1.18.16 to 1.18.20 as transitive dependency of Spring boot. Similar to the issue mentioned below google/error-prone#2575 Fix: To remove @Singular annotation from classes using Lombok builder pattern. Reference: projectlombok/lombok#2221 * Revert "Remove @Singular annotation" This reverts commit e0d57a2. * Suppress warning for "FallThrough" bug pattern reported by errorprone While building orca with upgraded spring boot version 2.3.12, google error-prone package throwing IndexOutOfBoundException as given below: orca/orca-api/src/main/java/com/netflix/spinnaker/orca/api/pipeline/TaskResult.java:32: error: An unhandled exception was thrown by the Error Prone static analysis plugin. @builder ^ Please report this at https://github.com/google/error-prone/issues/new and include the following: error-prone version: 2.4.0 BugPattern: FallThrough Stack Trace: java.lang.IndexOutOfBoundsException at java.base/java.nio.HeapCharBuffer.subSequence(HeapCharBuffer.java:633) at java.base/java.nio.HeapCharBuffer.subSequence(HeapCharBuffer.java:41) at com.google.errorprone.bugpatterns.FallThrough.matchSwitch(FallThrough.java:70) at com.google.errorprone.scanner.ErrorProneScanner.processMatchers(ErrorProneScanner.java:451) at com.google.errorprone.scanner.ErrorProneScanner.visitSwitch(ErrorProneScanner.java:825) at com.google.errorprone.scanner.ErrorProneScanner.visitSwitch(ErrorProneScanner.java:152) at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCSwitch.accept(JCTree.java:1229) at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82) The error is due to Lombok lib upgrade from 1.18.16 to 1.18.20 as transitive dependency of Spring boot. Similar to the issue mentioned below google/error-prone#2575 Further investigation reveal that bug pattern "FallThrough" for lombok annotations (like @Singular) could be a false positive, because Lombok modifies the AST on the fly causing trouble to errorprone checks, as mentioned in below issue and PR. google/error-prone#613 google/error-prone#1573 Considering the above points, we can suppress warning of "FallThrough" bug pattern reported by errorprone for @Builder/@Singular annotations.
Line 32, colum 5 was pointing to:
The annotations are from Project Lombok. If I replace the annotations by the corresponding generated code, the exception is not thrown.
The text was updated successfully, but these errors were encountered: