Generation of CompilerProperties can fail in subtle ways

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • 27
    • Affects Version/s: 27
    • Component/s: tools
    • master

      JDK-8345263 introduced a new diagnostic info line to allow warning keys to be associated with a lint category.

      For instance:

      ```
      # lint: identity
      compiler.warn.attempt.to.synchronize.on.instance.of.value.based.class=\
          attempt to synchronize on an instance of a value-based class
      ```

      Which is parsed at build time, and result in the following field to be added to the CompilerProperties class:

      ```
              /**
               * "attempt.to.synchronize.on.instance.of.value.based.class"
               */
              public static final LintWarning AttemptToSynchronizeOnInstanceOfValueBasedClass = new LintWarning(EnumSet.noneOf(DiagnosticFlag.class), LintCategory.get("identity").get(), "compiler", "attempt.to.synchronize.on.instance.of.value.based.class");
      ```

      Note that the lint category undergoes a dynamic lookup:

      LintCategory.get("identity").get()

      This means that if there's a typo in the compiler.properties file, the lookup will fail and the JDK build will fail in a very obscure way:
      Creating support/modules_libs/java.base/server/libjvm.so from 1236 file(s)
      Compiling up to 190 files for BUILD_TOOLS_JDK
      Compiling up to 31 files for BUILD_JRTFS
      Compiling up to 2 files for COMPILE_DEPEND
      make[3]: *** [CompileToolsJdk.gmk:41: /w/lt/jdk/dev/build/linux-x86_64-server-release/buildtools/jdk_tools_classes/_the.BUILD_TOOLS_JDK_batch] Error 1
      make[3]: *** Waiting for unfinished jobs....
      make[3]: *** [JrtfsJar.gmk:53: /w/lt/jdk/dev/build/linux-x86_64-server-release/support/jrtfs_classes/_the.BUILD_JRTFS_batch] Error 1
      make[2]: *** [make/Main.gmk:442: jrtfs-jar] Error 2
      make[2]: *** Waiting for unfinished jobs....
      make[3]: *** [CompileToolsJdk.gmk:80: /w/lt/jdk/dev/build/linux-x86_64-server-release/buildtools/depend/_the.COMPILE_DEPEND_batch] Error 1
      make[2]: *** [make/Main.gmk:83: buildtools-jdk] Error 2

      The generated code should be changed to make failures such as these more observable.

            Assignee:
            Maurizio Cimadamore
            Reporter:
            Maurizio Cimadamore
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: