Program: 75145
Project: 75145
Buggy source:
/** 
 * Resolve a name within the scope of the given type. The name can be a variable name, a field name, "this" or "super", a method name, or a class relative to that type. If the name is a method name, arguments of the method must be given.
 * @param name The name to be resolved.
 * @param lastType The type from which the name is resolved.
 * @param args Not <tt>null</tt> if a method is to be resolved, inwhich case it is the arguments for the method.
 * @throws ASTClassNotFoundException A class cannot be loaded whenresolving the type of a name.
 * @throws ASTResolutionException The name cannot be resolved fromthe given type.
 */
private void resolveName(ASTName name,Type lastType,ASTArguments args) throws ASTClassNotFoundException, ASTResolutionException {
  Type[] arguments=ASTArguments2Types(args);
  Class owner;
  try {
    owner=lastType == null ? _currentClass : lastType.toClass(_loader);
  }
 catch (  ClassNotFoundException e) {
    throw new ASTClassNotFoundException(lastType.getName());
  }
  int length=name.jjtGetNumChildren();
  String remainingName="String_Node_Str";
  for (int i=0; i < length; i++) {
    ASTIdentifier id=(ASTIdentifier)name.jjtGetChild(i);
    String currentName=remainingName + id.getImage();
    if (currentName.equals("String_Node_Str")) {
      Type.setType(id,Type.createType(owner.getName()));
      continue;
    }
 else     if (currentName.equals("String_Node_Str")) {
      Type.setType(id,Type.createType(owner.getSuperclass().getName()));
      continue;
    }
    if (i == 0 && lastType == null) {
      Type vtype=findVariable(currentName);
      if (vtype != null) {
        Type.setType(id,vtype);
        if (vtype.isPrimitive())         owner=null;
 else         try {
          owner=vtype.toClass(_loader);
        }
 catch (        ClassNotFoundException e) {
          throw new ASTClassNotFoundException(vtype.getName());
        }
        continue;
      }
    }
    Type idType;
    if (i < length - 1)     idType=resolveNameFromClass(owner,currentName,null);
 else     idType=resolveNameFromClass(owner,currentName,arguments);
    Type.setType(id,idType);
    if (idType != null) {
      remainingName="String_Node_Str";
      if (idType.isPrimitive())       owner=null;
 else       try {
        owner=idType.toClass(_loader);
      }
 catch (      ClassNotFoundException e) {
        throw new ASTClassNotFoundException(idType.getName());
      }
    }
 else     if (i < length - 1)     remainingName=currentName + "String_Node_Str";
 else     throw new ASTResolutionException(owner.getName(),currentName);
  }
  Type.propagateType(name,name.jjtGetChild(length - 1));
}

Fixed version (ground truth):
/** 
 * Resolve a name within the scope of the given type. The name can be a variable name, a field name, "this" or "super", a method name, or a class relative to that type. If the name is a method name, arguments of the method must be given.
 * @param name The name to be resolved.
 * @param lastType The type from which the name is resolved.
 * @param args Not <tt>null</tt> if a method is to be resolved, inwhich case it is the arguments for the method.
 * @throws ASTClassNotFoundException A class cannot be loaded whenresolving the type of a name.
 * @throws ASTResolutionException The name cannot be resolved fromthe given type.
 */
private void resolveName(ASTName name,Type lastType,ASTArguments args) throws ASTClassNotFoundException, ASTResolutionException {
  Type[] arguments=ASTArguments2Types(args);
  Class owner;
  try {
    owner=lastType == null ? _currentClass : lastType.toClass(_loader);
  }
 catch (  ClassNotFoundException e) {
    throw new ASTClassNotFoundException(lastType.getName());
  }
  int length=name.jjtGetNumChildren();
  String remainingName="String_Node_Str";
  for (int i=0; i < length; i++) {
    ASTIdentifier id=(ASTIdentifier)name.jjtGetChild(i);
    String currentName=remainingName + id.getImage();
    if (currentName.equals("String_Node_Str")) {
      int x=0;
    }
    if (currentName.equals("String_Node_Str")) {
      Type.setType(id,Type.createType(owner.getName()));
      continue;
    }
 else     if (currentName.equals("String_Node_Str")) {
      Type.setType(id,Type.createType(owner.getSuperclass().getName()));
      continue;
    }
    if (i == 0 && lastType == null) {
      Type vtype=findVariable(currentName);
      if (vtype != null) {
        Type.setType(id,vtype);
        if (vtype.isPrimitive())         owner=null;
 else         try {
          owner=vtype.toClass(_loader);
        }
 catch (        ClassNotFoundException e) {
          throw new ASTClassNotFoundException(vtype.getName());
        }
        continue;
      }
    }
    Type idType;
    Type[] argumentsForResolution=i < length - 1 ? null : arguments;
    idType=resolveNameFromClass(owner,currentName,argumentsForResolution);
    if (idType == null && lastType == null && i == 0) {
      int previousClassNum=_previousClasses.size() - 1;
      while (idType == null && previousClassNum >= 0) {
        Class previousClass=(Class)_previousClasses.get(previousClassNum);
        if (previousClass != null)         idType=resolveNameFromClass(previousClass,currentName,argumentsForResolution);
        previousClassNum--;
      }
    }
    Type.setType(id,idType);
    if (idType != null) {
      remainingName="String_Node_Str";
      if (idType.isPrimitive())       owner=null;
 else       try {
        owner=idType.toClass(_loader);
      }
 catch (      ClassNotFoundException e) {
        throw new ASTClassNotFoundException(idType.getName());
      }
    }
 else     if (i < length - 1)     remainingName=currentName + "String_Node_Str";
 else     throw new ASTResolutionException(owner.getName(),currentName);
  }
  Type.propagateType(name,name.jjtGetChild(length - 1));
}