Program: 185544
Project: 185544
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 directFieldAccess {@code false} if accessor methods may take precedence
 * @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,boolean directFieldAccess,List<ClassNode> methodCallArgumentTypes){
  if (declaringType.isArray()) {
    if (name.equals("String_Node_Str")) {
      return createLengthField(declaringType);
    }
    return findDeclaration(name,VariableScope.OBJECT_CLASS_NODE,isLhsExpression,isStaticExpression,directFieldAccess,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) && !(directFieldAccess && declaringType.equals(accessor.getDeclaringClass()))) {
    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;
}

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 directFieldAccess {@code false} if accessor methods may take precedence
 * @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,boolean directFieldAccess,List<ClassNode> methodCallArgumentTypes){
  if (declaringType.isArray()) {
    if (name.equals("String_Node_Str")) {
      return createLengthField(declaringType);
    }
    return findDeclaration(name,VariableScope.OBJECT_CLASS_NODE,isLhsExpression,isStaticExpression,directFieldAccess,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) && !(directFieldAccess && declaringType.equals(accessor.getDeclaringClass()))) {
    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 (declaringType instanceof InnerClassNode && (declaringType.getModifiers() & ClassNode.ACC_STATIC) == 0) {
    ASTNode declaration=findDeclaration(name,((InnerClassNode)declaringType).getOuterClass(),isLhsExpression,isStaticExpression,directFieldAccess,methodCallArgumentTypes);
    if (declaration != null) {
      return declaration;
    }
  }
  if (methodCallArgumentTypes == null) {
    return findMethodDeclaration(name,declaringType,null);
  }
  return null;
}