// cached == SCRIPT should not happen here!
if (cached == SCRIPT) throw new GroovyBugError("name "+name+" was marked as script, but was not resolved as such");
if (cached != null) return true;
if (currentClass.getModule().hasPackageName() && name.indexOf('.') == -1) return false;
GroovyClassLoader loader = compilationUnit.getClassLoader();
Class cls;
try {
// NOTE: it's important to do no lookup against script files
// here since the GroovyClassLoader would create a new CompilationUnit
cls = loader.loadClass(name, false, true);
} catch (ClassNotFoundException cnfe) {
cachedClasses.put(name, SCRIPT);
return false;
} catch (CompilationFailedException cfe) {
compilationUnit.getErrorCollector().addErrorAndContinue(new ExceptionMessage(cfe, true, source));