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

java_library crash during compilation with NoClassDefFoundError for CheckerFramework class #5134

Closed
quittle opened this issue May 2, 2018 · 0 comments
Assignees

Comments

@quittle
Copy link

quittle commented May 2, 2018

Description of the problem / feature request:

I get a crash when compiling java libraries when compiling with the -XepAllDisabledChecksAsWarnings --javacopt flag. The java compilation task crashes with Caused by: java.lang.NoClassDefFoundError: org/checkerframework/javacutil/AnnotationProvider.

This issue arose without any source code change when I was upgrading from Bazel version 0.10.0 to 0.13.0. I did do a bazel clean to ensure it wasn't any left-over artifacts and confirmed this occurs in a new workspace.

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

Most minimal workspace:

WORKSPACE

BUILD

java_library(
    name = "lib",
    srcs = ["Main.java"]
)

Main.java

class Main {
    Object get() {
        return this;
    }
}

Commandline
bazel build --javacopt -XepAllDisabledChecksAsWarnings lib

What operating system are you running Bazel on?

4.9.80-c9 #1 SMP Wed Feb 7 08:47:46 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

What's the output of bazel info release?

release 0.13.0

Have you found anything relevant by searching the web?

Similar issue but different flag: #1008

Any other information, logs, or outputs that you want to share?

$ bazel build --javacopt -XepAllDisabledChecksAsWarnings lib
INFO: Analysed target //:lib (0 packages loaded).
INFO: Found 1 target...
ERROR: /home/ubuntu/workspace/bug/BUILD:1:1: Building liblib.jar (1 source file) failed (Exit 1)
Main.java:3: error: An unhandled exception was thrown by the Error Prone static analysis plugin.
        return this;
        ^
     Please report this at https://github.com/google/error-prone/issues/new and include the following:
  
     error-prone version: 2.2.0
     Stack Trace:
     com.google.common.util.concurrent.ExecutionError: java.lang.NoClassDefFoundError: org/checkerframework/javacutil/AnnotationProvider
        at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2050)
        at com.google.common.cache.LocalCache.get(LocalCache.java:3943)
        at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3967)
        at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4952)
        at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4958)
        at com.google.errorprone.dataflow.DataFlow.methodDataflow(DataFlow.java:167)
        at com.google.errorprone.dataflow.DataFlow.expressionDataflow(DataFlow.java:226)
        at com.google.errorprone.dataflow.nullnesspropagation.TrustingNullnessAnalysis.getNullness(TrustingNullnessAnalysis.java:79)
        at com.google.errorprone.bugpatterns.nullness.ReturnMissingNullable.matchReturn(ReturnMissingNullable.java:80)
        at com.google.errorprone.scanner.ErrorProneScanner.visitReturn(ErrorProneScanner.java:1012)
        at com.google.errorprone.scanner.ErrorProneScanner.visitReturn(ErrorProneScanner.java:145)
        at com.sun.tools.javac.tree.JCTree$JCReturn.accept(JCTree.java:1548)
        at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
        at com.google.errorprone.scanner.Scanner.scan(Scanner.java:82)
        at com.google.errorprone.scanner.Scanner.scan(Scanner.java:42)
        at com.sun.source.util.TreeScanner.scan(TreeScanner.java:105)
        at com.sun.source.util.TreeScanner.visitBlock(TreeScanner.java:248)
        at com.google.errorprone.scanner.ErrorProneScanner.visitBlock(ErrorProneScanner.java:527)
        at com.google.errorprone.scanner.ErrorProneScanner.visitBlock(ErrorProneScanner.java:145)
        at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1026)
        at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
        at com.google.errorprone.scanner.Scanner.scan(Scanner.java:82)
        at com.google.errorprone.scanner.Scanner.scan(Scanner.java:42)
        at com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:90)
        at com.sun.source.util.TreeScanner.visitMethod(TreeScanner.java:206)
        at com.google.errorprone.scanner.ErrorProneScanner.visitMethod(ErrorProneScanner.java:895)
        at com.google.errorprone.scanner.ErrorProneScanner.visitMethod(ErrorProneScanner.java:145)
        at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:898)
        at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
        at com.google.errorprone.scanner.Scanner.scan(Scanner.java:82)
        at com.google.errorprone.scanner.Scanner.scan(Scanner.java:42)
        at com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:90)
        at com.sun.source.util.TreeScanner.scan(TreeScanner.java:105)
        at com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:113)
        at com.sun.source.util.TreeScanner.visitClass(TreeScanner.java:187)
        at com.google.errorprone.scanner.ErrorProneScanner.visitClass(ErrorProneScanner.java:587)
        at com.google.errorprone.scanner.ErrorProneScanner.visitClass(ErrorProneScanner.java:145)
        at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:808)
        at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
        at com.google.errorprone.scanner.Scanner.scan(Scanner.java:82)
        at com.google.errorprone.scanner.Scanner.scan(Scanner.java:42)
        at com.sun.source.util.TreeScanner.scan(TreeScanner.java:105)
        at com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:113)
        at com.sun.source.util.TreeScanner.visitCompilationUnit(TreeScanner.java:144)
        at com.google.errorprone.scanner.ErrorProneScanner.visitCompilationUnit(ErrorProneScanner.java:602)
        at com.google.errorprone.scanner.ErrorProneScanner.visitCompilationUnit(ErrorProneScanner.java:145)
        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:64)
        at com.google.errorprone.scanner.ErrorProneScannerTransformer.apply(ErrorProneScannerTransformer.java:43)
        at com.google.errorprone.ErrorProneAnalyzer.finished(ErrorProneAnalyzer.java:152)
        at com.google.devtools.build.buildjar.javac.plugins.errorprone.ErrorPronePlugin.postFlow(ErrorPronePlugin.java:110)
        at com.google.devtools.build.buildjar.javac.BlazeJavaCompiler.flow(BlazeJavaCompiler.java:112)
        at com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1363)
        at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:959)
        at com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:100)
        at com.sun.tools.javac.api.JavacTaskImpl.handleExceptions(JavacTaskImpl.java:142)
        at com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:96)
        at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:90)
        at com.google.devtools.build.buildjar.javac.BlazeJavacMain.compile(BlazeJavacMain.java:110)
        at com.google.devtools.build.buildjar.SimpleJavaLibraryBuilder$2.invokeJavac(SimpleJavaLibraryBuilder.java:121)
        at com.google.devtools.build.buildjar.ReducedClasspathJavaLibraryBuilder.compileSources(ReducedClasspathJavaLibraryBuilder.java:54)
        at com.google.devtools.build.buildjar.SimpleJavaLibraryBuilder.compileJavaLibrary(SimpleJavaLibraryBuilder.java:124)
        at com.google.devtools.build.buildjar.SimpleJavaLibraryBuilder.run(SimpleJavaLibraryBuilder.java:132)
        at com.google.devtools.build.buildjar.BazelJavaBuilder.processRequest(BazelJavaBuilder.java:105)
        at com.google.devtools.build.buildjar.BazelJavaBuilder.runPersistentWorker(BazelJavaBuilder.java:67)
        at com.google.devtools.build.buildjar.BazelJavaBuilder.main(BazelJavaBuilder.java:45)
  Caused by: java.lang.NoClassDefFoundError: org/checkerframework/javacutil/AnnotationProvider
        at com.google.errorprone.dataflow.DataFlow$2.load(DataFlow.java:120)
        at com.google.errorprone.dataflow.DataFlow$2.load(DataFlow.java:94)
        at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3524)
        at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2273)
        at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2156)
        at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2046)
        ... 66 more
  Caused by: java.lang.ClassNotFoundException: org.checkerframework.javacutil.AnnotationProvider
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 72 more
Target //:lib failed to build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants