private Class defineClassInLoader( ICompilableTypeInternal gsClass, boolean forceSingleServingLoader) { if (forceSingleServingLoader || shouldUseSingleServingLoader(gsClass) || BytecodeOptions.isSingleServingLoader()) { SingleServingGosuClassLoader loader = getOrCreateSingleServingLoader(gsClass); return defineClassInSingleServingLoader(gsClass, loader); } else { return defineAndMaybeVerify(gsClass); } }
private Class defineAndMaybeVerify(ICompilableTypeInternal gsClass) { try { GosuClassPathThing.init(); String strJavaClass = getJavaName(gsClass); Class cls = _loader.loadClass(strJavaClass); if (BytecodeOptions.aggressivelyVerify()) { NewIntrospector.getDeclaredMethods(cls); cls.getDeclaredMethods(); // force verification } return cls; } catch (ClassFormatError | VerifyError ve) { if (BytecodeOptions.aggressivelyVerify()) { compileClass(gsClass, true); // print the bytecode } throw ve; } catch (ClassNotFoundException e) { throw new RuntimeException(e); } }
boolean shouldDebugClass(ICompilableType gsClass) { return BytecodeOptions.shouldDebug(gsClass.getName()); }