public JavaFileObject getJavaFileForOutput ( Location location , String className , Kind kind , FileObject sibling ) throws IOException { if ( logger . isMdwDebugEnabled ( ) ) logger . mdwDebug ( "Loading Dynamic Java byte code from: " + ( sibling == null ? null : sibling . toUri ( ) ) ) ; try { JavaFileObject jfo = new ByteArrayJavaFileObject ( className , kind ) ; jfoCache . putIfAbsent ( className , jfo ) ; return jfo ; } catch ( Exception ex ) { logger . severeException ( ex . getMessage ( ) , ex ) ; throw new IOException ( ex . getMessage ( ) , ex ) ; } }
Create a new Java file object which will be used by the compiler to store the generated byte code . Also add a reference to the object to the cache so it can be accessed by other parts of the application .