Interface CompilationResult


  • @ProviderType
    public interface CompilationResult
    The compilation result allows clients of the java compiler to check for error messages, warnings (if not disabled by the options) and allows to access the compiled classes.
    Since:
    2.0
    • Method Detail

      • getErrors

        java.util.List<CompilerMessage> getErrors()
        Return a list of error messages that occured during compilation. If no errors occured null is returned.
        Returns:
        A list of error messages or null.
      • getWarnings

        java.util.List<CompilerMessage> getWarnings()
        Return a list of warnings that occured during compilation. If no warnings occured null is returned.
        Returns:
        A list of warnings or null.
      • didCompile

        boolean didCompile()
        Was a compilation required or were all classes recent?
        Returns:
        true if classes were compiled.
      • loadCompiledClass

        java.lang.Class<?> loadCompiledClass​(java.lang.String className)
                                      throws java.lang.ClassNotFoundException
        Try to load the compiled class. The class loading might fail if the className is not one of the compiled sources, if the compilation failed or if a class loader writer has been used in combination with a class loader that is not able to load the classes written by the class loader writer.
        Parameters:
        className - The class name of the compiled class.
        Returns:
        The compiled class
        Throws:
        java.lang.ClassNotFoundException - If the class could not be found or compilation failed.