Program: 66807
Project: 66807
Buggy source:
/** 
 * Build a list ClassDetails instance that contains a ClassDetails for each class in our entities list.
 */
public void buildClassDetailsAndModifyProject(){
  if (entityClasses != null && entityClasses.size() > 0) {
    for (    MetadataClass metaClass : entityClasses) {
      ClassDescriptor descriptor=findDescriptor(session.getProject(),metaClass.getName());
      if (descriptor == null) {
        log(SessionLog.FINER,WEAVER_CLASS_NOT_IN_PROJECT,new Object[]{metaClass.getName()});
      }
 else {
        log(SessionLog.FINER,WEAVER_PROCESSING_CLASS,new Object[]{metaClass.getName()});
        boolean weaveValueHoldersForClass=weaveLazy && canWeaveValueHolders(metaClass,descriptor.getMappings());
        boolean weaveChangeTrackingForClass=canChangeTrackingBeEnabled(descriptor,metaClass,weaveChangeTracking);
        ClassDetails classDetails=createClassDetails(metaClass,weaveValueHoldersForClass,weaveChangeTrackingForClass,weaveFetchGroups,weaveInternal);
        if (descriptor.isAggregateDescriptor()) {
          classDetails.setIsEmbedable(true);
          classDetails.setShouldWeaveFetchGroups(false);
        }
        List unMappedAttributes=storeAttributeMappings(metaClass,classDetails,descriptor.getMappings(),weaveValueHoldersForClass);
        classDetailsMap.put(classDetails.getClassName(),classDetails);
        if (!unMappedAttributes.isEmpty()) {
          addClassDetailsForMappedSuperClasses(metaClass,descriptor,classDetails,classDetailsMap,unMappedAttributes,weaveChangeTracking);
        }
        if (classDetails.getLazyMappings() != null) {
          Iterator iterator=classDetails.getLazyMappings().iterator();
          while (iterator.hasNext()) {
            ForeignReferenceMapping mapping=(ForeignReferenceMapping)iterator.next();
            mapping.setGetMethodName(ClassWeaver.getWeavedValueHolderGetMethodName(mapping.getAttributeName()));
            mapping.setSetMethodName(ClassWeaver.getWeavedValueHolderSetMethodName(mapping.getAttributeName()));
          }
        }
      }
    }
    for (Iterator i=classDetailsMap.values().iterator(); i.hasNext(); ) {
      ClassDetails classDetails=(ClassDetails)i.next();
      ClassDetails superClassDetails=classDetailsMap.get(classDetails.getSuperClassName());
      if (superClassDetails == null) {
        ClassDescriptor descriptor=findDescriptor(session.getProject(),classDetails.getClassName());
        if (descriptor != null && descriptor.hasInheritance()) {
          superClassDetails=classDetailsMap.get(descriptor.getInheritancePolicy().getParentClassName());
        }
      }
      if (superClassDetails != null) {
        classDetails.setSuperClassDetails(superClassDetails);
      }
    }
    for (Iterator i=classDetailsMap.values().iterator(); i.hasNext(); ) {
      ClassDetails classDetails=(ClassDetails)i.next();
      classDetails.setShouldWeaveChangeTracking(classDetails.canWeaveChangeTracking());
    }
  }
}

Fixed version (ground truth):
/** 
 * Build a list ClassDetails instance that contains a ClassDetails for each class in our entities list.
 */
public void buildClassDetailsAndModifyProject(){
  if (entityClasses != null && entityClasses.size() > 0) {
    for (    MetadataClass metaClass : entityClasses) {
      ClassDescriptor descriptor=findDescriptor(session.getProject(),metaClass.getName());
      if (descriptor == null) {
        log(SessionLog.FINER,WEAVER_CLASS_NOT_IN_PROJECT,new Object[]{metaClass.getName()});
      }
 else {
        log(SessionLog.FINER,WEAVER_PROCESSING_CLASS,new Object[]{metaClass.getName()});
        boolean weaveValueHoldersForClass=weaveLazy && canWeaveValueHolders(metaClass,descriptor.getMappings());
        boolean weaveChangeTrackingForClass=canChangeTrackingBeEnabled(descriptor,metaClass,weaveChangeTracking);
        ClassDetails classDetails=createClassDetails(metaClass,weaveValueHoldersForClass,weaveChangeTrackingForClass,weaveFetchGroups,weaveInternal);
        if (descriptor.isAggregateDescriptor()) {
          classDetails.setIsEmbedable(true);
          classDetails.setShouldWeaveFetchGroups(false);
        }
        List unMappedAttributes=storeAttributeMappings(metaClass,classDetails,descriptor.getMappings(),weaveValueHoldersForClass);
        classDetailsMap.put(classDetails.getClassName(),classDetails);
        classDetails.setShouldWeaveConstructorOptimization((classDetails.getDescribedClass().getFields().size() - (descriptor.getMappings().size() - unMappedAttributes.size())) <= 0);
        if (!unMappedAttributes.isEmpty()) {
          addClassDetailsForMappedSuperClasses(metaClass,descriptor,classDetails,classDetailsMap,unMappedAttributes,weaveChangeTracking);
        }
        if (classDetails.getLazyMappings() != null) {
          Iterator iterator=classDetails.getLazyMappings().iterator();
          while (iterator.hasNext()) {
            ForeignReferenceMapping mapping=(ForeignReferenceMapping)iterator.next();
            mapping.setGetMethodName(ClassWeaver.getWeavedValueHolderGetMethodName(mapping.getAttributeName()));
            mapping.setSetMethodName(ClassWeaver.getWeavedValueHolderSetMethodName(mapping.getAttributeName()));
          }
        }
      }
    }
    for (Iterator i=classDetailsMap.values().iterator(); i.hasNext(); ) {
      ClassDetails classDetails=(ClassDetails)i.next();
      ClassDetails superClassDetails=classDetailsMap.get(classDetails.getSuperClassName());
      if (superClassDetails == null) {
        ClassDescriptor descriptor=findDescriptor(session.getProject(),classDetails.getClassName());
        if (descriptor != null && descriptor.hasInheritance()) {
          superClassDetails=classDetailsMap.get(descriptor.getInheritancePolicy().getParentClassName());
        }
      }
      if (superClassDetails != null) {
        classDetails.setSuperClassDetails(superClassDetails);
      }
    }
    for (Iterator i=classDetailsMap.values().iterator(); i.hasNext(); ) {
      ClassDetails classDetails=(ClassDetails)i.next();
      classDetails.setShouldWeaveChangeTracking(classDetails.canWeaveChangeTracking());
    }
  }
}