< prev index next >

modules/javafx.base/src/main/java/com/sun/javafx/reflect/MethodUtil.java

Print this page
rev 10442 : [mq]: fix-v1-8177566-trampoline


  72     private static Object invoke(Method m, Object obj, Object[] params)
  73         throws InvocationTargetException, IllegalAccessException
  74     {
  75         ensureInvocableMethod(m);
  76         return m.invoke(obj, params);
  77     }
  78 }
  79 
  80 /*
  81  * Create a trampoline class.
  82  */
  83 public final class MethodUtil extends SecureClassLoader {
  84     private static final String MISC_PKG = "com.sun.javafx.reflect.";
  85     private static final String TRAMPOLINE = MISC_PKG + "Trampoline";
  86     private static final Method bounce = getTrampoline();
  87 
  88     private MethodUtil() {
  89         super();
  90     }
  91 
  92     public static Method getMethod(Class<?> cls, String name, Class<?>[] args)

  93         throws NoSuchMethodException {
  94         ReflectUtil.checkPackageAccess(cls);
  95         return cls.getMethod(name, args);
  96     }
  97 
  98     public static Method[] getMethods(Class<?> cls) {

  99         ReflectUtil.checkPackageAccess(cls);
 100         return cls.getMethods();
 101     }
 102 
 103     /*
 104      * Discover the public methods on public classes
 105      * and interfaces accessible to any caller by calling
 106      * Class.getMethods() and walking towards Object until
 107      * we're done.
 108      */
 109      public static Method[] getPublicMethods(Class<?> cls) {

 110         // compatibility for update release
 111         if (System.getSecurityManager() == null) {
 112             return cls.getMethods();
 113         }
 114         Map<Signature, Method> sigs = new HashMap<Signature, Method>();
 115         while (cls != null) {
 116             boolean done = getInternalPublicMethods(cls, sigs);
 117             if (done) {
 118                 break;
 119             }
 120             getInterfaceMethods(cls, sigs);
 121             cls = cls.getSuperclass();
 122         }
 123         return sigs.values().toArray(new Method[sigs.size()]);
 124     }
 125 
 126     /*
 127      * Process the immediate interfaces of this class or interface.
 128      */
 129     private static void getInterfaceMethods(Class<?> cls,




  72     private static Object invoke(Method m, Object obj, Object[] params)
  73         throws InvocationTargetException, IllegalAccessException
  74     {
  75         ensureInvocableMethod(m);
  76         return m.invoke(obj, params);
  77     }
  78 }
  79 
  80 /*
  81  * Create a trampoline class.
  82  */
  83 public final class MethodUtil extends SecureClassLoader {
  84     private static final String MISC_PKG = "com.sun.javafx.reflect.";
  85     private static final String TRAMPOLINE = MISC_PKG + "Trampoline";
  86     private static final Method bounce = getTrampoline();
  87 
  88     private MethodUtil() {
  89         super();
  90     }
  91 
  92     /*public*/
  93     static Method getMethod(Class<?> cls, String name, Class<?>[] args)
  94         throws NoSuchMethodException {
  95         ReflectUtil.checkPackageAccess(cls);
  96         return cls.getMethod(name, args);
  97     }
  98 
  99     /*public*/
 100     static Method[] getMethods(Class<?> cls) {
 101         ReflectUtil.checkPackageAccess(cls);
 102         return cls.getMethods();
 103     }
 104 
 105     /*
 106      * Discover the public methods on public classes
 107      * and interfaces accessible to any caller by calling
 108      * Class.getMethods() and walking towards Object until
 109      * we're done.
 110      */
 111     /*public*/
 112     static Method[] getPublicMethods(Class<?> cls) {
 113         // compatibility for update release
 114         if (System.getSecurityManager() == null) {
 115             return cls.getMethods();
 116         }
 117         Map<Signature, Method> sigs = new HashMap<Signature, Method>();
 118         while (cls != null) {
 119             boolean done = getInternalPublicMethods(cls, sigs);
 120             if (done) {
 121                 break;
 122             }
 123             getInterfaceMethods(cls, sigs);
 124             cls = cls.getSuperclass();
 125         }
 126         return sigs.values().toArray(new Method[sigs.size()]);
 127     }
 128 
 129     /*
 130      * Process the immediate interfaces of this class or interface.
 131      */
 132     private static void getInterfaceMethods(Class<?> cls,


< prev index next >