private static ClassLoader getParentLoader ( ) { // check whether thread context loader can "see" Groovy Script class ClassLoader ctxtLoader = Thread . currentThread ( ) . getContextClassLoader ( ) ; try { Class < ? > c = ctxtLoader . loadClass ( Script . class . getName ( ) ) ; if ( c == Script . class ) { return ctxtLoader ; } } catch ( ClassNotFoundException cnfe ) { /* ignore */ } // exception was thrown or we get wrong class return Script . class . getClassLoader ( ) ; }
for GroovyClassLoader instance