private static void CreateNoFail(CompilerClassLoader loader, TypeWrapper[] interfaces, List <ProxyMethod> methods) { bool ispublic = true; Type[] interfaceTypes = new Type[interfaces.Length]; for (int i = 0; i < interfaceTypes.Length; i++) { ispublic &= interfaces[i].IsPublic; interfaceTypes[i] = interfaces[i].TypeAsBaseType; } TypeAttributes attr = TypeAttributes.Class | TypeAttributes.Sealed; attr |= ispublic ? TypeAttributes.NestedPublic : TypeAttributes.NestedAssembly; DynamicClassLoader factory = (DynamicClassLoader)loader.GetTypeWrapperFactory(); TypeBuilder tb = factory.DefineProxy(TypeNameUtil.GetProxyNestedName(interfaces), attr, proxyClass.TypeAsBaseType, interfaceTypes); AttributeHelper.SetImplementsAttribute(tb, interfaces); // we apply an InnerClass attribute to avoid the CompiledTypeWrapper heuristics for figuring out the modifiers AttributeHelper.SetInnerClass(tb, null, ispublic ? Modifiers.Public | Modifiers.Final : Modifiers.Final); CreateConstructor(tb); for (int i = 0; i < methods.Count; i++) { methods[i].fb = tb.DefineField("m" + i, javaLangReflectMethod.TypeAsSignatureType, FieldAttributes.Private | FieldAttributes.Static); } foreach (ProxyMethod method in methods) { CreateMethod(loader, tb, method); } CreateStaticInitializer(tb, methods, loader); }
private static void CreateNoFail(CompilerClassLoader loader, TypeWrapper[] interfaces, List <ProxyMethod> methods) { DynamicClassLoader factory = (DynamicClassLoader)loader.GetTypeWrapperFactory(); TypeBuilder tb = factory.DefineProxy(proxyClass, interfaces); AttributeHelper.SetImplementsAttribute(tb, interfaces); CreateConstructor(tb); for (int i = 0; i < methods.Count; i++) { methods[i].fb = tb.DefineField("m" + i, javaLangReflectMethod.TypeAsSignatureType, FieldAttributes.Private | FieldAttributes.Static); } foreach (ProxyMethod method in methods) { CreateMethod(loader, tb, method); } CreateStaticInitializer(tb, methods); }