Program: 177946
Project: 177946
Buggy source:
/** 
 * Manufactures and returns the parameter value for method required to invoke it
 * @param parameterType type of parameter
 * @param genericType generic type of parameter
 * @param annotations parameter annotations
 * @param typeArgsMap map for resolving generic types
 * @param genericTypeArgsExtra extra generic types for chaining
 * @param pojos Set of manufactured pojos' types
 * @param genericTypeArgs The generic type arguments for the current generic class instance
 * @return The parameter values required to invoke the constructor
 * @throws IllegalArgumentException If an illegal argument was passed to the constructor
 * @throws InstantiationException If an exception occurred during instantiation
 * @throws IllegalAccessException If security was violated while creating the object
 * @throws InvocationTargetException If an exception occurred while invoking the constructor or factory method
 * @throws ClassNotFoundException If it was not possible to create a class from a string
 */
private Object manufactureParameterValue(Class<?> parameterType,Type genericType,List<Annotation> annotations,final Map<String,Type> typeArgsMap,final Type[] genericTypeArgsExtra,Map<Class<?>,Integer> pojos,Type... genericTypeArgs) throws InstantiationException, IllegalAccessException, InvocationTargetException, ClassNotFoundException {
  Object parameterValue=null;
  if (Collection.class.isAssignableFrom(parameterType)) {
    Collection<? super Object> defaultValue=null;
    Collection<? super Object> collection=resolveCollectionType(parameterType,defaultValue);
    if (collection != null) {
      Class<?> collectionElementType;
      AtomicReference<Type[]> collectionGenericTypeArgs=new AtomicReference<Type[]>(NO_TYPES);
      if (genericType instanceof ParameterizedType) {
        ParameterizedType pType=(ParameterizedType)genericType;
        Type actualTypeArgument=pType.getActualTypeArguments()[0];
        collectionElementType=resolveGenericParameter(actualTypeArgument,typeArgsMap,collectionGenericTypeArgs);
      }
 else {
        LOG.warn("String_Node_Str" + "String_Node_Str",genericType);
        collectionElementType=Object.class;
      }
      Type[] genericTypeArgsAll=mergeTypeArrays(collectionGenericTypeArgs.get(),genericTypeArgsExtra);
      fillCollection(pojos,annotations,collection,collectionElementType,genericTypeArgsAll);
      parameterValue=collection;
    }
  }
 else   if (Map.class.isAssignableFrom(parameterType)) {
    Map<? super Object,? super Object> defaultValue=null;
    Map<? super Object,? super Object> map=resolveMapType(parameterType,defaultValue);
    if (map != null) {
      Class<?> keyClass;
      Class<?> elementClass;
      AtomicReference<Type[]> keyGenericTypeArgs=new AtomicReference<Type[]>(NO_TYPES);
      AtomicReference<Type[]> elementGenericTypeArgs=new AtomicReference<Type[]>(NO_TYPES);
      if (genericType instanceof ParameterizedType) {
        ParameterizedType pType=(ParameterizedType)genericType;
        Type[] actualTypeArguments=pType.getActualTypeArguments();
        keyClass=resolveGenericParameter(actualTypeArguments[0],typeArgsMap,keyGenericTypeArgs);
        elementClass=resolveGenericParameter(actualTypeArguments[1],typeArgsMap,elementGenericTypeArgs);
      }
 else {
        LOG.warn("String_Node_Str" + "String_Node_Str",genericType);
        keyClass=Object.class;
        elementClass=Object.class;
      }
      Type[] genericTypeArgsAll=mergeTypeArrays(elementGenericTypeArgs.get(),genericTypeArgsExtra);
      MapArguments mapArguments=new MapArguments();
      mapArguments.setPojos(pojos);
      mapArguments.setAnnotations(annotations);
      mapArguments.setMapToBeFilled(map);
      mapArguments.setKeyClass(keyClass);
      mapArguments.setElementClass(elementClass);
      mapArguments.setKeyGenericTypeArgs(keyGenericTypeArgs.get());
      mapArguments.setElementGenericTypeArgs(genericTypeArgsAll);
      fillMap(mapArguments);
      parameterValue=map;
    }
  }
  if (parameterValue == null) {
    Map<String,Type> typeArgsMapForParam;
    if (genericType instanceof ParameterizedType) {
      typeArgsMapForParam=new HashMap<String,Type>(typeArgsMap);
      ParameterizedType parametrizedType=(ParameterizedType)genericType;
      TypeVariable<?>[] argumentTypes=parameterType.getTypeParameters();
      Type[] argumentGenericTypes=parametrizedType.getActualTypeArguments();
      for (int k=0; k < argumentTypes.length; k++) {
        if (argumentGenericTypes[k] instanceof Class) {
          Class<?> genericParam=(Class<?>)argumentGenericTypes[k];
          typeArgsMapForParam.put(argumentTypes[k].getName(),genericParam);
        }
      }
    }
 else {
      typeArgsMapForParam=typeArgsMap;
    }
    parameterValue=manufactureParameterValue(pojos,parameterType,genericType,annotations,typeArgsMapForParam,genericTypeArgs);
  }
  return parameterValue;
}

Fixed version (ground truth):
/** 
 * Manufactures and returns the parameter value for method required to invoke it
 * @param parameterType type of parameter
 * @param genericType generic type of parameter
 * @param annotations parameter annotations
 * @param typeArgsMap map for resolving generic types
 * @param genericTypeArgsExtra extra generic types for chaining
 * @param pojos Set of manufactured pojos' types
 * @param genericTypeArgs The generic type arguments for the current generic class instance
 * @return The parameter values required to invoke the constructor
 * @throws IllegalArgumentException If an illegal argument was passed to the constructor
 * @throws InstantiationException If an exception occurred during instantiation
 * @throws IllegalAccessException If security was violated while creating the object
 * @throws InvocationTargetException If an exception occurred while invoking the constructor or factory method
 * @throws ClassNotFoundException If it was not possible to create a class from a string
 */
private Object manufactureParameterValue(Class<?> parameterType,Type genericType,List<Annotation> annotations,final Map<String,Type> typeArgsMap,Map<Class<?>,Integer> pojos,Type... genericTypeArgs) throws InstantiationException, IllegalAccessException, InvocationTargetException, ClassNotFoundException {
  Object parameterValue=null;
  if (Collection.class.isAssignableFrom(parameterType)) {
    Collection<? super Object> defaultValue=null;
    Collection<? super Object> collection=resolveCollectionType(parameterType,defaultValue);
    if (collection != null) {
      Class<?> collectionElementType;
      AtomicReference<Type[]> collectionGenericTypeArgs=new AtomicReference<Type[]>(NO_TYPES);
      if (genericType instanceof ParameterizedType) {
        ParameterizedType pType=(ParameterizedType)genericType;
        Type actualTypeArgument=pType.getActualTypeArguments()[0];
        collectionElementType=resolveGenericParameter(actualTypeArgument,typeArgsMap,collectionGenericTypeArgs);
      }
 else {
        LOG.warn("String_Node_Str" + "String_Node_Str",genericType);
        collectionElementType=Object.class;
      }
      Type[] genericTypeArgsAll=mergeTypeArrays(collectionGenericTypeArgs.get(),genericTypeArgs);
      fillCollection(pojos,annotations,collection,collectionElementType,genericTypeArgsAll);
      parameterValue=collection;
    }
  }
 else   if (Map.class.isAssignableFrom(parameterType)) {
    Map<? super Object,? super Object> defaultValue=null;
    Map<? super Object,? super Object> map=resolveMapType(parameterType,defaultValue);
    if (map != null) {
      Class<?> keyClass;
      Class<?> elementClass;
      AtomicReference<Type[]> keyGenericTypeArgs=new AtomicReference<Type[]>(NO_TYPES);
      AtomicReference<Type[]> elementGenericTypeArgs=new AtomicReference<Type[]>(NO_TYPES);
      if (genericType instanceof ParameterizedType) {
        ParameterizedType pType=(ParameterizedType)genericType;
        Type[] actualTypeArguments=pType.getActualTypeArguments();
        keyClass=resolveGenericParameter(actualTypeArguments[0],typeArgsMap,keyGenericTypeArgs);
        elementClass=resolveGenericParameter(actualTypeArguments[1],typeArgsMap,elementGenericTypeArgs);
      }
 else {
        LOG.warn("String_Node_Str" + "String_Node_Str",genericType);
        keyClass=Object.class;
        elementClass=Object.class;
      }
      Type[] genericTypeArgsAll=mergeTypeArrays(elementGenericTypeArgs.get(),genericTypeArgs);
      MapArguments mapArguments=new MapArguments();
      mapArguments.setPojos(pojos);
      mapArguments.setAnnotations(annotations);
      mapArguments.setMapToBeFilled(map);
      mapArguments.setKeyClass(keyClass);
      mapArguments.setElementClass(elementClass);
      mapArguments.setKeyGenericTypeArgs(keyGenericTypeArgs.get());
      mapArguments.setElementGenericTypeArgs(genericTypeArgsAll);
      fillMap(mapArguments);
      parameterValue=map;
    }
  }
  if (parameterValue == null) {
    Map<String,Type> typeArgsMapForParam;
    if (genericType instanceof ParameterizedType) {
      typeArgsMapForParam=new HashMap<String,Type>(typeArgsMap);
      ParameterizedType parametrizedType=(ParameterizedType)genericType;
      TypeVariable<?>[] argumentTypes=parameterType.getTypeParameters();
      Type[] argumentGenericTypes=parametrizedType.getActualTypeArguments();
      for (int k=0; k < argumentTypes.length; k++) {
        if (argumentGenericTypes[k] instanceof Class) {
          Class<?> genericParam=(Class<?>)argumentGenericTypes[k];
          typeArgsMapForParam.put(argumentTypes[k].getName(),genericParam);
        }
      }
    }
 else {
      typeArgsMapForParam=typeArgsMap;
    }
    parameterValue=manufactureParameterValue(pojos,parameterType,genericType,annotations,typeArgsMapForParam,genericTypeArgs);
  }
  return parameterValue;
}