/**
  * Looks for a field
  *
  * @param fc the field class
  * @param fn the field name
  * @exception NoSuchFieldException if the field cannot be found
  * @exception AmbiguousFieldException if the field is ambiguous
  */
 @Override
 public Field getField(final Class fc, final String fn)
     throws NoSuchFieldException, AmbiguousFieldException {
   Field f;
   try {
     f = ReflectionUtilities.getField(fc, fn);
   } catch (final Exception e) {
     f = InterpreterUtilities.getOuterField(fc, fn);
   }
   setAccessFlag(f);
   return f;
 }
 /**
  * Whether the given name represents a field in this context
  *
  * @param name the field name
  */
 protected boolean fieldExists(final String name) {
   boolean result = false;
   try {
     ReflectionUtilities.getField(this.declaringClass, name);
     result = true;
   } catch (final NoSuchFieldException e) {
     try {
       InterpreterUtilities.getOuterField(this.declaringClass, name);
       result = true;
     } catch (final NoSuchFieldException ex) {
     } catch (final AmbiguousFieldException ex) {
       result = true;
     }
   } catch (final AmbiguousFieldException e) {
     result = true;
   }
   return result;
 }
 /**
  * Creates the tree that is associated with the given name
  *
  * @param node the current node
  * @param name the variable name
  * @exception IllegalStateException if the variable is not defined
  */
 @Override
 public Expression createName(final Node node, final IdentifierToken name) {
   if (isDefinedVariable(name.image())) {
     return super.createName(node, name);
   } else {
     final String fname = name.image();
     try {
       ReflectionUtilities.getField(this.declaringClass, fname);
       return new StaticFieldAccess((ReferenceType) this.defaultQualifier, fname);
     } catch (final Exception e) {
       try {
         final Field f = InterpreterUtilities.getOuterField(this.declaringClass, fname);
         final Class c = f.getDeclaringClass();
         return new StaticFieldAccess(new ReferenceType(c.getName()), fname);
       } catch (final Exception ex) {
         throw new CatchedExceptionError(ex, node);
       }
     }
   }
 }
 /**
  * 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;
     }
   }
 }