зеркало из https://github.com/mono/ikvm-fork.git
*** empty log message ***
This commit is contained in:
Родитель
86c1c21beb
Коммит
7e46ac06b0
|
@ -474,6 +474,8 @@ namespace IKVM.Runtime
|
|||
delegate IntPtr pf_IntPtr_pbyte_IntPtr_psbyte_IntPtr(JNIEnv* pEnv, byte* p1, IntPtr p2, sbyte* p3, int p4);
|
||||
delegate IntPtr pf_IntPtr_IntPtr_IntPtr(JNIEnv* pEnv, IntPtr p1, IntPtr p2);
|
||||
delegate jchar* pf_pjchar_IntPtr_pjboolean(JNIEnv* pEnv, IntPtr p1, jboolean* p2);
|
||||
delegate void pf_void_IntPtr_pvoid_int(JNIEnv* pEnv, IntPtr p1, void* p2, int p3);
|
||||
delegate void* pf_pvoid_IntPtr_pjboolean(JNIEnv* pEnv, IntPtr p1, jboolean* p2);
|
||||
delegate int pf_int_IntPtr_pbyte(JNIEnv* pEnv, IntPtr p1, byte* p2);
|
||||
delegate void pf_void_pbyte(JNIEnv* pEnv, byte* p1);
|
||||
delegate IntPtr pf_IntPtr_IntPtr_pbyte_pbyte(JNIEnv* pEnv, IntPtr p1, byte* p2, byte* p3);
|
||||
|
@ -851,11 +853,11 @@ namespace IKVM.Runtime
|
|||
new pf_void_IntPtr_int_int_IntPtr(JNIEnv.GetStringRegion), //virtual void JNICALL GetStringRegion(jstring str, jsize start, jsize len, jchar *buf);
|
||||
new pf_void_IntPtr_int_int_IntPtr(JNIEnv.GetStringUTFRegion), //virtual void JNICALL GetStringUTFRegion(jstring str, jsize start, jsize len, char *buf);
|
||||
|
||||
new pf_IntPtr_IntPtr_IntPtr(JNIEnv.GetPrimitiveArrayCritical), //virtual void* JNICALL GetPrimitiveArrayCritical(jarray array, jboolean *isCopy);
|
||||
new pf_void_IntPtr_IntPtr_int(JNIEnv.ReleasePrimitiveArrayCritical), //virtual void JNICALL ReleasePrimitiveArrayCritical(jarray array, void *carray, jint mode);
|
||||
new pf_pvoid_IntPtr_pjboolean(JNIEnv.GetPrimitiveArrayCritical), //virtual void* JNICALL GetPrimitiveArrayCritical(jarray array, jboolean *isCopy);
|
||||
new pf_void_IntPtr_pvoid_int(JNIEnv.ReleasePrimitiveArrayCritical), //virtual void JNICALL ReleasePrimitiveArrayCritical(jarray array, void *carray, jint mode);
|
||||
|
||||
new pf_IntPtr_IntPtr_IntPtr(JNIEnv.GetStringCritical), //virtual const jchar* JNICALL GetStringCritical(jstring string, jboolean *isCopy);
|
||||
new pf_void_IntPtr_IntPtr(JNIEnv.ReleaseStringCritical), //virtual void JNICALL ReleaseStringCritical(jstring string, const jchar *cstring);
|
||||
new pf_pjchar_IntPtr_pjboolean(JNIEnv.GetStringCritical), //virtual const jchar* JNICALL GetStringCritical(jstring string, jboolean *isCopy);
|
||||
new pf_void_IntPtr_pjchar(JNIEnv.ReleaseStringCritical), //virtual void JNICALL ReleaseStringCritical(jstring string, const jchar *cstring);
|
||||
|
||||
new pf_IntPtr_IntPtr(JNIEnv.NewWeakGlobalRef), //virtual jweak JNICALL NewWeakGlobalRef(jobject obj);
|
||||
new pf_void_IntPtr(JNIEnv.DeleteWeakGlobalRef), //virtual void JNICALL DeleteWeakGlobalRef(jweak ref);
|
||||
|
@ -1035,6 +1037,8 @@ namespace IKVM.Runtime
|
|||
internal IntPtr pendingException;
|
||||
internal RuntimeMethodHandle currentMethod;
|
||||
internal GCHandle classLoader;
|
||||
internal GCHandle criticalArrayHandle1;
|
||||
internal GCHandle criticalArrayHandle2;
|
||||
private static LocalDataStoreSlot cleanupHelperDataSlot = System.Threading.Thread.AllocateDataSlot();
|
||||
|
||||
unsafe class JNIEnvCleanupHelper
|
||||
|
@ -1064,6 +1068,14 @@ namespace IKVM.Runtime
|
|||
{
|
||||
pJNIEnv->classLoader.Free();
|
||||
}
|
||||
if(pJNIEnv->criticalArrayHandle1.IsAllocated)
|
||||
{
|
||||
pJNIEnv->criticalArrayHandle1.Free();
|
||||
}
|
||||
if(pJNIEnv->criticalArrayHandle2.IsAllocated)
|
||||
{
|
||||
pJNIEnv->criticalArrayHandle2.Free();
|
||||
}
|
||||
JniMem.Free((IntPtr)(void*)pJNIEnv);
|
||||
}
|
||||
}
|
||||
|
@ -1089,6 +1101,8 @@ namespace IKVM.Runtime
|
|||
pJNIEnv->pendingException = IntPtr.Zero;
|
||||
pJNIEnv->currentMethod = new RuntimeMethodHandle();
|
||||
pJNIEnv->classLoader = GCHandle.Alloc(null);
|
||||
pJNIEnv->criticalArrayHandle1 = GCHandle.Alloc(null, GCHandleType.Pinned);
|
||||
pJNIEnv->criticalArrayHandle2 = GCHandle.Alloc(null, GCHandleType.Pinned);
|
||||
return pJNIEnv;
|
||||
}
|
||||
|
||||
|
@ -3096,9 +3110,27 @@ namespace IKVM.Runtime
|
|||
}
|
||||
}
|
||||
|
||||
internal static IntPtr GetPrimitiveArrayCritical(JNIEnv* pEnv, IntPtr array, IntPtr isCopy)
|
||||
internal static void* GetPrimitiveArrayCritical(JNIEnv* pEnv, jarray array, jboolean* isCopy)
|
||||
{
|
||||
Array ar = (Array)pEnv->UnwrapRef(array);
|
||||
if(pEnv->criticalArrayHandle1.Target == null)
|
||||
{
|
||||
pEnv->criticalArrayHandle1.Target = ar;
|
||||
if(isCopy != null)
|
||||
{
|
||||
*isCopy = JNI_FALSE;
|
||||
}
|
||||
return (void*)pEnv->criticalArrayHandle1.AddrOfPinnedObject();
|
||||
}
|
||||
if(pEnv->criticalArrayHandle2.Target == null)
|
||||
{
|
||||
pEnv->criticalArrayHandle2.Target = ar;
|
||||
if(isCopy != null)
|
||||
{
|
||||
*isCopy = JNI_FALSE;
|
||||
}
|
||||
return (void*)pEnv->criticalArrayHandle2.AddrOfPinnedObject();
|
||||
}
|
||||
// TODO not 64-bit safe (len can overflow)
|
||||
int len = ar.Length * GetPrimitiveArrayElementSize(ar);
|
||||
GCHandle h = GCHandle.Alloc(ar, GCHandleType.Pinned);
|
||||
|
@ -3112,11 +3144,11 @@ namespace IKVM.Runtime
|
|||
{
|
||||
*pdst++ = *psrc++;
|
||||
}
|
||||
if(isCopy != IntPtr.Zero)
|
||||
if(isCopy != null)
|
||||
{
|
||||
*((sbyte*)(void*)isCopy) = JNI_TRUE;
|
||||
*isCopy = JNI_TRUE;
|
||||
}
|
||||
return hglobal;
|
||||
return (void*)hglobal;
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -3124,11 +3156,29 @@ namespace IKVM.Runtime
|
|||
}
|
||||
}
|
||||
|
||||
internal static void ReleasePrimitiveArrayCritical(JNIEnv* pEnv, IntPtr array, IntPtr carray, int mode)
|
||||
{
|
||||
if(mode == 0 || mode == JNI_COMMIT)
|
||||
internal static void ReleasePrimitiveArrayCritical(JNIEnv* pEnv, jarray array, void* carray, jint mode)
|
||||
{
|
||||
Array ar = (Array)pEnv->UnwrapRef(array);
|
||||
if(pEnv->criticalArrayHandle1.Target == ar
|
||||
&& (void*)pEnv->criticalArrayHandle1.AddrOfPinnedObject() == carray)
|
||||
{
|
||||
if(mode == 0 || mode == JNI_ABORT)
|
||||
{
|
||||
pEnv->criticalArrayHandle1.Target = null;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(pEnv->criticalArrayHandle2.Target == ar
|
||||
&& (void*)pEnv->criticalArrayHandle2.AddrOfPinnedObject() == carray)
|
||||
{
|
||||
if(mode == 0 || mode == JNI_ABORT)
|
||||
{
|
||||
pEnv->criticalArrayHandle2.Target = null;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(mode == 0 || mode == JNI_COMMIT)
|
||||
{
|
||||
// TODO not 64-bit safe (len can overflow)
|
||||
int len = ar.Length * GetPrimitiveArrayElementSize(ar);
|
||||
GCHandle h = GCHandle.Alloc(ar, GCHandleType.Pinned);
|
||||
|
@ -3149,28 +3199,28 @@ namespace IKVM.Runtime
|
|||
}
|
||||
if(mode == 0 || mode == JNI_ABORT)
|
||||
{
|
||||
JniMem.Free(carray);
|
||||
JniMem.Free((IntPtr)carray);
|
||||
}
|
||||
}
|
||||
|
||||
internal static IntPtr GetStringCritical(JNIEnv* pEnv, IntPtr str, IntPtr isCopy)
|
||||
internal static jchar* GetStringCritical(JNIEnv* pEnv, jstring str, jboolean* isCopy)
|
||||
{
|
||||
string s = (string)pEnv->UnwrapRef(str);
|
||||
if(s != null)
|
||||
{
|
||||
if(isCopy != IntPtr.Zero)
|
||||
if(isCopy != null)
|
||||
{
|
||||
*((sbyte*)(void*)isCopy) = JNI_TRUE;
|
||||
*isCopy = JNI_TRUE;
|
||||
}
|
||||
return Marshal.StringToHGlobalUni(s);
|
||||
return (jchar*)(void*)Marshal.StringToHGlobalUni(s);
|
||||
}
|
||||
SetPendingException(pEnv, JavaException.NullPointerException());
|
||||
return IntPtr.Zero;
|
||||
return null;
|
||||
}
|
||||
|
||||
internal static void ReleaseStringCritical(JNIEnv* pEnv, IntPtr str, IntPtr cstring)
|
||||
internal static void ReleaseStringCritical(JNIEnv* pEnv, jstring str, jchar* cstring)
|
||||
{
|
||||
Marshal.FreeHGlobal(cstring);
|
||||
Marshal.FreeHGlobal((IntPtr)(void*)cstring);
|
||||
}
|
||||
|
||||
internal static jweak NewWeakGlobalRef(JNIEnv* pEnv, jobject obj)
|
||||
|
|
|
@ -474,7 +474,7 @@ namespace IKVM.Internal
|
|||
// this returns the Java method's attributes in .NET terms (e.g. used to create stubs for this method)
|
||||
internal MethodAttributes GetMethodAttributes()
|
||||
{
|
||||
MethodAttributes attribs = 0;
|
||||
MethodAttributes attribs = MethodAttributes.HideBySig;
|
||||
if(IsStatic)
|
||||
{
|
||||
attribs |= MethodAttributes.Static;
|
||||
|
@ -1552,6 +1552,7 @@ namespace IKVM.Internal
|
|||
PropertyBuilder pb = typeBuilder.DefineProperty(Name, PropertyAttributes.None, basefield.FieldTypeWrapper.TypeAsSignatureType, Type.EmptyTypes);
|
||||
AttributeHelper.HideFromReflection(pb);
|
||||
MethodAttributes attribs = basefield.IsPublic ? MethodAttributes.Public : MethodAttributes.FamORAssem;
|
||||
attribs |= MethodAttributes.HideBySig;
|
||||
if(basefield.IsStatic)
|
||||
{
|
||||
attribs |= MethodAttributes.Static;
|
||||
|
|
|
@ -1563,7 +1563,7 @@ namespace IKVM.Internal
|
|||
}
|
||||
if(error)
|
||||
{
|
||||
MethodBuilder mb = typeBuilder.DefineMethod(mangledName, MethodAttributes.NewSlot | MethodAttributes.Private | MethodAttributes.Virtual | MethodAttributes.Final, ifmethod.ReturnTypeForDefineMethod, ifmethod.GetParametersForDefineMethod());
|
||||
MethodBuilder mb = typeBuilder.DefineMethod(mangledName, MethodAttributes.HideBySig | MethodAttributes.NewSlot | MethodAttributes.Private | MethodAttributes.Virtual | MethodAttributes.Final, ifmethod.ReturnTypeForDefineMethod, ifmethod.GetParametersForDefineMethod());
|
||||
AttributeHelper.HideFromJava(mb);
|
||||
EmitHelper.Throw(mb.GetILGenerator(), "java.lang.LinkageError", wrapper.Name + "." + ifmethod.Name + ifmethod.Signature);
|
||||
typeBuilder.DefineMethodOverride(mb, (MethodInfo)ifmethod.GetMethod());
|
||||
|
@ -1580,7 +1580,7 @@ namespace IKVM.Internal
|
|||
// it makes sense, so I hope the spec is wrong
|
||||
// UPDATE unfortunately, according to Serge Lidin the spec is correct, and it is not allowed to have virtual privatescope
|
||||
// methods. Sigh! So I have to use private methods and mangle the name
|
||||
MethodBuilder mb = typeBuilder.DefineMethod(mangledName, MethodAttributes.NewSlot | MethodAttributes.Private | MethodAttributes.Virtual | MethodAttributes.Final, ifmethod.ReturnTypeForDefineMethod, ifmethod.GetParametersForDefineMethod());
|
||||
MethodBuilder mb = typeBuilder.DefineMethod(mangledName, MethodAttributes.HideBySig | MethodAttributes.NewSlot | MethodAttributes.Private | MethodAttributes.Virtual | MethodAttributes.Final, ifmethod.ReturnTypeForDefineMethod, ifmethod.GetParametersForDefineMethod());
|
||||
AttributeHelper.HideFromJava(mb);
|
||||
EmitHelper.Throw(mb.GetILGenerator(), "java.lang.IllegalAccessError", wrapper.Name + "." + ifmethod.Name + ifmethod.Signature);
|
||||
typeBuilder.DefineMethodOverride(mb, (MethodInfo)ifmethod.GetMethod());
|
||||
|
@ -1588,7 +1588,7 @@ namespace IKVM.Internal
|
|||
}
|
||||
else if(mce.GetMethod() == null || mce.RealName != ifmethod.RealName)
|
||||
{
|
||||
MethodBuilder mb = typeBuilder.DefineMethod(mangledName, MethodAttributes.NewSlot | MethodAttributes.Private | MethodAttributes.Virtual | MethodAttributes.Final, ifmethod.ReturnTypeForDefineMethod, ifmethod.GetParametersForDefineMethod());
|
||||
MethodBuilder mb = typeBuilder.DefineMethod(mangledName, MethodAttributes.HideBySig | MethodAttributes.NewSlot | MethodAttributes.Private | MethodAttributes.Virtual | MethodAttributes.Final, ifmethod.ReturnTypeForDefineMethod, ifmethod.GetParametersForDefineMethod());
|
||||
AttributeHelper.HideFromJava(mb);
|
||||
ILGenerator ilGenerator = mb.GetILGenerator();
|
||||
ilGenerator.Emit(OpCodes.Ldarg_0);
|
||||
|
@ -1606,7 +1606,7 @@ namespace IKVM.Internal
|
|||
// NOTE methods inherited from base classes in a different assembly do *not* automatically implement
|
||||
// interface methods, so we have to generate a stub here that doesn't do anything but call the base
|
||||
// implementation
|
||||
MethodBuilder mb = typeBuilder.DefineMethod(mangledName, MethodAttributes.NewSlot | MethodAttributes.Private | MethodAttributes.Virtual | MethodAttributes.Final, ifmethod.ReturnTypeForDefineMethod, ifmethod.GetParametersForDefineMethod());
|
||||
MethodBuilder mb = typeBuilder.DefineMethod(mangledName, MethodAttributes.HideBySig | MethodAttributes.NewSlot | MethodAttributes.Private | MethodAttributes.Virtual | MethodAttributes.Final, ifmethod.ReturnTypeForDefineMethod, ifmethod.GetParametersForDefineMethod());
|
||||
typeBuilder.DefineMethodOverride(mb, (MethodInfo)ifmethod.GetMethod());
|
||||
AttributeHelper.HideFromJava(mb);
|
||||
ILGenerator ilGenerator = mb.GetILGenerator();
|
||||
|
@ -1626,7 +1626,7 @@ namespace IKVM.Internal
|
|||
{
|
||||
// the type doesn't implement the interface method and isn't abstract either. The JVM allows this, but the CLR doesn't,
|
||||
// so we have to create a stub method that throws an AbstractMethodError
|
||||
MethodBuilder mb = typeBuilder.DefineMethod(mangledName, MethodAttributes.NewSlot | MethodAttributes.Private | MethodAttributes.Virtual | MethodAttributes.Final, ifmethod.ReturnTypeForDefineMethod, ifmethod.GetParametersForDefineMethod());
|
||||
MethodBuilder mb = typeBuilder.DefineMethod(mangledName, MethodAttributes.HideBySig | MethodAttributes.NewSlot | MethodAttributes.Private | MethodAttributes.Virtual | MethodAttributes.Final, ifmethod.ReturnTypeForDefineMethod, ifmethod.GetParametersForDefineMethod());
|
||||
AttributeHelper.HideFromJava(mb);
|
||||
EmitHelper.Throw(mb.GetILGenerator(), "java.lang.AbstractMethodError", wrapper.Name + "." + ifmethod.Name + ifmethod.Signature);
|
||||
typeBuilder.DefineMethodOverride(mb, (MethodInfo)ifmethod.GetMethod());
|
||||
|
@ -3046,7 +3046,7 @@ namespace IKVM.Internal
|
|||
fieldName += "/" + typeWrapper.Name;
|
||||
}
|
||||
FieldAttributes attribs = 0;
|
||||
MethodAttributes methodAttribs = 0;
|
||||
MethodAttributes methodAttribs = MethodAttributes.HideBySig;
|
||||
bool setModifiers = false;
|
||||
if(fld.IsPrivate)
|
||||
{
|
||||
|
@ -3460,7 +3460,7 @@ namespace IKVM.Internal
|
|||
// TODO do this for indirectly implemented interfaces (interfaces implemented by interfaces) as well
|
||||
if(JVM.IsStaticCompiler && interfaces[i].IsGhost && wrapper.IsPublic)
|
||||
{
|
||||
MethodBuilder mb = typeBuilder.DefineMethod("op_Implicit", MethodAttributes.Public | MethodAttributes.Static | MethodAttributes.SpecialName, interfaces[i].TypeAsSignatureType, new Type[] { wrapper.TypeAsSignatureType });
|
||||
MethodBuilder mb = typeBuilder.DefineMethod("op_Implicit", MethodAttributes.HideBySig | MethodAttributes.Public | MethodAttributes.Static | MethodAttributes.SpecialName, interfaces[i].TypeAsSignatureType, new Type[] { wrapper.TypeAsSignatureType });
|
||||
ILGenerator ilgen = mb.GetILGenerator();
|
||||
LocalBuilder local = ilgen.DeclareLocal(interfaces[i].TypeAsSignatureType);
|
||||
ilgen.Emit(OpCodes.Ldloca, local);
|
||||
|
@ -4009,7 +4009,7 @@ namespace IKVM.Internal
|
|||
// We're a Miranda method
|
||||
Debug.Assert(baseMethods[index].DeclaringType.IsInterface);
|
||||
string name = GenerateUniqueMethodName(methods[index].Name, baseMethods[index]);
|
||||
MethodBuilder mb = typeBuilder.DefineMethod(methods[index].Name, MethodAttributes.NewSlot | MethodAttributes.Public | MethodAttributes.Virtual | MethodAttributes.Abstract | MethodAttributes.CheckAccessOnOverride, methods[index].ReturnTypeForDefineMethod, methods[index].GetParametersForDefineMethod());
|
||||
MethodBuilder mb = typeBuilder.DefineMethod(methods[index].Name, MethodAttributes.HideBySig | MethodAttributes.NewSlot | MethodAttributes.Public | MethodAttributes.Virtual | MethodAttributes.Abstract | MethodAttributes.CheckAccessOnOverride, methods[index].ReturnTypeForDefineMethod, methods[index].GetParametersForDefineMethod());
|
||||
AttributeHelper.HideFromReflection(mb);
|
||||
if(unloadableOverrideStub || name != methods[index].Name)
|
||||
{
|
||||
|
@ -4027,6 +4027,7 @@ namespace IKVM.Internal
|
|||
else if(methods[index].IsAccessStub)
|
||||
{
|
||||
MethodAttributes stubattribs = baseMethods[index].IsPublic ? MethodAttributes.Public : MethodAttributes.FamORAssem;
|
||||
stubattribs |= MethodAttributes.HideBySig;
|
||||
if(baseMethods[index].IsStatic)
|
||||
{
|
||||
stubattribs |= MethodAttributes.Static;
|
||||
|
@ -4073,7 +4074,7 @@ namespace IKVM.Internal
|
|||
setNameSig |= tw.IsUnloadable || tw.IsGhostArray;
|
||||
}
|
||||
bool setModifiers = false;
|
||||
MethodAttributes attribs = 0;
|
||||
MethodAttributes attribs = MethodAttributes.HideBySig;
|
||||
if(m.IsNative)
|
||||
{
|
||||
if(wrapper.IsPInvokeMethod(m))
|
||||
|
@ -4278,7 +4279,7 @@ namespace IKVM.Internal
|
|||
if(needFinalize)
|
||||
{
|
||||
MethodInfo baseFinalize = typeBuilder.BaseType.GetMethod("Finalize", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance, null, Type.EmptyTypes, null);
|
||||
MethodAttributes attr = MethodAttributes.Virtual;
|
||||
MethodAttributes attr = MethodAttributes.HideBySig | MethodAttributes.Virtual;
|
||||
// make sure we don't reduce accessibility
|
||||
attr |= baseFinalize.IsPublic ? MethodAttributes.Public : MethodAttributes.Family;
|
||||
if(m.IsFinal)
|
||||
|
@ -5077,7 +5078,7 @@ namespace IKVM.Internal
|
|||
|
||||
private static MethodAttributes GetPropertyMethodAttributes(MethodWrapper mw, bool final)
|
||||
{
|
||||
MethodAttributes attribs = (MethodAttributes)0;
|
||||
MethodAttributes attribs = MethodAttributes.HideBySig;
|
||||
if(mw.IsStatic)
|
||||
{
|
||||
attribs |= MethodAttributes.Static;
|
||||
|
@ -5503,7 +5504,7 @@ namespace IKVM.Internal
|
|||
TypeWrapper[] implementers = GetGhostImplementers(this);
|
||||
for(int i = 0; i < implementers.Length; i++)
|
||||
{
|
||||
mb = typeBuilder.DefineMethod("op_Implicit", MethodAttributes.Public | MethodAttributes.Static | MethodAttributes.SpecialName, TypeAsSignatureType, new Type[] { implementers[i].TypeAsSignatureType });
|
||||
mb = typeBuilder.DefineMethod("op_Implicit", MethodAttributes.HideBySig | MethodAttributes.Public | MethodAttributes.Static | MethodAttributes.SpecialName, TypeAsSignatureType, new Type[] { implementers[i].TypeAsSignatureType });
|
||||
ilgen = mb.GetILGenerator();
|
||||
local = ilgen.DeclareLocal(TypeAsSignatureType);
|
||||
ilgen.Emit(OpCodes.Ldloca, local);
|
||||
|
@ -5610,7 +5611,7 @@ namespace IKVM.Internal
|
|||
ilgen.Emit(OpCodes.Ldobj, TypeAsSignatureType);
|
||||
ilgen.Emit(OpCodes.Ret);
|
||||
// Add "ToObject" methods
|
||||
mb = typeBuilder.DefineMethod("ToObject", MethodAttributes.Public, typeof(object), Type.EmptyTypes);
|
||||
mb = typeBuilder.DefineMethod("ToObject", MethodAttributes.HideBySig | MethodAttributes.Public, typeof(object), Type.EmptyTypes);
|
||||
AttributeHelper.HideFromJava(mb);
|
||||
ilgen = mb.GetILGenerator();
|
||||
ilgen.Emit(OpCodes.Ldarg_0);
|
||||
|
@ -5658,14 +5659,14 @@ namespace IKVM.Internal
|
|||
ghostRefField = typeBuilder.DefineField("__<ref>", typeof(object), FieldAttributes.Public | FieldAttributes.SpecialName);
|
||||
typeBuilderGhostInterface = typeBuilder.DefineNestedType("__Interface", TypeAttributes.Interface | TypeAttributes.Abstract | TypeAttributes.NestedPublic);
|
||||
AttributeHelper.HideFromJava(typeBuilderGhostInterface);
|
||||
ghostIsInstanceMethod = typeBuilder.DefineMethod("IsInstance", MethodAttributes.Public | MethodAttributes.Static, typeof(bool), new Type[] { typeof(object) });
|
||||
ghostIsInstanceMethod = typeBuilder.DefineMethod("IsInstance", MethodAttributes.HideBySig | MethodAttributes.Public | MethodAttributes.Static, typeof(bool), new Type[] { typeof(object) });
|
||||
ghostIsInstanceMethod.DefineParameter(1, ParameterAttributes.None, "obj");
|
||||
ghostIsInstanceArrayMethod = typeBuilder.DefineMethod("IsInstanceArray", MethodAttributes.Public | MethodAttributes.Static, typeof(bool), new Type[] { typeof(object), typeof(int) });
|
||||
ghostIsInstanceArrayMethod = typeBuilder.DefineMethod("IsInstanceArray", MethodAttributes.HideBySig | MethodAttributes.Public | MethodAttributes.Static, typeof(bool), new Type[] { typeof(object), typeof(int) });
|
||||
ghostIsInstanceArrayMethod.DefineParameter(1, ParameterAttributes.None, "obj");
|
||||
ghostIsInstanceArrayMethod.DefineParameter(2, ParameterAttributes.None, "rank");
|
||||
ghostCastMethod = typeBuilder.DefineMethod("Cast", MethodAttributes.Public | MethodAttributes.Static, typeBuilder, new Type[] { typeof(object) });
|
||||
ghostCastMethod = typeBuilder.DefineMethod("Cast", MethodAttributes.HideBySig | MethodAttributes.Public | MethodAttributes.Static, typeBuilder, new Type[] { typeof(object) });
|
||||
ghostCastMethod.DefineParameter(1, ParameterAttributes.None, "obj");
|
||||
ghostCastArrayMethod = typeBuilder.DefineMethod("CastArray", MethodAttributes.Public | MethodAttributes.Static, typeof(void), new Type[] { typeof(object), typeof(int) });
|
||||
ghostCastArrayMethod = typeBuilder.DefineMethod("CastArray", MethodAttributes.HideBySig | MethodAttributes.Public | MethodAttributes.Static, typeof(void), new Type[] { typeof(object), typeof(int) });
|
||||
ghostCastArrayMethod.DefineParameter(1, ParameterAttributes.None, "obj");
|
||||
ghostCastArrayMethod.DefineParameter(2, ParameterAttributes.None, "rank");
|
||||
return typeBuilder;
|
||||
|
|
|
@ -1218,7 +1218,7 @@ namespace IKVM.Internal
|
|||
typeWrapper.helperTypeBuilder = typeWrapper.typeBuilder.DefineNestedType("__Helper", TypeAttributes.NestedPublic | TypeAttributes.Class);
|
||||
AttributeHelper.HideFromJava(typeWrapper.helperTypeBuilder);
|
||||
}
|
||||
helper = typeWrapper.helperTypeBuilder.DefineMethod(m.Name, MethodAttributes.Public | MethodAttributes.Static, typeWrapper.GetClassLoader().RetTypeWrapperFromSig(m.Sig).TypeAsSignatureType, argTypes);
|
||||
helper = typeWrapper.helperTypeBuilder.DefineMethod(m.Name, MethodAttributes.HideBySig | MethodAttributes.Public | MethodAttributes.Static, typeWrapper.GetClassLoader().RetTypeWrapperFromSig(m.Sig).TypeAsSignatureType, argTypes);
|
||||
if(m.Attributes != null)
|
||||
{
|
||||
foreach(IKVM.Internal.MapXml.Attribute custattr in m.Attributes)
|
||||
|
@ -1284,7 +1284,7 @@ namespace IKVM.Internal
|
|||
else
|
||||
{
|
||||
MethodInfo overrideMethod = null;
|
||||
MethodAttributes attr = MapMethodAccessModifiers(m.Modifiers);
|
||||
MethodAttributes attr = MapMethodAccessModifiers(m.Modifiers) | MethodAttributes.HideBySig;
|
||||
if((m.Modifiers & IKVM.Internal.MapXml.MapModifiers.Static) != 0)
|
||||
{
|
||||
attr |= MethodAttributes.Static;
|
||||
|
@ -1328,7 +1328,7 @@ namespace IKVM.Internal
|
|||
if((m.Modifiers & IKVM.Internal.MapXml.MapModifiers.Static) == 0)
|
||||
{
|
||||
// instance methods must have an instancehelper method
|
||||
MethodAttributes attr = MapMethodAccessModifiers(m.Modifiers) | MethodAttributes.Static;
|
||||
MethodAttributes attr = MapMethodAccessModifiers(m.Modifiers) | MethodAttributes.HideBySig | MethodAttributes.Static;
|
||||
// NOTE instancehelpers for protected methods are made public,
|
||||
// because cli.System.Object derived types can call protected methods
|
||||
if((m.Modifiers & IKVM.Internal.MapXml.MapModifiers.Protected) != 0)
|
||||
|
|
Загрузка…
Ссылка в новой задаче