Error-prone: IndexOutOfBoundsException

Created on 9 May 2019  路  5Comments  路  Source: google/error-prone

I got the following error while running errorprone in mvn via the command line:

 error-prone version: 2.3.3
 BugPattern: UnusedVariable
 Stack Trace:
 java.lang.IndexOutOfBoundsException
at java.nio.HeapCharBuffer.subSequence(HeapCharBuffer.java:580)
at java.nio.HeapCharBuffer.subSequence(HeapCharBuffer.java:42)
at com.google.errorprone.fixes.SuggestedFixes.replaceIncludingComments(SuggestedFixes.java:1021)
at com.google.errorprone.bugpatterns.UnusedVariable.buildUnusedVarFixes(UnusedVariable.java:387)
at com.google.errorprone.bugpatterns.UnusedVariable.matchCompilationUnit(UnusedVariable.java:239)
at com.google.errorprone.scanner.ErrorProneScanner.processMatchers(ErrorProneScanner.java:433)
at com.google.errorprone.scanner.ErrorProneScanner.visitCompilationUnit(ErrorProneScanner.java:541)
at com.google.errorprone.scanner.ErrorProneScanner.visitCompilationUnit(ErrorProneScanner.java:150)
at com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:591)
at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:56)
at com.google.errorprone.scanner.Scanner.scan(Scanner.java:55)
at com.google.errorprone.scanner.ErrorProneScannerTransformer.apply(ErrorProneScannerTransformer.java:43)
at com.google.errorprone.ErrorProneAnalyzer.finished(ErrorProneAnalyzer.java:151)
at com.sun.tools.javac.api.MultiTaskListener.finished(MultiTaskListener.java:120)
at com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1404)
at com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1353)
at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:946)
at com.sun.tools.javac.main.Main.compile(Main.java:302)
at com.sun.tools.javac.main.Main.compile(Main.java:162)
at com.sun.tools.javac.Main.compile(Main.java:57)
at com.sun.tools.javac.Main.main(Main.java:43)

and here is the output of the mvn -version:

Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-24T20:41:47+02:00)
Maven home: /usr/local/Cellar/maven/3.6.0/libexec
Java version: 1.8.0_181, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre
Default locale: de_DE, platform encoding: UTF-8
OS name: "mac os x", version: "10.14.4", arch: "x86_64", family: "mac"

I have lombok in the dependencies which may be something special:


org.projectlombok
lombok
1.18.6

otherwise I follow the exact instruction from here: https://errorprone.info/docs/installation in the section "Maven" and also those for the jdk8.

Most helpful comment

Since this result appears first on google, to save people time - the issue is probably the @Slf4j lombok annotation or something similar

All 5 comments

Duplicate of #1250 and #1266聽?

From the stack trace they look like the same issue. (I did not see those issues suggested while I typed the title).

Closing as a dupe

Since this result appears first on google, to save people time - the issue is probably the @Slf4j lombok annotation or something similar

Removing the unused lombok notation worked for me.

Was this page helpful?
0 / 5 - 0 ratings