[verifier] Do method visibility checks for virtual final methods. Enable type visibil...
authorRodrigo Kumpera <kumpera@gmail.com>
Thu, 14 Apr 2016 00:41:20 +0000 (17:41 -0700)
committerRodrigo Kumpera <kumpera@gmail.com>
Wed, 20 Apr 2016 15:37:58 +0000 (08:37 -0700)
I cannot repro the issue mentioned in the comments of mono_method_can_access_method.

* FIXME:
* with generics calls to explicit interface implementations can be expressed
* directly: the method is private, but we must allow it. This may be opening
* a hole or the generics code should handle this differently.
* Maybe just ensure the interface type is public.

mcs/class/corlib/Test/System/DelegateTest.cs
mono/metadata/class.c

index ae5a82908c861894674a758b8ba8496d5027da2a..e1d95dc93f00f563a4a7415708b3714d5a107a4f 100644 (file)
@@ -1251,7 +1251,7 @@ namespace MonoTests.System
                        }
                }
        
-               delegate int IntNoArgs ();
+               public delegate int IntNoArgs ();
 
                [Test]
                public void CreateDelegateWithAbstractMethods ()
index 17da478b5e9c1f089d76de0bc275da6ab5e21077..af9bb812c7456f0284003c49c9a94f1010ecfa8e 100644 (file)
@@ -10308,26 +10308,7 @@ mono_method_can_access_field (MonoMethod *method, MonoClassField *field)
 gboolean
 mono_method_can_access_method (MonoMethod *method, MonoMethod *called)
 {
-       int can = can_access_member (method->klass, called->klass, NULL, called->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK);
-       if (!can) {
-               MonoClass *nested = method->klass->nested_in;
-               while (nested) {
-                       can = can_access_member (nested, called->klass, NULL, called->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK);
-                       if (can)
-                               return TRUE;
-                       nested = nested->nested_in;
-               }
-       }
-       /* 
-        * FIXME:
-        * with generics calls to explicit interface implementations can be expressed
-        * directly: the method is private, but we must allow it. This may be opening
-        * a hole or the generics code should handle this differently.
-        * Maybe just ensure the interface type is public.
-        */
-       if ((called->flags & METHOD_ATTRIBUTE_VIRTUAL) && (called->flags & METHOD_ATTRIBUTE_FINAL))
-               return TRUE;
-       return can;
+       return mono_method_can_access_method_full (method, called, NULL);
 }
 
 /*