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 #1625

Closed
victornoel opened this issue May 19, 2020 · 2 comments
Closed

Comments

@victornoel
Copy link

Description of the problem / feature request:

An unhandled exception was thrown by the Error Prone static analysis plugin:

[ERROR]      error-prone version: 2.3.3
[ERROR]      BugPattern: TypeParameterUnusedInFormals
[ERROR]      Stack Trace:
[ERROR]      java.lang.NoSuchFieldError: bound
[ERROR]   	at com.google.errorprone.bugpatterns.TypeParameterUnusedInFormals.matchMethod(TypeParameterUnusedInFormals.java:71)
[ERROR]   	at com.google.errorprone.scanner.ErrorProneScanner.processMatchers(ErrorProneScanner.java:433)
[ERROR]   	at com.google.errorprone.scanner.ErrorProneScanner.visitMethod(ErrorProneScanner.java:725)
[ERROR]   	at com.google.errorprone.scanner.ErrorProneScanner.visitMethod(ErrorProneScanner.java:150)
[ERROR]   	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:908)
[ERROR]   	at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
[ERROR]   	at com.google.errorprone.scanner.Scanner.scan(Scanner.java:71)
[ERROR]   	at com.google.errorprone.scanner.Scanner.scan(Scanner.java:45)
[ERROR]   	at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:106)
[ERROR]   	at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:114)
[ERROR]   	at jdk.compiler/com.sun.source.util.TreeScanner.visitClass(TreeScanner.java:188)
[ERROR]   	at com.google.errorprone.scanner.ErrorProneScanner.visitClass(ErrorProneScanner.java:535)
[ERROR]   	at com.google.errorprone.scanner.ErrorProneScanner.visitClass(ErrorProneScanner.java:150)
[ERROR]   	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:818)
[ERROR]   	at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
[ERROR]   	at com.google.errorprone.scanner.Scanner.scan(Scanner.java:71)
[ERROR]   	at com.google.errorprone.scanner.Scanner.scan(Scanner.java:45)
[ERROR]   	at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:106)
[ERROR]   	at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:114)
[ERROR]   	at jdk.compiler/com.sun.source.util.TreeScanner.visitCompilationUnit(TreeScanner.java:145)
[ERROR]   	at com.google.errorprone.scanner.ErrorProneScanner.visitCompilationUnit(ErrorProneScanner.java:546)
[ERROR]   	at com.google.errorprone.scanner.ErrorProneScanner.visitCompilationUnit(ErrorProneScanner.java:150)
[ERROR]   	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:601)
[ERROR]   	at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:56)
[ERROR]   	at com.google.errorprone.scanner.Scanner.scan(Scanner.java:55)
[ERROR]   	at com.google.errorprone.scanner.ErrorProneScannerTransformer.apply(ErrorProneScannerTransformer.java:43)
[ERROR]   	at com.google.errorprone.ErrorProneAnalyzer.finished(ErrorProneAnalyzer.java:151)
[ERROR]   	at jdk.compiler/com.sun.tools.javac.api.MultiTaskListener.finished(MultiTaskListener.java:132)
[ERROR]   	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1423)
[ERROR]   	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1370)
[ERROR]   	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:965)
[ERROR]   	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:104)
[ERROR]   	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.handleExceptions(JavacTaskImpl.java:147)
[ERROR]   	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:100)
[ERROR]   	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:94)
[ERROR]   	at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:126)
[ERROR]   	at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile(JavacCompiler.java:174)
[ERROR]   	at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:1134)
[ERROR]   	at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:187)
[ERROR]   	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
[ERROR]   	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
[ERROR]   	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
[ERROR]   	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
[ERROR]   	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
[ERROR]   	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
[ERROR]   	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
[ERROR]   	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
[ERROR]   	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
[ERROR]   	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
[ERROR]   	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
[ERROR]   	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:957)
[ERROR]   	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:289)
[ERROR]   	at org.apache.maven.cli.MavenCli.main(MavenCli.java:193)
[ERROR]   	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR]   	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR]   	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR]   	at java.base/java.lang.reflect.Method.invoke(Method.java:567)
[ERROR]   	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
[ERROR]   	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
[ERROR]   	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
[ERROR]   	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)

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

This is using eclipse collection as a dependency.

public interface Features {

    <X extends Enum<X>> X value(Class<X> feature);

    Features with(Enum<?>... feature);

    @Override
    String toString();

    public static final class Of implements Features {

        private MapIterable<Class<? extends Enum<?>>, Enum<?>> values;

        public Of(Enum<?>... values) {
            this(Lists.immutable.of(values));
        }

        public Of(RichIterable<Enum<?>> values) {
            this.values = values.toMap(Enum::getDeclaringClass, Functions.identity());
        }

        @Override
        @SuppressWarnings("unchecked")
        public <X extends Enum<X>> X value(Class<X> feature) {
            return (X) values.get(feature);
        }

        @Override
        @SuppressWarnings("unchecked")
        public Features with(Enum<?>... feature) {
            return new Of(LazyIterate.concatenate(values.valuesView(), Lists.immutable.of(feature)));
        }

        @Override
        public String toString() {
            return values.keyValuesView().collect(p -> p.getOne().getSimpleName() + "=" + p.getTwo()).toString();
        }
    }
}

What version of Error Prone are you using?

error-prone version: 2.3.3, OpenJDK 13

@tbroyer
Copy link
Contributor

tbroyer commented May 19, 2020

This is #1106 and has been fixed in 1af9dbc so will be in 2.3.5 (or whatever will be the next version)

@cushon cushon closed this as completed May 19, 2020
@victornoel
Copy link
Author

thx @tbroyer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants