Skip to content

Bazel built at HEAD can't build Bazel (java.lang.NoClassDefFoundError: javax/annotation/CheckReturnValue) #5532

Closed

Description

@jmillikin-stripe

Description of the problem / feature request:

A Bazel binary built at current HEAD (3ac44db) can't successfully bazel build //src:bazel, due to an unhandled exception from error-prone. I'm able to succesfully build Bazel using the 0.15.0 branch.

Since it's complaining about an unknown class, I wonder if buildjar is missing a dependency.

ERROR: /Users/jmillikin/src/bazel/src/objc_tools/bundlemerge/BUILD:16:1: Building src/objc_tools/bundlemerge/libbundlemerge_lib.jar (1 source file) failed (Exit 1)
src/objc_tools/bundlemerge/java/com/google/devtools/build/xcode/bundlemerge/BundleMerging.java:138: error: An unhandled exception was thrown by the Error Prone static analysis plugin.
  static BundleMerging merging(Path tempDir, FileSystem fileSystem, Control control)
                       ^
     Please report this at https://github.com/google/error-prone/issues/new and include the following:
  
     error-prone version: 2.3.1
     BugPattern: CheckReturnValue
     Stack Trace:
     java.lang.NoClassDefFoundError: javax/annotation/CheckReturnValue
  	at com.google.errorprone.bugpatterns.CheckReturnValue.matchMethod(CheckReturnValue.java:142)
  	at com.google.errorprone.scanner.ErrorProneScanner.visitMethod(ErrorProneScanner.java:889)
  	at com.google.errorprone.scanner.ErrorProneScanner.visitMethod(ErrorProneScanner.java:145)
  	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:82)
  	at com.google.errorprone.scanner.Scanner.scan(Scanner.java:42)
  	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:587)
  	at com.google.errorprone.scanner.ErrorProneScanner.visitClass(ErrorProneScanner.java:145)
  	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:82)
  	at com.google.errorprone.scanner.Scanner.scan(Scanner.java:42)
  	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.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 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: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 jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1363)
  	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:959)
  	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:100)
  	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.handleExceptions(JavacTaskImpl.java:142)
  	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:96)
  	at jdk.compiler/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:122)
  	at com.google.devtools.build.buildjar.ReducedClasspathJavaLibraryBuilder.compileSources(ReducedClasspathJavaLibraryBuilder.java:54)
  	at com.google.devtools.build.buildjar.SimpleJavaLibraryBuilder.compileJavaLibrary(SimpleJavaLibraryBuilder.java:125)
  	at com.google.devtools.build.buildjar.SimpleJavaLibraryBuilder.run(SimpleJavaLibraryBuilder.java:133)
  	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.ClassNotFoundException: javax.annotation.CheckReturnValue
  	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
  	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
  	at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
  	... 43 more

What operating system are you running Bazel on?

MacOS

What's the output of bazel info release?

I'm using Bazel build from Git at 3ac44db (current HEAD)

Activity

  1. lfpino commented on Jul 6, 2018

    @lfpino
    Contributor

    @cushon can you please take a look?

  2. jmillikin-stripe commented on Jul 6, 2018

    @jmillikin-stripe
    ContributorAuthor

    @buchgr I think this may be caused by 4c9a0c8 ("reduce the size of bazel's embedded jdk")

  3. cushon commented on Jul 7, 2018

    @cushon
    Contributor

    I can reproduce this on my mac, and I confirmed that it was introduced by 4c9a0c8.

  4. cushon commented on Jul 7, 2018

    @cushon
    Contributor

    Also, I can't repro on linux. Is the reduced mac JDK supposed to be different than the linux one?

  5. added
    P0
    on Jul 9, 2018
  6. buchgr commented on Jul 9, 2018

    @buchgr
    Contributor

    I am taking a look. I built the JDK containing all modules listed ./full-jdk/bin/java --list-modules on all platforms. The class javax.annotation.CheckReturnValue does not appear to be part of the JDK. Also, everything seems to be working on CI. Is it possible that we don't test with embedded JDK?

  7. buchgr commented on Jul 9, 2018

    @buchgr
    Contributor

    The class seems to be part of the jsr305 third party dependency and it also exists in there.

  8. cushon commented on Jul 9, 2018

    @cushon
    Contributor

    Is it possible that we don't test with embedded JDK?

    The tests build //src:bazel with a previous release (e.g. 0.15.0-homebrew), and then run the tests against the output of //src:bazel without overriding --host_javabase, so it's using the embedded JDK. Apparently there aren't any tests that build Bazel at head with itself, though.

  9. buchgr commented on Jul 9, 2018

    @buchgr
    Contributor

    @cushon we have a bazel determinism test that does just that and that for reasons has been disabled on macOS. I ll enable it again on our postsubmit pipeline once my fix is in.

  10. added a commit that references this issue on Jul 9, 2018
    f6dbc5e
  11. added a commit that references this issue on Jul 24, 2018
    4c19915
  12. added a commit that references this issue on Jul 31, 2018
    b292ad1
  13. added a commit that references this issue on Aug 2, 2018
    aba4e14
  14. added 2 commits that reference this issue on Aug 7, 2018
    fb9215a
    1c81337
  15. added a commit that references this issue on Aug 8, 2018
    7bc55d2
  16. added a commit that references this issue on Aug 9, 2018
    c25fa1b
  17. added a commit that references this issue on Aug 13, 2018
    1bd5883
  18. added a commit that references this issue on Sep 12, 2018
    0f4eecd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P0

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions