private void internalInstallJvmTypeProvider ( XtextResourceSet resourceSet , File tmpClassDirectory , boolean skipIndexLookup ) { Iterable < String > classPathEntries = concat ( getClassPathEntries ( ) , getSourcePathDirectories ( ) , asList ( tmpClassDirectory . toString ( ) ) ) ; classPathEntries = filter ( classPathEntries , new Predicate < String > ( ) { public boolean apply ( String input ) { return ! Strings . isEmpty ( input . trim ( ) ) ; } } ) ; Function < String , URL > toUrl = new Function < String , URL > ( ) { public URL apply ( String from ) { try { return new File ( from ) . toURI ( ) . toURL ( ) ; } catch ( MalformedURLException e ) { throw new RuntimeException ( e ) ; } } } ; Iterable < URL > classPathUrls = Iterables . transform ( classPathEntries , toUrl ) ; log . debug ( "classpath used for Struct compilation : " + classPathUrls ) ; ClassLoader parentClassLoader ; if ( useCurrentClassLoaderAsParent ) { parentClassLoader = currentClassLoader ; } else { if ( isEmpty ( bootClassPath ) ) { parentClassLoader = ClassLoader . getSystemClassLoader ( ) . getParent ( ) ; } else { Iterable < URL > bootClassPathUrls = Iterables . transform ( getBootClassPathEntries ( ) , toUrl ) ; parentClassLoader = new BootClassLoader ( toArray ( bootClassPathUrls , URL . class ) ) ; } } ClassLoader urlClassLoader = new URLClassLoader ( toArray ( classPathUrls , URL . class ) , parentClassLoader ) ; new ClasspathTypeProvider ( urlClassLoader , resourceSet , skipIndexLookup ? null : indexedJvmTypeAccess ) ; resourceSet . setClasspathURIContext ( urlClassLoader ) ; // for annotation processing we need to have the compiler's classpath as // a parent. URLClassLoader urlClassLoaderForAnnotationProcessing = new URLClassLoader ( toArray ( classPathUrls , URL . class ) , currentClassLoader ) ; resourceSet . eAdapters ( ) . add ( new ProcessorClassloaderAdapter ( urlClassLoaderForAnnotationProcessing ) ) ; }
Performs the actual installation of the JvmTypeProvider .