Program: 75086
Project: 75086
Buggy source:
/** 
 * Resolve a simple name within the scope of the given type. The name can be a variable name, a field name, or a class relative to that type. If the name corresponds to a field of a class, its owner is encoded in the return object.
 * @param name The simple name to be resolved.
 * @param lastType The type from which the name is resolved. It is used asthe scope for the name. If it is null, the name is resolved in the current scope.
 * @return The type and owner of the name. If the name cannot be found, <tt>null</tt> is returned.
 */
private TypeAndOwner _resolveName(String name,Type lastType){
  if (_state.getCurrentClass() == null)   return null;
  if (lastType == null) {
    TypeAndOwner varTypeAndOwner=_findVariable(name);
    if (varTypeAndOwner != null)     return varTypeAndOwner;
    Class c=_lookupClass(name);
    if (c != null)     return new TypeAndOwner(Type.createType(c.getName()),null);
  }
  TypeAndOwner typeAndOwner;
  if (lastType == null)   typeAndOwner=_resolveNameFromClass(_state.getCurrentClass(),name);
 else   try {
    typeAndOwner=_resolveNameFromClass(lastType.toClass(_state.getClassLoader()),name);
  }
 catch (  ClassNotFoundException e) {
    throw new ASTClassNotFoundException(lastType);
  }
  if (typeAndOwner == null && lastType == null) {
    Stack previousClasses=_state.getPreviousClasses();
    int previousNumber=previousClasses.size() - 1;
    while (typeAndOwner == null && previousNumber >= 0) {
      Class previousClass=(Class)previousClasses.get(previousNumber--);
      if (previousClass != null)       typeAndOwner=_resolveNameFromClass(previousClass,name);
    }
  }
  return typeAndOwner;
}

Fixed version (ground truth):
/** 
 * Resolve a simple name within the scope of the given type. The name can be a variable name, a field name, or a class relative to that type. If the name corresponds to a field of a class, its owner is encoded in the return object.
 * @param name The simple name to be resolved.
 * @param lastType The type from which the name is resolved. It is used asthe scope for the name. If it is null, the name is resolved in the current scope.
 * @return The type and owner of the name. If the name cannot be found, <tt>null</tt> is returned.
 */
private TypeAndOwner _resolveName(String name,Type lastType){
  if (_state.getCurrentClass() == null)   return null;
  if (lastType == null) {
    TypeAndOwner varTypeAndOwner=_findVariable(name);
    if (varTypeAndOwner != null)     return varTypeAndOwner;
    Class c=_lookupClass(name);
    if (c != null)     return new TypeAndOwner(Type.createType(c.getName()),null);
  }
  TypeAndOwner typeAndOwner;
  if (lastType == null)   typeAndOwner=_resolveNameFromClass(_state.getCurrentClass(),name);
 else   try {
    typeAndOwner=_resolveNameFromClass(lastType.toClass(_state.getClassLoader()),name);
  }
 catch (  ClassNotFoundException e) {
    throw new ASTClassNotFoundException(lastType);
  }
  if (typeAndOwner == null && lastType == null) {
    Stack previousClasses=_state.getPreviousClasses();
    int previousNumber=previousClasses.size() - 1;
    while (typeAndOwner == null && previousNumber >= 0) {
      Object previousObject=previousClasses.get(previousNumber--);
      if (previousObject instanceof Class) {
        Class previousClass=(Class)previousObject;
        if (previousClass != null)         typeAndOwner=_resolveNameFromClass(previousClass,name);
      }
    }
  }
  return typeAndOwner;
}