Program: 185540
Project: 185540
Buggy source:
/** 
 * Looks for the named member in the declaring type. Also searches super types. The result can be a field, method, or property.
 * @param name the name of the field, method, constant or property to find
 * @param declaringType the type in which the named member's declaration resides
 * @param isLhsExpression {@code true} if named member is being assigned a value
 * @param isStaticExpression {@code true} if member is being accessed statically
 * @param methodCallArgumentTypes types of arguments to the associated method call (or {@code null} if not a method call)
 */
protected ASTNode findDeclaration(String name,ClassNode declaringType,boolean isLhsExpression,boolean isStaticExpression,List<ClassNode> methodCallArgumentTypes){
  if (declaringType.isArray()) {
    if (name.equals("String_Node_Str")) {
      return createLengthField(declaringType);
    }
    return findDeclaration(name,VariableScope.OBJECT_CLASS_NODE,isLhsExpression,isStaticExpression,methodCallArgumentTypes);
  }
  if (methodCallArgumentTypes != null) {
    ASTNode method=findMethodDeclaration(name,declaringType,methodCallArgumentTypes);
    if (method != null) {
      return method;
    }
  }
  MethodNode accessor=AccessorSupport.findAccessorMethodForPropertyName(name,declaringType,false,!isLhsExpression ? READER : WRITER);
  if (accessor != null && !isSynthetic(accessor) && (accessor.isStatic() == isStaticExpression)) {
    return accessor;
  }
  LinkedHashSet<ClassNode> typeHierarchy=new LinkedHashSet<ClassNode>();
  VariableScope.createTypeHierarchy(declaringType,typeHierarchy,true);
  for (  ClassNode type : typeHierarchy) {
    PropertyNode property=type.getProperty(name);
    if (property != null) {
      return property;
    }
  }
  FieldNode field=declaringType.getField(name);
  if (field != null) {
    return field;
  }
  typeHierarchy.clear();
  VariableScope.findAllInterfaces(declaringType,typeHierarchy,true);
  for (  ClassNode type : typeHierarchy) {
    if (type == declaringType) {
      continue;
    }
    field=type.getField(name);
    if (field != null && field.isFinal() && field.isStatic()) {
      return field;
    }
  }
  if (accessor != null) {
    return accessor;
  }
  if (methodCallArgumentTypes == null) {
    return findMethodDeclaration(name,declaringType,null);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Looks for the named member in the declaring type. Also searches super types. The result can be a field, method, or property.
 * @param name the name of the field, method, constant or property to find
 * @param declaringType the type in which the named member's declaration resides
 * @param isLhsExpression {@code true} if named member is being assigned a value
 * @param isStaticExpression {@code true} if member is being accessed statically
 * @param methodCallArgumentTypes types of arguments to the associated method call (or {@code null} if not a method call)
 */
protected ASTNode findDeclaration(String name,ClassNode declaringType,boolean isLhsExpression,boolean isStaticExpression,List<ClassNode> methodCallArgumentTypes){
  if (declaringType.isArray()) {
    if (name.equals("String_Node_Str")) {
      return createLengthField(declaringType);
    }
    return findDeclaration(name,VariableScope.OBJECT_CLASS_NODE,isLhsExpression,isStaticExpression,methodCallArgumentTypes);
  }
  if (methodCallArgumentTypes != null) {
    ASTNode method=findMethodDeclaration(name,declaringType,methodCallArgumentTypes);
    if (method != null) {
      return method;
    }
  }
  MethodNode accessor=AccessorSupport.findAccessorMethodForPropertyName(name,declaringType,false,!isLhsExpression ? READER : WRITER);
  if (accessor != null && !isSynthetic(accessor) && (accessor.isStatic() == isStaticExpression)) {
    return accessor;
  }
  LinkedHashSet<ClassNode> typeHierarchy=new LinkedHashSet<ClassNode>();
  VariableScope.createTypeHierarchy(declaringType,typeHierarchy,true);
  for (  ClassNode type : typeHierarchy) {
    PropertyNode property=type.getProperty(name);
    if (isCompatible(property,isStaticExpression)) {
      return property;
    }
  }
  FieldNode field=declaringType.getField(name);
  if (isCompatible(field,isStaticExpression)) {
    return field;
  }
  typeHierarchy.clear();
  VariableScope.findAllInterfaces(declaringType,typeHierarchy,true);
  for (  ClassNode type : typeHierarchy) {
    if (type == declaringType) {
      continue;
    }
    field=type.getField(name);
    if (field != null && field.isFinal() && field.isStatic()) {
      return field;
    }
  }
  if (isCompatible(accessor,isStaticExpression)) {
    return accessor;
  }
  if (methodCallArgumentTypes == null) {
    return findMethodDeclaration(name,declaringType,null);
  }
  return null;
}