Skip to content
This repository was archived by the owner on Dec 20, 2025. It is now read-only.

Suppress warning for "FallThrough" bug pattern reported by errorprone - #4194

Merged
mergify[bot] merged 3 commits into
spinnaker:masterfrom
j-sandy:lombok-singular-remove
Nov 29, 2021
Merged

mergify[bot] merged 3 commits into
spinnaker:masterfrom
j-sandy:lombok-singular-remove

Conversation

@j-sandy

@j-sandy j-sandy commented Nov 24, 2021 •

Copy link
Copy Markdown
Contributor

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.

@spinnakerbot

Copy link
Copy Markdown
Contributor

The following commits need their title changed:

  • d45211a: Upgrade spring boot to 2.3.12

Please format your commit title into the form:

<type>(<scope>): <subject>, e.g. fix(kubernetes): address NPE in status check

This allows us to easily generate changelogs & determine semantic version numbers when cutting releases. You can read more about commit conventions here.

@j-sandy j-sandy changed the title Upgrade spring boot to 2.3.12 Remove @Singular annotation Nov 24, 2021
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
@j-sandy
j-sandy force-pushed the lombok-singular-remove branch from d45211a to e0d57a2 Compare November 24, 2021 16:03
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.
@j-sandy j-sandy changed the title Remove @Singular annotation Suppress warning for "FallThrough" bug pattern reported by errorprone Nov 26, 2021
@dbyron-sf dbyron-sf added the ready to merge Approved and ready for merge label Nov 29, 2021
@mergify
mergify Bot merged commit 5843b94 into spinnaker:master Nov 29, 2021
@mergify mergify Bot added the auto merged Merged automatically by a bot label Nov 29, 2021
@j-sandy
j-sandy deleted the lombok-singular-remove branch December 1, 2021 05:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

auto merged Merged automatically by a bot ready to merge Approved and ready for merge target-release/1.28

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants