Example #1
0
 private IGosuClass createJavaInterfaceProxy(final IJavaType type) {
   final IModule module = type.getTypeLoader().getModule();
   GosuClassTypeLoader loader = GosuClassTypeLoader.getDefaultClassLoader(module);
   return loader.makeNewClass(
       new LazyStringSourceFileHandle(
           type,
           new Callable<StringBuilder>() {
             public StringBuilder call() {
               module.getExecutionEnvironment().pushModule(module);
               try {
                 return genJavaInterfaceProxy(type);
               } finally {
                 module.getExecutionEnvironment().popModule(module);
               }
             }
           }));
 }
Example #2
0
  private IGosuClass createJavaClassProxy(final IJavaType type) {
    String strProxy = IGosuClass.PROXY_PREFIX + '.' + type.getName();
    IType compilingType = GosuClassCompilingStack.getCompilingType(strProxy);
    if (compilingType != null) {
      return (IGosuClass) compilingType;
    }

    final IModule module = type.getTypeLoader().getModule();
    return GosuClassTypeLoader.getDefaultClassLoader(module)
        .makeNewClass(
            new LazyStringSourceFileHandle(
                type,
                new Callable<StringBuilder>() {
                  public StringBuilder call() {
                    module.getExecutionEnvironment().pushModule(module);
                    try {
                      return genJavaClassProxy(type);
                    } finally {
                      module.getExecutionEnvironment().popModule(module);
                    }
                  }
                }));
  }