Skip to content
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

An unhandled exception was thrown by the Error Prone static analysis plugin.: UnusedVariable #1310

Closed
mschaaf opened this issue Jul 16, 2019 · 1 comment
Labels

Comments

@mschaaf
Copy link

mschaaf commented Jul 16, 2019

Description of the problem:

I use it via gradle and the errorprone gradle plugin version 0.8.1.
The project uses lombok and hibernate jpa model generator.
errorprone is configured as follow options.errorprone.disableWarningsInGeneratedCode = true

Error prone failed to compile.

Note: Hibernate JPA 2 Static-Metamodel Generator 5.4.2.Final
<file path>:16: error: An unhandled exception was thrown by the Error Prone static analysis plugin.
package <name>;
^
     Please report this at https://github.com/google/error-prone/issues/new and include the following:

     error-prone version: 2.3.3
     BugPattern: UnusedVariable
     Stack Trace:
     java.lang.IllegalArgumentException: invalid replacement: [1099, -1) ()
        at com.google.common.base.Preconditions.checkArgument(Preconditions.java:458)
        at com.google.errorprone.fixes.Replacement.create(Replacement.java:37)
        at com.google.errorprone.fixes.SuggestedFix$ReplacementFix.getReplacement(SuggestedFix.java:397)
        at com.google.errorprone.fixes.SuggestedFix.getReplacements(SuggestedFix.java:91)
        at com.google.errorprone.fixes.AppliedFix$Applier.apply(AppliedFix.java:71)
        at com.google.errorprone.JavacErrorDescriptionListener.lambda$new$0(JavacErrorDescriptionListener.java:71)
        at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
        at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
        at java.base/java.util.Collections$2.tryAdvance(Collections.java:4745)
        at java.base/java.util.Collections$2.forEachRemaining(Collections.java:4753)
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
        at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
        at com.google.errorprone.JavacErrorDescriptionListener.onDescribed(JavacErrorDescriptionListener.java:84)
        at com.google.errorprone.ErrorProneAnalyzer.lambda$finished$1(ErrorProneAnalyzer.java:136)
        at com.google.errorprone.VisitorState.reportMatch(VisitorState.java:282)
        at com.google.errorprone.bugpatterns.UnusedVariable.matchCompilationUnit(UnusedVariable.java:241)
        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 jdk.compiler/com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:591)
        at jdk.compiler/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 jdk.compiler/com.sun.tools.javac.api.MultiTaskListener.finished(MultiTaskListener.java:132)
        at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1418)
        at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1365)
        at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:960)
        at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:104)
        at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.handleExceptions(JavacTaskImpl.java:147)
        at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:100)
...

Feature requests: what underlying problem are you trying to solve with this feature?

Wanted to use errorprone.

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

Not possible.

What version of Error Prone are you using?

2.3.3

Have you found anything relevant by searching the web?

Could be reated to:
#447
#1195

@cushon cushon added the lombok label May 19, 2020
@cushon
Copy link
Collaborator

cushon commented Jan 19, 2021

This is a duplicate of #1250

@cushon cushon closed this as completed Jan 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants