static Method getMethod ( final Class < ? > c , final String name , final Class < ? > ... params ) throws NoSuchMethodException { if ( System . getSecurityManager ( ) == null ) return c . getMethod ( name , params ) ; Method result = AccessController . doPrivileged ( new PrivilegedAction < Method > ( ) { public Method run ( ) { try { return c . getMethod ( name , params ) ; } catch ( NoSuchMethodException e ) { return null ; } } } ) ; if ( result != null ) return result ; throw new NoSuchMethodException ( ) ; }
Get the method