Class CachedCompiler

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public class CachedCompiler
    extends java.lang.Object
    implements java.io.Closeable
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private @Nullable java.io.File classDir  
      private static java.util.List<java.lang.String> DEFAULT_OPTIONS  
      private static java.io.PrintWriter DEFAULT_WRITER  
      private java.util.Map<java.lang.ClassLoader,​MyJavaFileManager> fileManagerMap  
      private java.util.concurrent.ConcurrentMap<java.lang.String,​javax.tools.JavaFileObject> javaFileObjects  
      private java.util.Map<java.lang.ClassLoader,​java.util.Map<java.lang.String,​java.lang.Class<?>>> loadedClassesMap  
      private static org.slf4j.Logger LOG  
      private @NotNull java.util.List<java.lang.String> options  
      private @Nullable java.io.File sourceDir  
    • Constructor Summary

      Constructors 
      Constructor Description
      CachedCompiler​(@Nullable java.io.File sourceDir, @Nullable java.io.File classDir)  
      CachedCompiler​(@Nullable java.io.File sourceDir, @Nullable java.io.File classDir, @NotNull java.util.List<java.lang.String> options)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      (package private) @NotNull java.util.Map<java.lang.String,​byte[]> compileFromJava​(@NotNull java.lang.String className, @NotNull java.lang.String javaCode, @NotNull java.io.PrintWriter writer, MyJavaFileManager fileManager)  
      (package private) @NotNull java.util.Map<java.lang.String,​byte[]> compileFromJava​(@NotNull java.lang.String className, @NotNull java.lang.String javaCode, MyJavaFileManager fileManager)  
      java.lang.Class loadFromJava​(@NotNull java.lang.ClassLoader classLoader, @NotNull java.lang.String className, @NotNull java.lang.String javaCode)  
      java.lang.Class loadFromJava​(@NotNull java.lang.ClassLoader classLoader, @NotNull java.lang.String className, @NotNull java.lang.String javaCode, @Nullable java.io.PrintWriter writer)  
      java.lang.Class loadFromJava​(@NotNull java.lang.String className, @NotNull java.lang.String javaCode)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • LOG

        private static final org.slf4j.Logger LOG
      • DEFAULT_WRITER

        private static final java.io.PrintWriter DEFAULT_WRITER
      • DEFAULT_OPTIONS

        private static final java.util.List<java.lang.String> DEFAULT_OPTIONS
      • loadedClassesMap

        private final java.util.Map<java.lang.ClassLoader,​java.util.Map<java.lang.String,​java.lang.Class<?>>> loadedClassesMap
      • fileManagerMap

        private final java.util.Map<java.lang.ClassLoader,​MyJavaFileManager> fileManagerMap
      • sourceDir

        @Nullable
        private final @Nullable java.io.File sourceDir
      • classDir

        @Nullable
        private final @Nullable java.io.File classDir
      • options

        @NotNull
        private final @NotNull java.util.List<java.lang.String> options
      • javaFileObjects

        private final java.util.concurrent.ConcurrentMap<java.lang.String,​javax.tools.JavaFileObject> javaFileObjects
    • Constructor Detail

      • CachedCompiler

        public CachedCompiler​(@Nullable
                              @Nullable java.io.File sourceDir,
                              @Nullable
                              @Nullable java.io.File classDir)
      • CachedCompiler

        public CachedCompiler​(@Nullable
                              @Nullable java.io.File sourceDir,
                              @Nullable
                              @Nullable java.io.File classDir,
                              @NotNull
                              @NotNull java.util.List<java.lang.String> options)
    • Method Detail

      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
      • loadFromJava

        public java.lang.Class loadFromJava​(@NotNull
                                            @NotNull java.lang.String className,
                                            @NotNull
                                            @NotNull java.lang.String javaCode)
                                     throws java.lang.ClassNotFoundException
        Throws:
        java.lang.ClassNotFoundException
      • loadFromJava

        public java.lang.Class loadFromJava​(@NotNull
                                            @NotNull java.lang.ClassLoader classLoader,
                                            @NotNull
                                            @NotNull java.lang.String className,
                                            @NotNull
                                            @NotNull java.lang.String javaCode)
                                     throws java.lang.ClassNotFoundException
        Throws:
        java.lang.ClassNotFoundException
      • compileFromJava

        @NotNull
        @NotNull java.util.Map<java.lang.String,​byte[]> compileFromJava​(@NotNull
                                                                              @NotNull java.lang.String className,
                                                                              @NotNull
                                                                              @NotNull java.lang.String javaCode,
                                                                              MyJavaFileManager fileManager)
      • compileFromJava

        @NotNull
        @NotNull java.util.Map<java.lang.String,​byte[]> compileFromJava​(@NotNull
                                                                              @NotNull java.lang.String className,
                                                                              @NotNull
                                                                              @NotNull java.lang.String javaCode,
                                                                              @NotNull
                                                                              @NotNull java.io.PrintWriter writer,
                                                                              MyJavaFileManager fileManager)
      • loadFromJava

        public java.lang.Class loadFromJava​(@NotNull
                                            @NotNull java.lang.ClassLoader classLoader,
                                            @NotNull
                                            @NotNull java.lang.String className,
                                            @NotNull
                                            @NotNull java.lang.String javaCode,
                                            @Nullable
                                            @Nullable java.io.PrintWriter writer)
                                     throws java.lang.ClassNotFoundException
        Throws:
        java.lang.ClassNotFoundException