예제 #1
0
 /**
  * Looks for a super method
  *
  * @param node the current node
  * @param mname the method name
  * @param params the parameter types
  * @exception NoSuchMethodException if the method cannot be found
  */
 @Override
 public Method lookupSuperMethod(final Node node, final String mname, final Class[] params)
     throws NoSuchMethodException {
   Method m = null;
   try {
     m = ReflectionUtilities.lookupMethod(this.declaringClass, "super$" + mname, params);
   } catch (final NoSuchMethodException e) {
     m = ReflectionUtilities.lookupMethod(this.declaringClass, mname, params);
   }
   setAccessFlag(m);
   return m;
 }
예제 #2
0
 /**
  * Looks for a method
  *
  * @param prefix the method prefix
  * @param mname the method name
  * @param params the parameter types
  * @exception NoSuchMethodException if the method cannot be found
  */
 @Override
 public Method lookupMethod(final Node prefix, final String mname, final Class[] params)
     throws NoSuchMethodException {
   final Class c = NodeProperties.getType(prefix);
   Method m = null;
   try {
     m = ReflectionUtilities.lookupMethod(c, mname, params);
     setAccessFlag(m);
     if (m.getName().equals("clone")) {
       m.setAccessible(true);
     }
     return m;
   } catch (final NoSuchMethodException e) {
     if (prefix instanceof ReferenceType && c == this.declaringClass) {
       m = InterpreterUtilities.lookupOuterMethod(c, mname, params);
       m.setAccessible(true);
       return m;
     } else {
       throw e;
     }
   }
 }