Class Compiler

    • Constructor Detail

      • Compiler

        public Compiler()
        Initializes a new compiler.
      • Compiler

        @Deprecated
        public Compiler​(java.io.File[] sourcePath,
                        java.io.File[] classPath,
                        @Nullable
                        java.io.File[] extDirs,
                        @Nullable
                        java.io.File[] bootClassPath,
                        @Nullable
                        java.io.File destinationDirectory,
                        @Nullable
                        java.lang.String characterEncoding,
                        boolean verbose,
                        boolean debugSource,
                        boolean debugLines,
                        boolean debugVars,
                        StringPattern[] warningHandlePatterns,
                        boolean rebuild)
        Deprecated.
        Use Compiler() and the various configuration setters instead
    • Method Detail

      • options

        public java.util.EnumSet<JaninoOption> options()
        Returns:
        A reference to the currently effective compilation options; changes to it take effect immediately
      • options

        public Compiler options​(java.util.EnumSet<JaninoOption> options)
        Sets the options for all future compilations.
      • getClassFile

        public static java.io.File getClassFile​(java.lang.String className,
                                                java.io.File sourceFile,
                                                @Nullable
                                                java.io.File destinationDirectory)
        Constructs the name of a file that could store the byte code of the class with the given name.

        If destinationDirectory is non-null, the returned path is the destinationDirectory plus the package of the class (with dots replaced with file separators) plus the class name plus ".class". Example: "destdir/pkg1/pkg2/Outer$Inner.class"

        If destinationDirectory is null, the returned path is the directory of the sourceFile plus the class name plus ".class". Example: "srcdir/Outer$Inner.class"

        Parameters:
        className - E.g. "pkg1.pkg2.Outer$Inner"
        sourceFile - E.g. "srcdir/Outer.java"
        destinationDirectory - E.g. "destdir"
      • storeClassFile

        public void storeClassFile​(ClassFile classFile,
                                   java.io.File sourceFile)
                            throws java.io.IOException
        Stores the byte code of this ClassFile in the file system. Directories are created as necessary.
        Parameters:
        classFile -
        sourceFile - Required to compute class file path if no destination directory given
        Throws:
        java.io.IOException
      • setVerbose

        public void setVerbose​(boolean verbose)
        Description copied from interface: ICompiler
        Equivalent of -verbose.