[reflection] remove override get ReflectedType for MonoGenericMethod and MonoGenricCM...
authorAleksey Kliger <aleksey@xamarin.com>
Mon, 11 Jan 2016 16:31:47 +0000 (11:31 -0500)
committerAleksey Kliger <aleksey@xamarin.com>
Mon, 11 Jan 2016 17:11:35 +0000 (12:11 -0500)
Should return the type that was queried, not the type where the method
is declared.

Fixes [#12205](https://bugzilla.xamarin.com/show_bug.cgi?id=12205)

mcs/class/corlib/System.Reflection/MonoGenericMethod.cs
mono/metadata/icall-def.h
mono/metadata/icall.c
mono/metadata/reflection.c

index 6c7503bd0870c72b2f4e2002b0f34caaa6aacdb5..48ef423cf4e67a23c00bdee5ff354011440a3c12 100644 (file)
@@ -45,10 +45,6 @@ namespace System.Reflection
                        throw new InvalidOperationException ();
                }
 
-               public override extern Type ReflectedType {
-                       [MethodImplAttribute(MethodImplOptions.InternalCall)]
-                       get;
-               }
        }
 
        [Serializable]
@@ -60,10 +56,5 @@ namespace System.Reflection
                        // this should not be used
                        throw new InvalidOperationException ();
                }
-
-               public override extern Type ReflectedType {
-                       [MethodImplAttribute(MethodImplOptions.InternalCall)]
-                       get;
-               }
        }
 }
index 88fb2539e83319225eda11d4e5f8247949b2eee9..a98091bc5a9ffc0fc5a9789a8bda0408d1e454ff 100644 (file)
@@ -590,17 +590,10 @@ ICALL(MFIELD_6, "ResolveType", ves_icall_MonoField_ResolveType)
 ICALL(MFIELD_4, "SetValueInternal", ves_icall_MonoField_SetValueInternal)
 ICALL(MFIELD_7, "get_core_clr_security_level", ves_icall_MonoField_get_core_clr_security_level)
 
-ICALL_TYPE(MGENCM, "System.Reflection.MonoGenericCMethod", MGENCM_1)
-ICALL(MGENCM_1, "get_ReflectedType", ves_icall_MonoGenericMethod_get_ReflectedType)
-
 ICALL_TYPE(MGENCL, "System.Reflection.MonoGenericClass", MGENCL_5)
 ICALL(MGENCL_5, "initialize", mono_reflection_generic_class_initialize)
 ICALL(MGENCL_6, "register_with_runtime", mono_reflection_register_with_runtime)
 
-/* note this is the same as above: unify */
-ICALL_TYPE(MGENM, "System.Reflection.MonoGenericMethod", MGENM_1)
-ICALL(MGENM_1, "get_ReflectedType", ves_icall_MonoGenericMethod_get_ReflectedType)
-
 ICALL_TYPE(MMETH, "System.Reflection.MonoMethod", MMETH_2)
 ICALL(MMETH_2, "GetGenericArguments", ves_icall_MonoMethod_GetGenericArguments)
 ICALL(MMETH_3, "GetGenericMethodDefinition_impl", ves_icall_MonoMethod_GetGenericMethodDefinition)
index 69c89e9faf12d6832c0b7a47ab4f3a4744bcc9f4..06b2c57a759b7010a4bd92f16ecc04cef9814301 100644 (file)
@@ -1927,14 +1927,6 @@ ves_icall_MonoField_ResolveType (MonoReflectionField *ref_field)
        return mono_type_get_object (mono_object_domain (ref_field), type);
 }
 
-ICALL_EXPORT MonoReflectionType*
-ves_icall_MonoGenericMethod_get_ReflectedType (MonoReflectionGenericMethod *rmethod)
-{
-       MonoMethod *method = rmethod->method.method;
-
-       return mono_type_get_object (mono_object_domain (rmethod), &method->klass->byval_arg);
-}
-
 /* From MonoProperty.cs */
 typedef enum {
        PInfo_Attributes = 1,
index 4f1f6d8405494b51c21655a4fdc9c7dd7f213fd9..c547c696eea1a0ebe7ee4e819ba002297a74f61f 100644 (file)
@@ -6816,7 +6816,8 @@ mono_method_get_object (MonoDomain *domain, MonoMethod *method, MonoClass *refcl
        if (method->is_inflated) {
                MonoReflectionGenericMethod *gret;
 
-               refclass = method->klass;
+               if (!refclass)
+                       refclass = method->klass;
                CHECK_OBJECT (MonoReflectionMethod *, method, refclass);
                if ((*method->name == '.') && (!strcmp (method->name, ".ctor") || !strcmp (method->name, ".cctor"))) {
                        if (!System_Reflection_MonoGenericCMethod)