Skip to content

Commit

Permalink
Suppress warning for "FallThrough" bug pattern reported by errorprone
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
j-sandy committed Nov 26, 2021
1 parent 127b592 commit 37c8f28
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
@Beta
@Data
@Builder
@SuppressWarnings("FallThrough")
public final class TaskResult {
/** A useful constant for a success result with no outputs. */
public static final TaskResult SUCCEEDED = TaskResult.ofStatus(ExecutionStatus.SUCCEEDED);
Expand Down

0 comments on commit 37c8f28

Please sign in to comment.