Пример #1
0
 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);
   }
 }
Пример #2
0
  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);
    }
  }
Пример #3
0
 boolean shouldDebugClass(ICompilableType gsClass) {
   return BytecodeOptions.shouldDebug(gsClass.getName());
 }