private static LookupResult tryAsScript ( String name , CompilationUnit compilationUnit , ClassNode oldClass ) { LookupResult lr = null ; if ( oldClass != null ) { lr = new LookupResult ( null , oldClass ) ; } if ( name . startsWith ( "java." ) ) return lr ; //TODO: don't ignore inner static classes completely if ( name . indexOf ( ' ' ) != - 1 ) return lr ; // try to find a script from classpath*/ GroovyClassLoader gcl = compilationUnit . getClassLoader ( ) ; URL url = null ; try { url = gcl . getResourceLoader ( ) . loadGroovySource ( name ) ; } catch ( MalformedURLException e ) { // fall through and let the URL be null } if ( url != null && ( oldClass == null || isSourceNewer ( url , oldClass ) ) ) { SourceUnit su = compilationUnit . addSource ( url ) ; return new LookupResult ( su , null ) ; } return lr ; }
try to find a script using the compilation unit class loader .