Interface ICompilerComponent


  • public interface ICompilerComponent
    A service provider interface (SPI) for general purpose Java compiler manipulation.
    • Method Detail

      • init

        void init​(com.sun.tools.javac.api.BasicJavacTask javacTask,
                  TypeProcessor typeProcessor)
        Initializes this service.
        Parameters:
        javacTask - The Javac compiler task. Primarily used to call BasicJavacTask.addTaskListener(com.sun.source.util.TaskListener).
        typeProcessor - Manifold's type processor.
      • initOrder

        default ICompilerComponent.InitOrder initOrder​(ICompilerComponent compilerComponent)
        Override to control the order in which this class' init(com.sun.tools.javac.api.BasicJavacTask, manifold.internal.javac.TypeProcessor) method is called relative to other ICompilerComponent services. This method is called for each ICompilerComponent, excluding this one.

        Returning Before for multiple compilerComponents maintains the earliest position. Returning After multiple times maintains the latest position. Returning both Before and After maintains the latest After position.

        Parameters:
        compilerComponent - A compiler component service from the set of services currently registered.
        Returns:
        Whether this service should initialize before or after compilerComponent.
      • isSuppressed

        default boolean isSuppressed​(com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition pos,
                                     String issueKey,
                                     Object[] args)
        Suppresses the compiler warning/error specified by issueKey.
        Parameters:
        pos -
        issueKey - The compiler warning/error in question. These are the javac coded message keys such as those beginning with "compiler.err.".
        args -
        Returns:
        Returns true if the message should be suppressed.
      • tailorCompiler

        default void tailorCompiler()
        Called when the JavacPlugin initializes and whenever the compiler context changes e.g., when annotation processors make rounds. This is where, if need be, you hack into the compiler before compilation starts e.g., to override or replace part of the compiler.