Class JavacCompiler.Messages

java.lang.Object
org.codehaus.plexus.compiler.javac.JavacCompiler.Messages
Enclosing class:
JavacCompiler

protected static class JavacCompiler.Messages extends 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.

Author:
Trygve Laugstøl, Matthew Pocock, Jörg Waßmer, Alexander Kriegisch, Others
  • Field Details

    • ERROR_PREFIXES

      protected static final String[] ERROR_PREFIXES
    • WARNING_PREFIXES

      protected static final String[] WARNING_PREFIXES
    • NOTE_PREFIXES

      protected static final String[] NOTE_PREFIXES
    • MISC_PREFIXES

      protected static final String[] MISC_PREFIXES
    • JAVAC_GENERIC_ERROR_PREFIXES

      protected static final String[] JAVAC_GENERIC_ERROR_PREFIXES
    • VM_INIT_ERROR_HEADERS

      protected static final String[] VM_INIT_ERROR_HEADERS
    • BOOT_LAYER_INIT_ERROR_HEADERS

      protected static final String[] BOOT_LAYER_INIT_ERROR_HEADERS
    • ANNOTATION_PROCESSING_ERROR_HEADERS

      protected static final String[] ANNOTATION_PROCESSING_ERROR_HEADERS
    • FILE_A_BUG_ERROR_HEADERS

      protected static final String[] FILE_A_BUG_ERROR_HEADERS
    • SYSTEM_OUT_OF_RESOURCES_ERROR_HEADERS

      protected static final String[] SYSTEM_OUT_OF_RESOURCES_ERROR_HEADERS
    • IO_ERROR_HEADERS

      protected static final String[] IO_ERROR_HEADERS
    • PLUGIN_ERROR_HEADERS

      protected static final String[] PLUGIN_ERROR_HEADERS
  • Constructor Details

    • Messages

      protected Messages()