Module jdk.compiler

Class JavacTask

    • Constructor Detail

      • JavacTask

        public JavacTask​()
    • Method Detail

      • instance

        public static JavacTask instance​(ProcessingEnvironment processingEnvironment)
        Returns the JavacTask for a ProcessingEnvironment. If the compiler is being invoked using a CompilationTask, then that task will be returned.
        Parameters:
        processingEnvironment - the processing environment
        Returns:
        the JavacTask for a ProcessingEnvironment
        Since:
        1.8
      • parse

        public abstract Iterable<? extends CompilationUnitTree> parse​()
                                                               throws IOException
        Parses the specified files returning a list of abstract syntax trees.
        Returns:
        a list of abstract syntax trees
        Throws:
        IOException - if an unhandled I/O error occurred in the compiler.
        IllegalStateException - if the operation cannot be performed at this time.
      • analyze

        public abstract Iterable<? extends Element> analyze​()
                                                     throws IOException
        Completes all analysis.
        Returns:
        a list of elements that were analyzed
        Throws:
        IOException - if an unhandled I/O error occurred in the compiler.
        IllegalStateException - if the operation cannot be performed at this time.
      • setTaskListener

        public abstract void setTaskListener​(TaskListener taskListener)
        Sets a specified listener to receive notification of events describing the progress of this compilation task. If another listener is receiving notifications as a result of a prior call of this method, then that listener will no longer receive notifications. Informally, this method is equivalent to calling removeTaskListener for any listener that has been previously set, followed by addTaskListener for the new listener.
        Parameters:
        taskListener - the task listener
        Throws:
        IllegalStateException - if the specified listener has already been added.
      • addTaskListener

        public abstract void addTaskListener​(TaskListener taskListener)
        Adds a specified listener so that it receives notification of events describing the progress of this compilation task. This method may be called at any time before or during the compilation.
        Parameters:
        taskListener - the task listener
        Throws:
        IllegalStateException - if the specified listener has already been added.
        Since:
        1.8
      • removeTaskListener

        public abstract void removeTaskListener​(TaskListener taskListener)
        Removes the specified listener so that it no longer receives notification of events describing the progress of this compilation task. This method may be called at any time before or during the compilation.
        Parameters:
        taskListener - the task listener
        Since:
        1.8
      • getElements

        public abstract Elements getElements​()
        Returns a utility object for dealing with program elements.
        Returns:
        a utility object for dealing with program elements
      • getTypes

        public abstract Types getTypes​()
        Returns a utility object for dealing with type mirrors.
        Returns:
        the utility object for dealing with type mirrors