Class JavacCompiler.Messages

  • Enclosing class:
    JavacCompiler

    protected static class JavacCompiler.Messages
    extends java.lang.Object
    Multi-language compiler messages to parse from forked javac output.
    • OpenJDK 8+ is delivered with 3 locales (en, ja, zh_CN).
    • OpenJDK 21+ is delivered with 4 locales (en, ja, zh_CN, de).
    Instead of manually duplicating multi-language messages into this class, it would be preferable to fetch the strings directly from the running JDK:
    
     new JavacMessages("com.sun.tools.javac.resources.javac", Locale.getDefault())
       .getLocalizedString("javac.msg.proc.annotation.uncaught.exception")
     
    Hoewever, due to JMS module protection, it would be necessary to run Plexus Compiler (and hence also Maven Compiler and the whole Maven JVM) with --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED on more recent JDK versions. As this cannot be reliably expected and using internal APIs - even though stable since at least JDK 8 - it is not a future-proof approach. So we refrain from doing so, even though during Plexus Compiler development it might come in handy.

    TODO: Check compiler.properties and javac.properties in OpenJDK javac source code for message changes, relevant new messages, new locales.

    • Field Detail

      • ERROR_PREFIXES

        protected static final java.lang.String[] ERROR_PREFIXES
      • WARNING_PREFIXES

        protected static final java.lang.String[] WARNING_PREFIXES
      • NOTE_PREFIXES

        protected static final java.lang.String[] NOTE_PREFIXES
      • MISC_PREFIXES

        protected static final java.lang.String[] MISC_PREFIXES
      • JAVAC_GENERIC_ERROR_PREFIXES

        protected static final java.lang.String[] JAVAC_GENERIC_ERROR_PREFIXES
      • VM_INIT_ERROR_HEADERS

        protected static final java.lang.String[] VM_INIT_ERROR_HEADERS
      • BOOT_LAYER_INIT_ERROR_HEADERS

        protected static final java.lang.String[] BOOT_LAYER_INIT_ERROR_HEADERS
      • ANNOTATION_PROCESSING_ERROR_HEADERS

        protected static final java.lang.String[] ANNOTATION_PROCESSING_ERROR_HEADERS
      • FILE_A_BUG_ERROR_HEADERS

        protected static final java.lang.String[] FILE_A_BUG_ERROR_HEADERS
      • SYSTEM_OUT_OF_RESOURCES_ERROR_HEADERS

        protected static final java.lang.String[] SYSTEM_OUT_OF_RESOURCES_ERROR_HEADERS
      • IO_ERROR_HEADERS

        protected static final java.lang.String[] IO_ERROR_HEADERS
      • PLUGIN_ERROR_HEADERS

        protected static final java.lang.String[] PLUGIN_ERROR_HEADERS
    • Constructor Detail

      • Messages

        protected Messages()