Program: 65092
Project: 65092
Buggy source:
public ArrayList<Property> getPropertyPropertiesForClass(JavaClass cls,TypeInfo info,boolean onlyPublic,boolean onlyExplicit){
  ArrayList<Property> properties=new ArrayList<Property>();
  if (cls == null) {
    return properties;
  }
  ArrayList<JavaMethod> propertyMethods=new ArrayList<JavaMethod>();
  for (  JavaMethod next : new ArrayList<JavaMethod>(cls.getDeclaredMethods())) {
    if (!next.isSynthetic()) {
      if (((next.getName().startsWith(GET_STR) && next.getName().length() > 3) || (next.getName().startsWith(IS_STR) && next.getName().length() > 2)) && next.getParameterTypes().length == 0 && next.getReturnType() != helper.getJavaClass(java.lang.Void.class)) {
        int modifiers=next.getModifiers();
        if (!Modifier.isStatic(modifiers) && !Modifier.isTransient(modifiers) && ((onlyPublic && Modifier.isPublic(next.getModifiers())) || !onlyPublic)) {
          propertyMethods.add(next);
        }
      }
 else       if (next.getName().startsWith(SET_STR) && next.getName().length() > 3 && next.getParameterTypes().length == 1) {
        int modifiers=next.getModifiers();
        if (!Modifier.isStatic(modifiers) && !Modifier.isTransient(modifiers) && ((onlyPublic && Modifier.isPublic(next.getModifiers())) || !onlyPublic)) {
          propertyMethods.add(next);
        }
      }
    }
  }
  ArrayList<String> propertyNames=new ArrayList<String>();
  for (int i=0; i < propertyMethods.size(); i++) {
    boolean isPropertyTransient=false;
    JavaMethod nextMethod=propertyMethods.get(i);
    String propertyName=EMPTY_STRING;
    JavaMethod getMethod;
    JavaMethod setMethod;
    JavaMethod propertyMethod=null;
    if (!nextMethod.getName().startsWith(SET_STR)) {
      if (nextMethod.getName().startsWith(GET_STR)) {
        propertyName=nextMethod.getName().substring(3);
      }
 else       if (nextMethod.getName().startsWith(IS_STR)) {
        propertyName=nextMethod.getName().substring(2);
      }
      getMethod=nextMethod;
      String setMethodName=SET_STR + propertyName;
      propertyName=Introspector.decapitalize(propertyName);
      JavaClass[] paramTypes={(JavaClass)getMethod.getReturnType()};
      setMethod=cls.getDeclaredMethod(setMethodName,paramTypes);
      if (setMethod == null && !(hasJAXBAnnotations(getMethod))) {
        isPropertyTransient=true;
      }
      if (setMethod != null && hasJAXBAnnotations(setMethod)) {
        boolean isTransient=helper.isAnnotationPresent(setMethod,XmlTransient.class);
        boolean isLocation=helper.isAnnotationPresent(setMethod,XmlLocation.class) || helper.isAnnotationPresent(setMethod,CompilerHelper.XML_LOCATION_ANNOTATION_CLASS) || helper.isAnnotationPresent(setMethod,CompilerHelper.INTERNAL_XML_LOCATION_ANNOTATION_CLASS);
        if (!isTransient) {
          propertyMethod=setMethod;
        }
 else {
          isPropertyTransient=true;
          if (isLocation) {
            propertyMethod=setMethod;
            info.setLocationAware(true);
          }
        }
      }
 else       if ((onlyExplicit && hasJAXBAnnotations(getMethod)) || !onlyExplicit) {
        boolean isTransient=helper.isAnnotationPresent(getMethod,XmlTransient.class);
        boolean isLocation=helper.isAnnotationPresent(getMethod,XmlLocation.class);
        if (!isTransient) {
          propertyMethod=getMethod;
        }
 else {
          isPropertyTransient=true;
          if (isLocation) {
            propertyMethod=getMethod;
            info.setLocationAware(true);
          }
        }
      }
 else       if (onlyExplicit) {
        continue;
      }
    }
 else {
      propertyName=nextMethod.getName().substring(3);
      setMethod=nextMethod;
      String getMethodName=GET_STR + propertyName;
      getMethod=cls.getDeclaredMethod(getMethodName,new JavaClass[]{});
      if (getMethod == null) {
        getMethodName=IS_STR + propertyName;
        getMethod=cls.getDeclaredMethod(getMethodName,new JavaClass[]{});
      }
      if (getMethod == null && !(hasJAXBAnnotations(setMethod))) {
        isPropertyTransient=true;
      }
      if (getMethod != null && hasJAXBAnnotations(getMethod)) {
        boolean isTransient=helper.isAnnotationPresent(getMethod,XmlTransient.class);
        boolean isLocation=helper.isAnnotationPresent(getMethod,XmlLocation.class);
        if (!isTransient) {
          propertyMethod=getMethod;
        }
 else {
          isPropertyTransient=true;
          if (isLocation) {
            propertyMethod=getMethod;
            info.setLocationAware(true);
          }
        }
      }
 else       if ((onlyExplicit && hasJAXBAnnotations(setMethod)) || !onlyExplicit) {
        boolean isTransient=helper.isAnnotationPresent(setMethod,XmlTransient.class);
        boolean isLocation=helper.isAnnotationPresent(setMethod,XmlLocation.class);
        if (!isTransient) {
          propertyMethod=setMethod;
        }
 else {
          isPropertyTransient=true;
          if (isLocation) {
            propertyMethod=setMethod;
            info.setLocationAware(true);
          }
        }
      }
 else       if (onlyExplicit) {
        continue;
      }
      propertyName=Introspector.decapitalize(propertyName);
    }
    JavaClass ptype=null;
    if (getMethod != null) {
      ptype=(JavaClass)getMethod.getReturnType();
    }
 else {
      ptype=setMethod.getParameterTypes()[0];
    }
    if (!propertyNames.contains(propertyName)) {
      propertyNames.add(propertyName);
      Property property=buildNewProperty(info,cls,propertyMethod,propertyName,ptype);
      property.setTransient(isPropertyTransient);
      if (getMethod != null) {
        property.setOriginalGetMethodName(getMethod.getName());
        if (property.getGetMethodName() == null) {
          property.setGetMethodName(getMethod.getName());
        }
      }
      if (setMethod != null) {
        property.setOriginalSetMethodName(setMethod.getName());
        if (property.getSetMethodName() == null) {
          property.setSetMethodName(setMethod.getName());
        }
      }
      property.setMethodProperty(true);
      boolean isTransient=helper.isAnnotationPresent(property.getElement(),XmlTransient.class);
      boolean isLocation=helper.isAnnotationPresent(property.getElement(),XmlLocation.class);
      if (!isTransient || (isTransient && isLocation)) {
        properties.add(property);
      }
    }
  }
  properties=removeSuperclassProperties(cls,properties);
  Collections.sort(properties,new PropertyComparitor());
  return properties;
}

Fixed version (ground truth):
public ArrayList<Property> getPropertyPropertiesForClass(JavaClass cls,TypeInfo info,boolean onlyPublic,boolean onlyExplicit){
  ArrayList<Property> properties=new ArrayList<Property>();
  if (cls == null) {
    return properties;
  }
  ArrayList<JavaMethod> propertyMethods=new ArrayList<JavaMethod>();
  for (  JavaMethod next : new ArrayList<JavaMethod>(cls.getDeclaredMethods())) {
    if (!next.isSynthetic()) {
      if (((next.getName().startsWith(GET_STR) && next.getName().length() > 3) || (next.getName().startsWith(IS_STR) && next.getName().length() > 2)) && next.getParameterTypes().length == 0 && next.getReturnType() != helper.getJavaClass(java.lang.Void.class)) {
        int modifiers=next.getModifiers();
        if (!Modifier.isStatic(modifiers) && !Modifier.isTransient(modifiers) && ((onlyPublic && Modifier.isPublic(next.getModifiers())) || !onlyPublic)) {
          propertyMethods.add(next);
        }
      }
 else       if (next.getName().startsWith(SET_STR) && next.getName().length() > 3 && next.getParameterTypes().length == 1) {
        int modifiers=next.getModifiers();
        if (!Modifier.isStatic(modifiers) && !Modifier.isTransient(modifiers) && ((onlyPublic && Modifier.isPublic(next.getModifiers())) || !onlyPublic)) {
          propertyMethods.add(next);
        }
      }
    }
  }
  ArrayList<String> propertyNames=new ArrayList<String>();
  for (int i=0; i < propertyMethods.size(); i++) {
    boolean isPropertyTransient=false;
    JavaMethod nextMethod=propertyMethods.get(i);
    String propertyName=EMPTY_STRING;
    JavaMethod getMethod;
    JavaMethod setMethod;
    JavaMethod propertyMethod=null;
    if (!nextMethod.getName().startsWith(SET_STR)) {
      if (nextMethod.getName().startsWith(GET_STR)) {
        propertyName=nextMethod.getName().substring(3);
      }
 else       if (nextMethod.getName().startsWith(IS_STR)) {
        propertyName=nextMethod.getName().substring(2);
      }
      getMethod=nextMethod;
      String setMethodName=SET_STR + propertyName;
      propertyName=Introspector.decapitalize(propertyName);
      JavaClass[] paramTypes={(JavaClass)getMethod.getReturnType()};
      setMethod=cls.getDeclaredMethod(setMethodName,paramTypes);
      if (setMethod == null && !(hasJAXBAnnotations(getMethod))) {
        isPropertyTransient=true;
      }
      if (setMethod != null && hasJAXBAnnotations(setMethod)) {
        boolean isTransient=helper.isAnnotationPresent(setMethod,XmlTransient.class);
        boolean isLocation=helper.isAnnotationPresent(setMethod,XmlLocation.class) || helper.isAnnotationPresent(setMethod,CompilerHelper.XML_LOCATION_ANNOTATION_CLASS) || helper.isAnnotationPresent(setMethod,CompilerHelper.INTERNAL_XML_LOCATION_ANNOTATION_CLASS);
        if (!isTransient) {
          propertyMethod=setMethod;
        }
 else {
          isPropertyTransient=true;
          if (isLocation) {
            propertyMethod=setMethod;
            info.setLocationAware(true);
          }
        }
      }
 else       if ((onlyExplicit && hasJAXBAnnotations(getMethod)) || !onlyExplicit) {
        boolean isTransient=helper.isAnnotationPresent(getMethod,XmlTransient.class);
        boolean isLocation=helper.isAnnotationPresent(getMethod,XmlLocation.class) || helper.isAnnotationPresent(setMethod,CompilerHelper.XML_LOCATION_ANNOTATION_CLASS) || helper.isAnnotationPresent(setMethod,CompilerHelper.INTERNAL_XML_LOCATION_ANNOTATION_CLASS);
        if (!isTransient) {
          propertyMethod=getMethod;
        }
 else {
          isPropertyTransient=true;
          if (isLocation) {
            propertyMethod=getMethod;
            info.setLocationAware(true);
          }
        }
      }
 else       if (onlyExplicit) {
        continue;
      }
    }
 else {
      propertyName=nextMethod.getName().substring(3);
      setMethod=nextMethod;
      String getMethodName=GET_STR + propertyName;
      getMethod=cls.getDeclaredMethod(getMethodName,new JavaClass[]{});
      if (getMethod == null) {
        getMethodName=IS_STR + propertyName;
        getMethod=cls.getDeclaredMethod(getMethodName,new JavaClass[]{});
      }
      if (getMethod == null && !(hasJAXBAnnotations(setMethod))) {
        isPropertyTransient=true;
      }
      if (getMethod != null && hasJAXBAnnotations(getMethod)) {
        boolean isTransient=helper.isAnnotationPresent(getMethod,XmlTransient.class);
        boolean isLocation=helper.isAnnotationPresent(getMethod,XmlLocation.class) || helper.isAnnotationPresent(setMethod,CompilerHelper.XML_LOCATION_ANNOTATION_CLASS) || helper.isAnnotationPresent(setMethod,CompilerHelper.INTERNAL_XML_LOCATION_ANNOTATION_CLASS);
        if (!isTransient) {
          propertyMethod=getMethod;
        }
 else {
          isPropertyTransient=true;
          if (isLocation) {
            propertyMethod=getMethod;
            info.setLocationAware(true);
          }
        }
      }
 else       if ((onlyExplicit && hasJAXBAnnotations(setMethod)) || !onlyExplicit) {
        boolean isTransient=helper.isAnnotationPresent(setMethod,XmlTransient.class);
        boolean isLocation=helper.isAnnotationPresent(setMethod,XmlLocation.class) || helper.isAnnotationPresent(setMethod,CompilerHelper.XML_LOCATION_ANNOTATION_CLASS) || helper.isAnnotationPresent(setMethod,CompilerHelper.INTERNAL_XML_LOCATION_ANNOTATION_CLASS);
        if (!isTransient) {
          propertyMethod=setMethod;
        }
 else {
          isPropertyTransient=true;
          if (isLocation) {
            propertyMethod=setMethod;
            info.setLocationAware(true);
          }
        }
      }
 else       if (onlyExplicit) {
        continue;
      }
      propertyName=Introspector.decapitalize(propertyName);
    }
    JavaClass ptype=null;
    if (getMethod != null) {
      ptype=(JavaClass)getMethod.getReturnType();
    }
 else {
      ptype=setMethod.getParameterTypes()[0];
    }
    if (!propertyNames.contains(propertyName)) {
      propertyNames.add(propertyName);
      Property property=buildNewProperty(info,cls,propertyMethod,propertyName,ptype);
      property.setTransient(isPropertyTransient);
      if (getMethod != null) {
        property.setOriginalGetMethodName(getMethod.getName());
        if (property.getGetMethodName() == null) {
          property.setGetMethodName(getMethod.getName());
        }
      }
      if (setMethod != null) {
        property.setOriginalSetMethodName(setMethod.getName());
        if (property.getSetMethodName() == null) {
          property.setSetMethodName(setMethod.getName());
        }
      }
      property.setMethodProperty(true);
      boolean isTransient=helper.isAnnotationPresent(property.getElement(),XmlTransient.class);
      boolean isLocation=helper.isAnnotationPresent(property.getElement(),XmlLocation.class) || helper.isAnnotationPresent(setMethod,CompilerHelper.XML_LOCATION_ANNOTATION_CLASS) || helper.isAnnotationPresent(setMethod,CompilerHelper.INTERNAL_XML_LOCATION_ANNOTATION_CLASS);
      if (!isTransient || (isTransient && isLocation)) {
        properties.add(property);
      }
    }
  }
  properties=removeSuperclassProperties(cls,properties);
  Collections.sort(properties,new PropertyComparitor());
  return properties;
}