Lombok: [BUG] ErrorProne compiler reports "MissingSummary" on @SuperBuilder w/ 1.18.18

Created on 29 Jan 2021  路  3Comments  路  Source: projectlombok/lombok

Describe the bug

ErrorProne compiler 2.5.1 complains about MissingSummary when @SuperBuilder is used in 1.18.18.

To Reproduce

Stacktrace follows:

> Task :api:cas-server-core-api-authentication:compileJava
/Users/Misagh/Workspace/GitWorkspace/cas-server/api/cas-server-core-api-authentication/src/main/java/org/apereo/cas/authentication/AuthenticationPolicyExecutionResult.java:18: error: An unhandled exception was thrown by the Error Prone static analysis plugin.
@SuperBuilder
^
     Please report this at https://github.com/google/error-prone/issues/new and include the following:

     error-prone version: 2.5.1
     BugPattern: MissingSummary
     Stack Trace:
     java.lang.IllegalArgumentException: Start [-1] should not be less than zero
        at com.google.common.base.Preconditions.checkArgument(Preconditions.java:190)
        at com.google.errorprone.fixes.IndexedPosition.<init>(IndexedPosition.java:32)
        at com.google.errorprone.fixes.SuggestedFix$Builder.replace(SuggestedFix.java:213)
        at com.google.errorprone.bugpatterns.javadoc.MissingSummary.generateReturnFix(MissingSummary.java:139)
        at com.google.errorprone.bugpatterns.javadoc.MissingSummary.handle(MissingSummary.java:109)
        at com.google.errorprone.bugpatterns.javadoc.MissingSummary.matchMethod(MissingSummary.java:80)
        at com.google.errorprone.scanner.ErrorProneScanner.processMatchers(ErrorProneScanner.java:450)
        at com.google.errorprone.scanner.ErrorProneScanner.visitMethod(ErrorProneScanner.java:740)
        at com.google.errorprone.scanner.ErrorProneScanner.visitMethod(ErrorProneScanner.java:151)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:898)
        at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
        at com.google.errorprone.scanner.Scanner.scan(Scanner.java:74)
        at com.google.errorprone.scanner.Scanner.scan(Scanner.java:48)
        at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:90)
        at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:105)
        at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:113)
        at jdk.compiler/com.sun.source.util.TreeScanner.visitClass(TreeScanner.java:187)
        at com.google.errorprone.scanner.ErrorProneScanner.visitClass(ErrorProneScanner.java:549)
        at com.google.errorprone.scanner.ErrorProneScanner.visitClass(ErrorProneScanner.java:151)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:808)
        at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
        at com.google.errorprone.scanner.Scanner.scan(Scanner.java:74)
        at com.google.errorprone.scanner.Scanner.scan(Scanner.java:48)
        at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:90)
        at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:105)

Expected behavior

Passing build.

Version info (please complete the following information):

  • Lombok 1.18.18
  • JDK 11.0.10
  • Gradle 6.8.1
  • ErrorProne 2.5.1

Additional context

  • Disabling the MissingSummary with ErrorProne bypasses the issue.
  • Works OK with Lombok 1.18.16

Most helpful comment

Can confirm that this does not work.
This happens because lombok does not add start and end positons for generated Javadoc comments, most likely caused by the changes in #2684.

All 3 comments

Can confirm that this does not work.
This happens because lombok does not add start and end positons for generated Javadoc comments, most likely caused by the changes in #2684.

@mmoayyed Can you please test the edge release and report if that resolves the exception?

Yes, the edge release certainly does remove the exception, but it does not fix the problem. After switching and instead of the stacktrace, I now see the following:

warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
@SuperBuilder
^
    (see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean 'Returns {@code this}.'?
error: warnings found and -Werror specified

This is what the class structure looks like:

@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS)
@Getter
@SuperBuilder
@ToString
public class AuthenticationPolicyExecutionResult implements Serializable {
    private final boolean success;
}

I suspect the javadoc that is generated for the success() method is missing the appropriate summary. If I can help further, please let me know.

Was this page helpful?
0 / 5 - 0 ratings