nus-yam/ex-repair huggingface dataset:
Program: 164945
Project: 164945
Buggy source:
public static boolean generateCodeToPassThisOrNullIfStaticMethod(@NotNull MethodWriter mw,int access){
  boolean isStatic=isStatic(access);
  if (isStatic) {
    mw.visitInsn(ACONST_NULL);
  }
 else {
    mw.visitVarInsn(ALOAD,0);
  }
  return isStatic;
}

Fixed version (ground truth):
public static boolean generateCodeToPassThisOrNullIfStaticMethod(@NotNull MethodWriter mw,int access,@SuppressWarnings("String_Node_Str") @NotNull String name){
  boolean isStatic=isStatic(access);
  if (isStatic) {
    mw.visitInsn(ACONST_NULL);
  }
 else {
    mw.visitVarInsn(ALOAD,0);
  }
  return isStatic;
}
Program: 164947
Project: 164947
Buggy source:
@NotNull private MethodVisitor generateCallToHandlerThroughMockingBridge(@Nullable String genericSignature,@NotNull String internalClassName,@NotNull ExecutionMode actualExecutionMode){
  generateCodeToObtainInstanceOfMockingBridge(MockedBridge.MB);
  boolean isStatic=generateCodeToPassThisOrNullIfStaticMethod(mw,methodAccess);
  mw.visitInsn(ACONST_NULL);
  Type[] argTypes=Type.getArgumentTypes(methodDesc);
  generateCodeToCreateArrayOfObject(mw,6 + argTypes.length);
  int i=0;
  generateCodeToFillArrayElement(i++,methodAccess);
  generateCodeToFillArrayElement(i++,internalClassName);
  generateCodeToFillArrayElement(i++,methodName);
  generateCodeToFillArrayElement(i++,methodDesc);
  generateCodeToFillArrayElement(i++,genericSignature);
  generateCodeToFillArrayElement(i++,actualExecutionMode.ordinal());
  generateCodeToFillArrayWithParameterValues(mw,argTypes,i,isStatic ? 0 : 1);
  generateCallToInvocationHandler();
  generateDecisionBetweenReturningOrContinuingToRealImplementation();
  return copyOriginalImplementationCode();
}

Fixed version (ground truth):
@NotNull private MethodVisitor generateCallToHandlerThroughMockingBridge(@Nullable String genericSignature,@NotNull String internalClassName,@NotNull ExecutionMode actualExecutionMode){
  generateCodeToObtainInstanceOfMockingBridge(MockedBridge.MB);
  boolean isStatic=generateCodeToPassThisOrNullIfStaticMethod();
  mw.visitInsn(ACONST_NULL);
  Type[] argTypes=Type.getArgumentTypes(methodDesc);
  generateCodeToCreateArrayOfObject(mw,6 + argTypes.length);
  int i=0;
  generateCodeToFillArrayElement(i++,methodAccess);
  generateCodeToFillArrayElement(i++,internalClassName);
  generateCodeToFillArrayElement(i++,methodName);
  generateCodeToFillArrayElement(i++,methodDesc);
  generateCodeToFillArrayElement(i++,genericSignature);
  generateCodeToFillArrayElement(i++,actualExecutionMode.ordinal());
  generateCodeToFillArrayWithParameterValues(mw,argTypes,i,isStatic ? 0 : 1);
  generateCallToInvocationHandler();
  generateDecisionBetweenReturningOrContinuingToRealImplementation();
  return copyOriginalImplementationCode(false);
}
Program: 164948
Project: 164948
Buggy source:
static void generateDirectCallToHandler(@NotNull MethodWriter mw,@NotNull String className,int access,@NotNull String name,@NotNull String desc,@Nullable String genericSignature,@NotNull ExecutionMode executionMode){
  boolean isStatic=generateCodeToPassThisOrNullIfStaticMethod(mw,access);
  mw.visitLdcInsn(access);
  mw.visitLdcInsn(className);
  mw.visitLdcInsn(name + desc);
  generateInstructionToLoadNullableString(mw,genericSignature);
  mw.visitLdcInsn(executionMode.ordinal());
  Type[] argTypes=Type.getArgumentTypes(desc);
  int argCount=argTypes.length;
  if (argCount == 0) {
    mw.visitInsn(ACONST_NULL);
  }
 else {
    generateCodeToCreateArrayOfObject(mw,argCount);
    generateCodeToFillArrayWithParameterValues(mw,argTypes,0,isStatic ? 0 : 1);
  }
  mw.visitMethodInsn(INVOKESTATIC,"String_Node_Str","String_Node_Str","String_Node_Str" + "String_Node_Str",false);
}

Fixed version (ground truth):
static void generateDirectCallToHandler(@NotNull MethodWriter mw,@NotNull String className,int access,@NotNull String name,@NotNull String desc,@Nullable String genericSignature,@NotNull ExecutionMode executionMode){
  boolean isStatic=generateCodeToPassThisOrNullIfStaticMethod(mw,access,name);
  mw.visitLdcInsn(access);
  mw.visitLdcInsn(className);
  mw.visitLdcInsn(name + desc);
  generateInstructionToLoadNullableString(mw,genericSignature);
  mw.visitLdcInsn(executionMode.ordinal());
  Type[] argTypes=Type.getArgumentTypes(desc);
  int argCount=argTypes.length;
  if (argCount == 0) {
    mw.visitInsn(ACONST_NULL);
  }
 else {
    generateCodeToCreateArrayOfObject(mw,argCount);
    generateCodeToFillArrayWithParameterValues(mw,argTypes,0,isStatic ? 0 : 1);
  }
  mw.visitMethodInsn(INVOKESTATIC,"String_Node_Str","String_Node_Str","String_Node_Str" + "String_Node_Str",false);
}
Program: 164949
Project: 164949
Buggy source:
private void generateCodeToObtainMockUpInstance(@NotNull String mockClassDesc){
  mw.visitLdcInsn(mockClassDesc);
  generateCodeToPassThisOrNullIfStaticMethod(mw,methodAccess);
  mw.visitMethodInsn(INVOKESTATIC,"String_Node_Str","String_Node_Str","String_Node_Str",false);
  mw.visitTypeInsn(CHECKCAST,mockClassDesc);
}

Fixed version (ground truth):
private void generateCodeToObtainMockUpInstance(@NotNull String mockClassDesc){
  mw.visitLdcInsn(mockClassDesc);
  generateCodeToPassThisOrNullIfStaticMethod();
  mw.visitMethodInsn(INVOKESTATIC,"String_Node_Str","String_Node_Str","String_Node_Str",false);
  mw.visitTypeInsn(CHECKCAST,mockClassDesc);
}
Program: 164950
Project: 164950
Buggy source:
/** 
 * If the specified method has a mock definition, then generates bytecode to redirect calls made to it to the mock method. If it has no mock, does nothing.
 * @param access not relevant
 * @param name together with desc, used to identity the method in given set of mock methods
 * @param signature not relevant
 * @param exceptions not relevant
 * @return {@code null} if the method was redefined, otherwise a {@code MethodWriter} that writes out the visitedmethod code without changes
 */
@Override public MethodVisitor visitMethod(int access,@NotNull String name,@NotNull String desc,@Nullable String signature,@Nullable String[] exceptions){
  if ((access & ABSTRACT_OR_SYNTHETIC) != 0) {
    if (isAbstract(access)) {
      mockMethods.findMethod(access,name,desc,signature);
    }
    return cw.visitMethod(access,name,desc,signature,exceptions);
  }
  isConstructor="String_Node_Str".equals(name);
  if (isConstructor && isMockedSuperclass() || !hasMock(access,name,desc,signature)) {
    return cw.visitMethod(access,name,desc,signature,exceptions);
  }
  startModifiedMethodVersion(access,name,desc,signature,exceptions);
  if (isConstructor) {
    generateCallToSuperConstructor();
  }
 else   if (isNative(methodAccess)) {
    generateCallToUpdateMockState();
    generateCallToMockMethod();
    generateMethodReturn();
    mw.visitMaxs(1,0);
    return methodAnnotationsVisitor;
  }
  generateDynamicCallToMock();
  return new CopyingMethodWriter();
}

Fixed version (ground truth):
/** 
 * If the specified method has a mock definition, then generates bytecode to redirect calls made to it to the mock method. If it has no mock, does nothing.
 * @param access not relevant
 * @param name together with desc, used to identity the method in given set of mock methods
 * @param signature not relevant
 * @param exceptions not relevant
 * @return {@code null} if the method was redefined, otherwise a {@code MethodWriter} that writes out the visitedmethod code without changes
 */
@Override public MethodVisitor visitMethod(int access,@NotNull String name,@NotNull String desc,@Nullable String signature,@Nullable String[] exceptions){
  if ((access & ABSTRACT_OR_SYNTHETIC) != 0) {
    if (isAbstract(access)) {
      mockMethods.findMethod(access,name,desc,signature);
    }
    return cw.visitMethod(access,name,desc,signature,exceptions);
  }
  isConstructor="String_Node_Str".equals(name);
  if (isConstructor && isMockedSuperclass() || !hasMock(access,name,desc,signature)) {
    return cw.visitMethod(access,name,desc,signature,exceptions);
  }
  startModifiedMethodVersion(access,name,desc,signature,exceptions);
  if (isConstructor) {
    generateCallToSuperConstructor();
  }
 else   if (isNative(methodAccess)) {
    generateCallToUpdateMockState();
    generateCallToMockMethod();
    generateMethodReturn();
    mw.visitMaxs(1,0);
    return methodAnnotationsVisitor;
  }
  generateDynamicCallToMock();
  return copyOriginalImplementationCode(isConstructor);
}
Program: 164951
Project: 164951
Buggy source:
private void generateCallToMockMethodThroughMockingBridge(){
  generateCodeToObtainInstanceOfMockingBridge(MockMethodBridge.MB);
  boolean isStatic=generateCodeToPassThisOrNullIfStaticMethod(mw,methodAccess);
  mw.visitInsn(ACONST_NULL);
  Type[] argTypes=Type.getArgumentTypes(methodDesc);
  generateCodeToCreateArrayOfObject(mw,6 + argTypes.length);
  int i=0;
  generateCodeToFillArrayElement(i++,mockMethods.getMockClassInternalName());
  generateCodeToFillArrayElement(i++,classDesc);
  generateCodeToFillArrayElement(i++,methodAccess);
  if (mockMethod.isAdvice) {
    generateCodeToFillArrayElement(i++,methodName);
    generateCodeToFillArrayElement(i++,methodDesc);
  }
 else {
    generateCodeToFillArrayElement(i++,mockMethod.name);
    generateCodeToFillArrayElement(i++,mockMethod.desc);
  }
  generateCodeToFillArrayElement(i++,mockMethod.getIndexForMockState());
  generateCodeToFillArrayWithParameterValues(mw,argTypes,i,isStatic ? 0 : 1);
  generateCallToInvocationHandler();
}

Fixed version (ground truth):
private void generateCallToMockMethodThroughMockingBridge(){
  generateCodeToObtainInstanceOfMockingBridge(MockMethodBridge.MB);
  boolean isStatic=generateCodeToPassThisOrNullIfStaticMethod();
  mw.visitInsn(ACONST_NULL);
  Type[] argTypes=Type.getArgumentTypes(methodDesc);
  generateCodeToCreateArrayOfObject(mw,6 + argTypes.length);
  int i=0;
  generateCodeToFillArrayElement(i++,mockMethods.getMockClassInternalName());
  generateCodeToFillArrayElement(i++,classDesc);
  generateCodeToFillArrayElement(i++,methodAccess);
  if (mockMethod.isAdvice) {
    generateCodeToFillArrayElement(i++,methodName);
    generateCodeToFillArrayElement(i++,methodDesc);
  }
 else {
    generateCodeToFillArrayElement(i++,mockMethod.name);
    generateCodeToFillArrayElement(i++,mockMethod.desc);
  }
  generateCodeToFillArrayElement(i++,mockMethod.getIndexForMockState());
  generateCodeToFillArrayWithParameterValues(mw,argTypes,i,isStatic ? 0 : 1);
  generateCallToInvocationHandler();
}
Program: 164952
Project: 164952
Buggy source:
private void generateCallToControlMethodThroughMockingBridge(){
  generateCodeToObtainInstanceOfMockingBridge(MockupBridge.MB);
  generateCodeToPassThisOrNullIfStaticMethod(mw,methodAccess);
  mw.visitInsn(ACONST_NULL);
  generateCodeToCreateArrayOfObject(mw,2);
  int i=0;
  generateCodeToFillArrayElement(i++,mockMethods.getMockClassInternalName());
  generateCodeToFillArrayElement(i,mockMethod.getIndexForMockState());
  generateCallToInvocationHandler();
}

Fixed version (ground truth):
private void generateCallToControlMethodThroughMockingBridge(){
  generateCodeToObtainInstanceOfMockingBridge(MockupBridge.MB);
  generateCodeToPassThisOrNullIfStaticMethod();
  mw.visitInsn(ACONST_NULL);
  generateCodeToCreateArrayOfObject(mw,2);
  int i=0;
  generateCodeToFillArrayElement(i++,mockMethods.getMockClassInternalName());
  generateCodeToFillArrayElement(i,mockMethod.getIndexForMockState());
  generateCallToInvocationHandler();
}
Program: 164953
Project: 164953
Buggy source:
private void generateCallToCreateNewMockInvocation(@NotNull Type[] argTypes,int initialParameterIndex){
  generateCodeToPassThisOrNullIfStaticMethod(mw,methodAccess);
  int argCount=argTypes.length;
  if (argCount == 0) {
    mw.visitInsn(ACONST_NULL);
  }
 else {
    generateCodeToCreateArrayOfObject(mw,argCount);
    generateCodeToFillArrayWithParameterValues(mw,argTypes,0,initialParameterIndex);
  }
  mw.visitLdcInsn(mockMethods.getMockClassInternalName());
  mw.visitIntInsn(SIPUSH,mockMethod.getIndexForMockState());
  mw.visitLdcInsn(classDesc);
  mw.visitLdcInsn(methodName);
  mw.visitLdcInsn(methodDesc);
  mw.visitMethodInsn(INVOKESTATIC,"String_Node_Str","String_Node_Str","String_Node_Str" + "String_Node_Str",false);
}

Fixed version (ground truth):
private void generateCallToCreateNewMockInvocation(@NotNull Type[] argTypes,int initialParameterIndex){
  generateCodeToPassThisOrNullIfStaticMethod();
  int argCount=argTypes.length;
  if (argCount == 0) {
    mw.visitInsn(ACONST_NULL);
  }
 else {
    generateCodeToCreateArrayOfObject(mw,argCount);
    generateCodeToFillArrayWithParameterValues(mw,argTypes,0,initialParameterIndex);
  }
  mw.visitLdcInsn(mockMethods.getMockClassInternalName());
  mw.visitIntInsn(SIPUSH,mockMethod.getIndexForMockState());
  mw.visitLdcInsn(classDesc);
  mw.visitLdcInsn(methodName);
  mw.visitLdcInsn(methodDesc);
  mw.visitMethodInsn(INVOKESTATIC,"String_Node_Str","String_Node_Str","String_Node_Str" + "String_Node_Str",false);
}
Program: 164954
Project: 164954
Buggy source:
private void generateCallToUpdateMockState(){
  if (useMockingBridgeForUpdatingMockState) {
    generateCallToControlMethodThroughMockingBridge();
    mw.visitTypeInsn(CHECKCAST,"String_Node_Str");
    mw.visitMethodInsn(INVOKEVIRTUAL,"String_Node_Str","String_Node_Str","String_Node_Str",false);
  }
 else {
    mw.visitLdcInsn(mockMethods.getMockClassInternalName());
    generateCodeToPassThisOrNullIfStaticMethod(mw,methodAccess);
    mw.visitIntInsn(SIPUSH,mockMethod.getIndexForMockState());
    mw.visitMethodInsn(INVOKESTATIC,"String_Node_Str","String_Node_Str","String_Node_Str",false);
  }
}

Fixed version (ground truth):
private void generateCallToUpdateMockState(){
  if (useMockingBridgeForUpdatingMockState) {
    generateCallToControlMethodThroughMockingBridge();
    mw.visitTypeInsn(CHECKCAST,"String_Node_Str");
    mw.visitMethodInsn(INVOKEVIRTUAL,"String_Node_Str","String_Node_Str","String_Node_Str",false);
  }
 else {
    mw.visitLdcInsn(mockMethods.getMockClassInternalName());
    generateCodeToPassThisOrNullIfStaticMethod();
    mw.visitIntInsn(SIPUSH,mockMethod.getIndexForMockState());
    mw.visitMethodInsn(INVOKESTATIC,"String_Node_Str","String_Node_Str","String_Node_Str",false);
  }
}
Program: 164955
Project: 164955
Buggy source:
@Mock int doSomething(){
  return 2;
}

Fixed version (ground truth):
private void doSomething(){
}
Program: 164956
Project: 164956
Buggy source:
public int getNumberOfCoveredSegments(){
  if (executionCount == 0) {
    return 0;
  }
  if (noBranchesYet()) {
    return 1;
  }
  return getSegmentsCovered();
}

Fixed version (ground truth):
public int getNumberOfCoveredSegments(){
  return noBranchesYet() ? 1 : getSegmentsCovered();
}
Program: 164957
Project: 164957
Buggy source:
private void addMappingsFromTypeParametersToTypeArguments(@NotNull Class<?> mockedClass,@NotNull ParameterizedType mockedType){
  TypeVariable<?>[] typeParameters=mockedClass.getTypeParameters();
  Type[] typeArguments=mockedType.getActualTypeArguments();
  int n=typeParameters.length;
  for (int i=0; i < n; i++) {
    TypeVariable<?> typeParam=typeParameters[i];
    String typeVarName=typeParam.getName();
    Type typeArg=typeArguments[i];
    Type mappedTypeArg;
    String mappedTypeArgName=null;
    if (typeArg instanceof Class<?>) {
      mappedTypeArg=typeArg;
      if (withSignatures) {
        mappedTypeArgName='L' + ((Class<?>)typeArg).getName().replace('.','/');
      }
    }
 else     if (typeArg instanceof TypeVariable<?>) {
      mappedTypeArg=typeArg;
      if (withSignatures) {
        String intermediateTypeArg='T' + ((TypeVariable<?>)typeArg).getName();
        mappedTypeArgName=typeParametersToTypeArgumentNames.get(intermediateTypeArg);
      }
    }
 else {
      mappedTypeArg=typeParam.getBounds()[0];
      if (withSignatures) {
        mappedTypeArgName='L' + getClassType(mappedTypeArg).getName().replace('.','/');
      }
    }
    addTypeMapping(typeVarName,mappedTypeArg,mappedTypeArgName);
  }
}

Fixed version (ground truth):
private void addMappingsFromTypeParametersToTypeArguments(@NotNull Class<?> mockedClass,@NotNull ParameterizedType mockedType){
  TypeVariable<?>[] typeParameters=mockedClass.getTypeParameters();
  Type[] typeArguments=mockedType.getActualTypeArguments();
  int n=typeParameters.length;
  for (int i=0; i < n; i++) {
    TypeVariable<?> typeParam=typeParameters[i];
    String typeVarName=typeParam.getName();
    if (typeParametersToTypeArguments.containsKey(typeVarName)) {
      continue;
    }
    Type typeArg=typeArguments[i];
    Type mappedTypeArg;
    String mappedTypeArgName=null;
    if (typeArg instanceof Class<?>) {
      mappedTypeArg=typeArg;
      if (withSignatures) {
        mappedTypeArgName='L' + ((Class<?>)typeArg).getName().replace('.','/');
      }
    }
 else     if (typeArg instanceof TypeVariable<?>) {
      mappedTypeArg=typeArg;
      if (withSignatures) {
        String intermediateTypeArg='T' + ((TypeVariable<?>)typeArg).getName();
        mappedTypeArgName=typeParametersToTypeArgumentNames.get(intermediateTypeArg);
      }
    }
 else {
      mappedTypeArg=typeParam.getBounds()[0];
      if (withSignatures) {
        mappedTypeArgName='L' + getClassType(mappedTypeArg).getName().replace('.','/');
      }
    }
    addTypeMapping(typeVarName,mappedTypeArg,mappedTypeArgName);
  }
}
Program: 164958
Project: 164958
Buggy source:
private void createCaptureTransformer(@NotNull CapturedType captureMetadata,boolean registerCapturedClasses){
  CaptureTransformer transformer=new CaptureTransformer(captureMetadata,this,registerCapturedClasses);
  Startup.instrumentation().addTransformer(transformer,true);
  TestRun.mockFixture().addCaptureTransformer(transformer);
}

Fixed version (ground truth):
private void createCaptureTransformer(@NotNull CapturedType captureMetadata,boolean registerCapturedClasses,@Nullable M typeMetadata){
  CaptureTransformer<M> transformer=new CaptureTransformer<M>(captureMetadata,this,registerCapturedClasses,typeMetadata);
  Startup.instrumentation().addTransformer(transformer,true);
  TestRun.mockFixture().addCaptureTransformer(transformer);
}
Program: 164959
Project: 164959
Buggy source:
public final void makeSureAllSubtypesAreModified(@NotNull Class<?> baseType,boolean registerCapturedClasses){
  if (baseType == TypeVariable.class) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  String baseTypeDesc=Type.getInternalName(baseType);
  CapturedType captureMetadata=new CapturedType(baseType);
  redefineClassesAlreadyLoaded(captureMetadata,baseTypeDesc);
  createCaptureTransformer(captureMetadata,registerCapturedClasses);
}

Fixed version (ground truth):
public final void makeSureAllSubtypesAreModified(@NotNull Class<?> baseType,boolean registerCapturedClasses,@Nullable M typeMetadata){
  if (baseType == TypeVariable.class) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  CapturedType captureMetadata=new CapturedType(baseType);
  redefineClassesAlreadyLoaded(captureMetadata,baseType,typeMetadata);
  createCaptureTransformer(captureMetadata,registerCapturedClasses,typeMetadata);
}
Program: 164960
Project: 164960
Buggy source:
private void redefineClassesAlreadyLoaded(@NotNull CapturedType captureMetadata,@NotNull String baseTypeDesc){
  Class<?>[] classesLoaded=Startup.instrumentation().getAllLoadedClasses();
  for (  Class<?> aClass : classesLoaded) {
    if (captureMetadata.isToBeCaptured(aClass)) {
      redefineClass(aClass,baseTypeDesc);
    }
  }
}

Fixed version (ground truth):
private void redefineClassesAlreadyLoaded(@NotNull CapturedType captureMetadata,@NotNull Class<?> baseType,@Nullable M typeMetadata){
  Class<?>[] classesLoaded=Startup.instrumentation().getAllLoadedClasses();
  for (  Class<?> aClass : classesLoaded) {
    if (captureMetadata.isToBeCaptured(aClass)) {
      redefineClass(aClass,baseType,typeMetadata);
    }
  }
}
Program: 164961
Project: 164961
Buggy source:
@NotNull protected abstract BaseClassModifier createModifier(@Nullable ClassLoader cl,@NotNull ClassReader cr,@NotNull String baseTypeDesc);

Fixed version (ground truth):
@NotNull protected abstract BaseClassModifier createModifier(@Nullable ClassLoader cl,@NotNull ClassReader cr,@NotNull Class<?> baseType,M typeMetadata);
Program: 164962
Project: 164962
Buggy source:
@Override @Nullable public byte[] transform(@Nullable ClassLoader loader,@NotNull String classDesc,@Nullable Class<?> classBeingRedefined,@Nullable ProtectionDomain protectionDomain,@NotNull byte[] classfileBuffer){
  if (classBeingRedefined != null || inactive || CapturedType.isNotToBeCaptured(loader,protectionDomain,classDesc)) {
    return null;
  }
  ClassReader cr=new ClassReader(classfileBuffer);
  SuperTypeCollector superTypeCollector=new SuperTypeCollector(loader);
  try {
    cr.accept(superTypeCollector,SKIP_DEBUG);
  }
 catch (  VisitInterruptedException ignore) {
    if (superTypeCollector.classExtendsCapturedType && !isGeneratedClass(classDesc)) {
      String className=classDesc.replace('/','.');
      return modifyAndRegisterClass(loader,className,cr);
    }
  }
  return null;
}

Fixed version (ground truth):
@Override @Nullable public byte[] transform(@Nullable ClassLoader loader,@NotNull String classDesc,@Nullable Class<?> classBeingRedefined,@Nullable ProtectionDomain protectionDomain,@NotNull byte[] classfileBuffer){
  if (classBeingRedefined != null || inactive || CapturedType.isNotToBeCaptured(loader,protectionDomain,classDesc)) {
    return null;
  }
  ClassReader cr=new ClassReader(classfileBuffer);
  SuperTypeCollector superTypeCollector=new SuperTypeCollector(loader);
  try {
    cr.accept(superTypeCollector,SKIP_DEBUG);
  }
 catch (  VisitInterruptedException ignore) {
    if (superTypeCollector.classExtendsCapturedType) {
      String className=classDesc.replace('/','.');
      return modifyAndRegisterClass(loader,className,cr);
    }
  }
  return null;
}
Program: 164963
Project: 164963
Buggy source:
@NotNull private byte[] modifyAndRegisterClass(@Nullable ClassLoader loader,@NotNull String className,@NotNull ClassReader cr){
  ClassVisitor modifier=captureOfImplementations.createModifier(loader,cr,capturedTypeDesc);
  cr.accept(modifier,SKIP_FRAMES);
  ClassIdentification classId=new ClassIdentification(loader,className);
  byte[] originalBytecode=cr.b;
  if (transformedClasses == Collections.<ClassIdentification,byte[]>emptyMap()) {
    TestRun.mockFixture().addTransformedClass(classId,originalBytecode);
  }
 else {
    transformedClasses.put(classId,originalBytecode);
  }
  TestRun.mockFixture().registerMockedClass(capturedType.baseType);
  return modifier.toByteArray();
}

Fixed version (ground truth):
@NotNull private byte[] modifyAndRegisterClass(@Nullable ClassLoader loader,@NotNull String className,@NotNull ClassReader cr){
  ClassVisitor modifier=captureOfImplementations.createModifier(loader,cr,capturedType.baseType,typeMetadata);
  cr.accept(modifier,SKIP_FRAMES);
  ClassIdentification classId=new ClassIdentification(loader,className);
  byte[] originalBytecode=cr.b;
  if (transformedClasses == Collections.<ClassIdentification,byte[]>emptyMap()) {
    TestRun.mockFixture().addTransformedClass(classId,originalBytecode);
  }
 else {
    transformedClasses.put(classId,originalBytecode);
  }
  TestRun.mockFixture().registerMockedClass(capturedType.baseType);
  return modifier.toByteArray();
}
Program: 164964
Project: 164964
Buggy source:
CaptureTransformer(@NotNull CapturedType capturedType,@NotNull CaptureOfImplementations captureOfImplementations,boolean registerTransformedClasses){
  this.capturedType=capturedType;
  capturedTypeDesc=Type.getInternalName(capturedType.baseType);
  this.captureOfImplementations=captureOfImplementations;
  transformedClasses=registerTransformedClasses ? new HashMap<ClassIdentification,byte[]>(2) : Collections.<ClassIdentification,byte[]>emptyMap();
}

Fixed version (ground truth):
CaptureTransformer(@NotNull CapturedType capturedType,@NotNull CaptureOfImplementations<M> captureOfImplementations,boolean registerTransformedClasses,@Nullable M typeMetadata){
  this.capturedType=capturedType;
  capturedTypeDesc=Type.getInternalName(capturedType.baseType);
  this.captureOfImplementations=captureOfImplementations;
  transformedClasses=registerTransformedClasses ? new HashMap<ClassIdentification,byte[]>(2) : Collections.<ClassIdentification,byte[]>emptyMap();
  this.typeMetadata=typeMetadata;
}
Program: 164965
Project: 164965
Buggy source:
final void registerCaptureOfNewInstances(@NotNull MockedType typeMetadata,@Nullable Object mockInstance){
  capturingTypeMetadata=typeMetadata;
  Class<?> baseType=typeMetadata.getClassType();
  if (!typeMetadata.isFinalFieldOrParameter()) {
    makeSureAllSubtypesAreModified(baseType,typeMetadata.fieldFromTestClass);
  }
  List<Capture> captures=baseTypeToCaptures.get(baseType);
  if (captures == null) {
    captures=new ArrayList<Capture>();
    baseTypeToCaptures.put(baseType,captures);
  }
  captures.add(new Capture(typeMetadata,mockInstance));
}

Fixed version (ground truth):
final void registerCaptureOfNewInstances(@NotNull MockedType typeMetadata,@Nullable Object mockInstance){
  Class<?> baseType=typeMetadata.getClassType();
  if (!typeMetadata.isFinalFieldOrParameter()) {
    makeSureAllSubtypesAreModified(typeMetadata);
  }
  List<Capture> captures=baseTypeToCaptures.get(baseType);
  if (captures == null) {
    captures=new ArrayList<Capture>();
    baseTypeToCaptures.put(baseType,captures);
  }
  captures.add(new Capture(typeMetadata,mockInstance));
}
Program: 164966
Project: 164966
Buggy source:
public final boolean captureNewInstance(@Nullable Object fieldOwner,@NotNull Object mock){
  Class<?> mockedClass=mock.getClass();
  List<Capture> captures=baseTypeToCaptures.get(mockedClass);
  boolean constructorModifiedForCaptureOnly=captures == null;
  if (constructorModifiedForCaptureOnly) {
    captures=findCaptures(mockedClass);
    if (captures == null) {
      return false;
    }
  }
  Capture captureFound=findCapture(fieldOwner,mock,captures);
  if (capturingTypeMetadata.injectable) {
    if (captureFound != null) {
      TestRun.getExecutingTest().addCapturedInstanceForInjectableMock(captureFound.originalMockInstance,mock);
    }
    constructorModifiedForCaptureOnly=true;
  }
 else   if (captureFound != null) {
    TestRun.getExecutingTest().addCapturedInstance(captureFound.originalMockInstance,mock);
  }
  return constructorModifiedForCaptureOnly;
}

Fixed version (ground truth):
public final boolean captureNewInstance(@Nullable Object fieldOwner,@NotNull Object mock){
  Class<?> mockedClass=mock.getClass();
  List<Capture> captures=baseTypeToCaptures.get(mockedClass);
  boolean constructorModifiedForCaptureOnly=captures == null;
  if (constructorModifiedForCaptureOnly) {
    captures=findCaptures(mockedClass);
    if (captures == null) {
      return false;
    }
  }
  Capture captureFound=findCapture(fieldOwner,mock,captures);
  if (captureFound != null) {
    if (captureFound.typeMetadata.injectable) {
      TestRun.getExecutingTest().addCapturedInstanceForInjectableMock(captureFound.originalMockInstance,mock);
      constructorModifiedForCaptureOnly=true;
    }
 else {
      TestRun.getExecutingTest().addCapturedInstance(captureFound.originalMockInstance,mock);
    }
  }
  return constructorModifiedForCaptureOnly;
}
Program: 164967
Project: 164967
Buggy source:
@Override @NotNull protected final BaseClassModifier createModifier(@Nullable ClassLoader cl,@NotNull ClassReader cr,@NotNull String baseTypeDesc){
  ExpectationsModifier modifier=new ExpectationsModifier(cl,cr,capturingTypeMetadata);
  modifier.setClassNameForCapturedInstanceMethods(baseTypeDesc);
  return modifier;
}

Fixed version (ground truth):
@NotNull @Override protected final BaseClassModifier createModifier(@Nullable ClassLoader cl,@NotNull ClassReader cr,@NotNull Class<?> baseType,@NotNull MockedType typeMetadata){
  ExpectationsModifier modifier=new ExpectationsModifier(cl,cr,typeMetadata);
  modifier.setClassNameForCapturedInstanceMethods(Type.getInternalName(baseType));
  return modifier;
}
Program: 164968
Project: 164968
Buggy source:
private void resetCaptureCount(@NotNull Field mockField,@NotNull List<Capture> fieldsWithCapture){
  for (  Capture fieldWithCapture : fieldsWithCapture) {
    if (fieldWithCapture.typeMetadata.field == mockField) {
      fieldWithCapture.reset();
    }
  }
}

Fixed version (ground truth):
private static void resetCaptureCount(@NotNull Field mockField,@NotNull List<Capture> fieldsWithCapture){
  for (  Capture fieldWithCapture : fieldsWithCapture) {
    if (fieldWithCapture.typeMetadata.field == mockField) {
      fieldWithCapture.reset();
    }
  }
}
Program: 164969
Project: 164969
Buggy source:
private void registerCaptureOfNewInstances(@NotNull MockedType mockedType,@NotNull Object originalInstance){
  if (captureOfNewInstances == null) {
    captureOfNewInstances=new CaptureOfNewInstances();
  }
  captureOfNewInstances.registerCaptureOfNewInstances(mockedType,originalInstance);
  captureOfNewInstances.makeSureAllSubtypesAreModified(mockedType.getClassType());
}

Fixed version (ground truth):
private void registerCaptureOfNewInstances(@NotNull MockedType mockedType,@NotNull Object originalInstance){
  if (captureOfNewInstances == null) {
    captureOfNewInstances=new CaptureOfNewInstances();
  }
  captureOfNewInstances.registerCaptureOfNewInstances(mockedType,originalInstance);
  captureOfNewInstances.makeSureAllSubtypesAreModified(mockedType);
}
Program: 164970
Project: 164970
Buggy source:
@Nullable public <T>Class<T> apply(){
  @SuppressWarnings("String_Node_Str") Class<T> baseType=(Class<T>)mockClassSetup.realClass;
  Class<T> baseClassType=baseType;
  Class<T> mockedClass=null;
  if (baseType.isInterface()) {
    mockedClass=new MockedImplementationClass<T>(mockClassSetup.mockUp).createImplementation(baseType);
    baseClassType=mockedClass;
  }
  if (baseClassType != Object.class) {
    redefineClass(baseClassType,mockit.external.asm4.Type.getInternalName(baseType));
    mockClassSetup.validateThatAllMockMethodsWereApplied();
  }
  makeSureAllSubtypesAreModified(baseType,false);
  return mockedClass;
}

Fixed version (ground truth):
@Nullable public <T>Class<T> apply(){
  @SuppressWarnings("String_Node_Str") Class<T> baseType=(Class<T>)mockClassSetup.realClass;
  Class<T> baseClassType=baseType;
  Class<T> mockedClass=null;
  if (baseType.isInterface()) {
    mockedClass=new MockedImplementationClass<T>(mockClassSetup.mockUp).createImplementation(baseType);
    baseClassType=mockedClass;
  }
  if (baseClassType != Object.class) {
    redefineClass(baseClassType,baseType,null);
    mockClassSetup.validateThatAllMockMethodsWereApplied();
  }
  makeSureAllSubtypesAreModified(baseType,false,null);
  return mockedClass;
}
Program: 164971
Project: 164971
Buggy source:
@NotNull @Override protected BaseClassModifier createModifier(@Nullable ClassLoader cl,@NotNull ClassReader cr,@NotNull String baseTypeDesc){
  return mockClassSetup.createClassModifier(cr);
}

Fixed version (ground truth):
@NotNull @Override protected BaseClassModifier createModifier(@Nullable ClassLoader cl,@NotNull ClassReader cr,@NotNull Class<?> baseType,Void typeMetadata){
  return mockClassSetup.createClassModifier(cr);
}
Program: 164972
Project: 164972
Buggy source:
public void doSomethingElse(int i){
}

Fixed version (ground truth):
@Override public void doSomethingElse(int i){
}
Program: 164973
Project: 164973
Buggy source:
@SuppressWarnings({"String_Node_Str"}) Object[] valueForSuper(String s){
  return new Object[]{"String_Node_Str"};
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") Object[] valueForSuper(String s){
  return new Object[]{"String_Node_Str"};
}
Program: 164974
Project: 164974
Buggy source:
public int doSomething(){
  return 2;
}

Fixed version (ground truth):
@Override public int doSomething(){
  return 2;
}
Program: 164975
Project: 164975
Buggy source:
protected static void clearTestedFieldsIfAny(){
  SharedFieldTypeRedefinitions sharedRedefinitions=TestRun.getSharedFieldTypeRedefinitions();
  if (sharedRedefinitions != null) {
    TestedClassInstantiations testedClasses=sharedRedefinitions.getTestedClassInstantiations();
    if (testedClasses != null) {
      testedClasses.clearTestedFields();
    }
  }
}

Fixed version (ground truth):
protected static void clearTestedFieldsIfAny(boolean testSucceeded){
  SharedFieldTypeRedefinitions sharedRedefinitions=TestRun.getSharedFieldTypeRedefinitions();
  if (sharedRedefinitions != null) {
    TestedClassInstantiations testedClasses=sharedRedefinitions.getTestedClassInstantiations();
    if (testedClasses != null) {
      testedClasses.clearTestedFields(testSucceeded);
    }
  }
}
Program: 164976
Project: 164976
Buggy source:
protected static void concludeTestMethodExecution(@NotNull SavePoint savePoint,@Nullable Throwable thrownByTest,boolean thrownAsExpected) throws Throwable {
  TestRun.enterNoMockingZone();
  Error expectationsFailure=RecordAndReplayExecution.endCurrentReplayIfAny();
  MockStates mockStates=TestRun.getMockStates();
  try {
    if (expectationsFailure == null && (thrownByTest == null || thrownAsExpected)) {
      mockStates.verifyMissingInvocations();
    }
  }
  finally {
    mockStates.resetExpectations();
    savePoint.rollback();
    TestRun.exitNoMockingZone();
  }
  if (thrownByTest != null) {
    if (expectationsFailure == null || !thrownAsExpected || isUnexpectedOrMissingInvocation(thrownByTest)) {
      throw thrownByTest;
    }
    Throwable expectationsFailureCause=expectationsFailure.getCause();
    if (expectationsFailureCause != null) {
      expectationsFailureCause.initCause(thrownByTest);
    }
  }
  if (expectationsFailure != null) {
    throw expectationsFailure;
  }
}

Fixed version (ground truth):
protected static void concludeTestMethodExecution(@NotNull SavePoint savePoint,@Nullable Throwable thrownByTest,boolean thrownAsExpected) throws Throwable {
  TestRun.enterNoMockingZone();
  Error expectationsFailure=RecordAndReplayExecution.endCurrentReplayIfAny();
  boolean testSucceeded=expectationsFailure == null && (thrownByTest == null || thrownAsExpected);
  MockStates mockStates=TestRun.getMockStates();
  try {
    clearTestedFieldsIfAny(testSucceeded);
    if (expectationsFailure == null && (thrownByTest == null || thrownAsExpected)) {
      mockStates.verifyMissingInvocations();
    }
  }
  finally {
    mockStates.resetExpectations();
    savePoint.rollback();
    TestRun.exitNoMockingZone();
  }
  if (thrownByTest != null) {
    if (expectationsFailure == null || !thrownAsExpected || isUnexpectedOrMissingInvocation(thrownByTest)) {
      throw thrownByTest;
    }
    Throwable expectationsFailureCause=expectationsFailure.getCause();
    if (expectationsFailureCause != null) {
      expectationsFailureCause.initCause(thrownByTest);
    }
  }
  if (expectationsFailure != null) {
    throw expectationsFailure;
  }
}
Program: 164977
Project: 164977
Buggy source:
private static void executeTestMethod(@NotNull MockInvocation invocation,@NotNull Object target,@Nullable Object... parameters) throws Throwable {
  SavePoint savePoint=new SavePoint();
  TestRun.setRunningIndividualTest(target);
  FrameworkMethod it=invocation.getInvokedInstance();
  Method testMethod=it.getMethod();
  Throwable testFailure=null;
  boolean testFailureExpected=false;
  try {
    Object[] mockParameters=createInstancesForMockParameters(target,testMethod,parameters);
    createInstancesForTestedFields(target);
    invocation.prepareToProceed();
    Object[] params=mockParameters == null ? parameters : mockParameters;
    it.invokeExplosively(target,params);
  }
 catch (  Throwable thrownByTest) {
    testFailure=thrownByTest;
    Class<? extends Throwable> expectedType=testMethod.getAnnotation(Test.class).expected();
    testFailureExpected=expectedType.isAssignableFrom(thrownByTest.getClass());
  }
 finally {
    clearTestedFieldsIfAny();
    concludeTestMethodExecution(savePoint,testFailure,testFailureExpected);
  }
}

Fixed version (ground truth):
private static void executeTestMethod(@NotNull MockInvocation invocation,@NotNull Object target,@Nullable Object... parameters) throws Throwable {
  SavePoint savePoint=new SavePoint();
  TestRun.setRunningIndividualTest(target);
  FrameworkMethod it=invocation.getInvokedInstance();
  Method testMethod=it.getMethod();
  Throwable testFailure=null;
  boolean testFailureExpected=false;
  try {
    Object[] mockParameters=createInstancesForMockParameters(target,testMethod,parameters);
    createInstancesForTestedFields(target);
    invocation.prepareToProceed();
    Object[] params=mockParameters == null ? parameters : mockParameters;
    it.invokeExplosively(target,params);
  }
 catch (  Throwable thrownByTest) {
    testFailure=thrownByTest;
    Class<?> expectedType=testMethod.getAnnotation(Test.class).expected();
    testFailureExpected=expectedType.isAssignableFrom(thrownByTest.getClass());
  }
 finally {
    concludeTestMethodExecution(savePoint,testFailure,testFailureExpected);
  }
}
Program: 164978
Project: 164978
Buggy source:
@Override public void afterInvocation(@NotNull IInvokedMethod invokedMethod,@NotNull ITestResult testResult){
  if (!invokedMethod.isTestMethod()) {
    afterConfigurationMethod(testResult);
    return;
  }
  TestRun.enterNoMockingZone();
  clearTestedFieldsIfAny();
  shouldPrepareForNextTest=true;
  SavePoint testMethodSavePoint=savePoint.get();
  savePoint.set(null);
  Throwable thrownByTest=testResult.getThrowable();
  try {
    if (thrownByTest == null) {
      concludeTestExecutionWithNothingThrown(testMethodSavePoint,testResult);
    }
 else     if (thrownByTest instanceof TestException) {
      concludeTestExecutionWithExpectedExceptionNotThrown(invokedMethod,testMethodSavePoint,testResult);
    }
 else     if (testResult.isSuccess()) {
      concludeTestExecutionWithExpectedExceptionThrown(testMethodSavePoint,testResult,thrownByTest);
    }
 else {
      concludeTestExecutionWithUnexpectedExceptionThrown(testMethodSavePoint,thrownByTest);
    }
  }
  finally {
    TestRun.finishCurrentTestExecution(false);
    TestRun.exitNoMockingZone();
  }
}

Fixed version (ground truth):
@Override public void afterInvocation(@NotNull IInvokedMethod invokedMethod,@NotNull ITestResult testResult){
  if (!invokedMethod.isTestMethod()) {
    afterConfigurationMethod(testResult);
    return;
  }
  TestRun.enterNoMockingZone();
  shouldPrepareForNextTest=true;
  SavePoint testMethodSavePoint=savePoint.get();
  savePoint.set(null);
  Throwable thrownByTest=testResult.getThrowable();
  try {
    if (thrownByTest == null) {
      concludeTestExecutionWithNothingThrown(testMethodSavePoint,testResult);
    }
 else     if (thrownByTest instanceof TestException) {
      concludeTestExecutionWithExpectedExceptionNotThrown(invokedMethod,testMethodSavePoint,testResult);
    }
 else     if (testResult.isSuccess()) {
      concludeTestExecutionWithExpectedExceptionThrown(testMethodSavePoint,testResult,thrownByTest);
    }
 else {
      concludeTestExecutionWithUnexpectedExceptionThrown(testMethodSavePoint,thrownByTest);
    }
  }
  finally {
    TestRun.finishCurrentTestExecution(false);
    TestRun.exitNoMockingZone();
  }
}
Program: 164979
Project: 164979
Buggy source:
public void clearTestedFields(){
  for (  TestedField testedField : testedFields) {
    testedField.clearIfAutomaticCreation();
  }
}

Fixed version (ground truth):
public void clearTestedFields(boolean testSucceeded){
  for (  TestedField testedField : testedFields) {
    testedField.clearIfAutomaticCreation(testSucceeded);
  }
}
Program: 164980
Project: 164980
Buggy source:
void clearIfAutomaticCreation(){
  if (createAutomatically) {
    Object testClassInstance=injectionState.getCurrentTestClassInstance();
    Object testedObject=FieldReflection.getFieldValue(testedField,testClassInstance);
    if (testedObject != null) {
      Class<?> testedClass=testedField.getType();
      executePreDestroyMethodIfAny(testedClass,testedObject);
    }
    FieldReflection.setFieldValue(testedField,testClassInstance,null);
  }
}

Fixed version (ground truth):
void clearIfAutomaticCreation(boolean testSucceeded){
  if (createAutomatically) {
    Object testClassInstance=injectionState.getCurrentTestClassInstance();
    if (testSucceeded) {
      Object testedObject=FieldReflection.getFieldValue(testedField,testClassInstance);
      if (testedObject != null) {
        Class<?> testedClass=testedField.getType();
        executePreDestroyMethodIfAny(testedClass,testedObject);
      }
    }
    FieldReflection.setFieldValue(testedField,testClassInstance,null);
  }
}
Program: 164981
Project: 164981
Buggy source:
private static boolean isJMockitMethod(@NotNull String where){
  if (!where.startsWith("String_Node_Str")) {
    return false;
  }
  int p=where.lastIndexOf("String_Node_Str") + 4;
  if (p < 4) {
    return true;
  }
  return p < where.length() && where.charAt(p) != '$';
}

Fixed version (ground truth):
private static boolean isJMockitMethod(@NotNull String where){
  if (!where.startsWith("String_Node_Str")) {
    return false;
  }
  int p=where.indexOf('$');
  if (p < 0) {
    int q=where.lastIndexOf("String_Node_Str");
    return q < 0 || q + 4 < where.length();
  }
  int q=where.lastIndexOf("String_Node_Str",p - 4);
  if (q < 0) {
    return true;
  }
  q+=4;
  return q < where.length() && where.charAt(q) != '$';
}
Program: 164982
Project: 164982
Buggy source:
@Nullable private Object findOrCreateEntityManager(@NotNull Object dependencyKey){
  String persistenceUnitName;
  Object emFactoryKey;
  if (dependencyKey instanceof String) {
    persistenceUnitName=extractIdFromDependencyKey((String)dependencyKey);
    emFactoryKey=EntityManagerFactory.class.getName() + ':' + persistenceUnitName;
  }
 else {
    persistenceUnitName="String_Node_Str";
    emFactoryKey=EntityManagerFactory.class;
  }
  EntityManagerFactory emFactory=(EntityManagerFactory)instantiatedDependencies.get(emFactoryKey);
  if (emFactory == null) {
    emFactory=Persistence.createEntityManagerFactory(persistenceUnitName);
  }
  return emFactory == null ? null : emFactory.createEntityManager();
}

Fixed version (ground truth):
@Nullable private Object findOrCreateEntityManager(@NotNull Object dependencyKey){
  String persistenceUnitName;
  Object emFactoryKey;
  if (dependencyKey instanceof String) {
    persistenceUnitName=extractIdFromDependencyKey((String)dependencyKey);
    emFactoryKey=EntityManagerFactory.class.getName() + ':' + persistenceUnitName;
  }
 else {
    persistenceUnitName=null;
    emFactoryKey=EntityManagerFactory.class;
  }
  EntityManagerFactory emFactory=(EntityManagerFactory)instantiatedDependencies.get(emFactoryKey);
  if (emFactory == null) {
    if (persistenceUnitName == null) {
      persistenceUnitName=discoverNameOfDefaultPersistenceUnit();
    }
    emFactory=Persistence.createEntityManagerFactory(persistenceUnitName);
  }
  return emFactory == null ? null : emFactory.createEntityManager();
}
Program: 164983
Project: 164983
Buggy source:
@Test public void useFullyInitializedTestedObject(){
  assertSame(mockedDependency,tested.dependencyToBeMocked);
  assertNotNull(tested.dependency2);
  assertSame(tested.dependency2,tested.dependency3);
  assertNotNull(tested.commonDependency);
  assertNotNull(tested.dependency2.dependency);
  assertSame(FirstLevelDependency.staticDependency,tested.dependency2.dependency);
  assertSame(tested.dependency3.dependency,tested.dependency2.dependency);
  assertSame(tested.commonDependency,tested.dependency2.commonDependency);
  assertSame(tested.commonDependency,tested.dependency3.commonDependency);
  assertSame(mockedDependency,FirstLevelDependency.dependencyToBeMocked);
  assertSame(mockedDependency,FirstLevelDependency.dependencyToBeMocked);
  assertSame(defaultEM,tested.dependency2.em);
  assertSame(tested.dependency2.em,tested.dependency3.em);
  assertSame(namedEMFactory,tested.commonDependency.emFactory);
  assertSame(namedEM,tested.commonDependency.em);
  assertNotSame(tested.dependency2.em,tested.commonDependency.em);
  assertSame(tested.commonDependency,tested.dependency2.dependency.commonDependency);
  assertSame(defaultEMFactory,tested.dependency2.dependency.emFactory);
  assertSame(tested.dependency2.em,tested.dependency2.dependency.em);
  assertTrue(tested.initialized);
  assertTrue(tested.dependency2.dependency.initialized);
}

Fixed version (ground truth):
@Test public void useFullyInitializedTestedObject(){
  assertSame(mockedDependency,tested.dependencyToBeMocked);
  assertNotNull(tested.dependency2);
  assertSame(tested.dependency2,tested.dependency3);
  assertNotNull(tested.commonDependency);
  assertNotNull(tested.dependency2.dependency);
  assertSame(FirstLevelDependency.staticDependency,tested.dependency2.dependency);
  assertSame(tested.dependency3.dependency,tested.dependency2.dependency);
  assertSame(tested.commonDependency,tested.dependency2.commonDependency);
  assertSame(tested.commonDependency,tested.dependency3.commonDependency);
  assertSame(mockedDependency,FirstLevelDependency.dependencyToBeMocked);
  assertSame(mockedDependency,FirstLevelDependency.dependencyToBeMocked);
  assertSame(defaultEM,tested.dependency2.em);
  assertSame(tested.dependency2.em,tested.dependency3.em);
  assertSame(namedEMFactory,tested.commonDependency.emFactory);
  assertSame(namedEM,tested.commonDependency.em);
  assertNotSame(tested.dependency2.em,tested.commonDependency.em);
  assertSame(tested.commonDependency,tested.dependency2.dependency.commonDependency);
  assertSame(tested.dependency2.em,tested.dependency2.dependency.em);
  assertTrue(tested.initialized);
  assertTrue(tested.dependency2.dependency.initialized);
}
Program: 164986
Project: 164986
Buggy source:
@Override public void onSlide(float slideOffset,Object... drawables){
  int color=SliderUtils.calculateColor(slideOffset,mStartColor,mEndColor);
  for (  Object drawable : drawables) {
    mPainter.paint(drawable,color);
  }
}

Fixed version (ground truth):
@Override public void onSlide(float slideOffset,Object... drawables){
  if (mPainter == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  int color=SliderUtils.calculateColor(slideOffset,mStartColor,mEndColor);
  for (  Object drawable : drawables) {
    mPainter.paintColor(color,drawable);
  }
}
Program: 164987
Project: 164987
Buggy source:
/** 
 * This method will check to see if the drawable is null or instance of   {@link android.graphics.drawable.ColorDrawable}(see   {@link android.graphics.drawable.ColorDrawable#setColorFilter(int,android.graphics.PorterDuff.Mode)}, if so it will create one. Otherwise this will see if cloneDrawable is true and clone the drawable.
 * @param cloneDrawable - whether to clone the drawable found
 * @param paint - the paint to initialize the new color drawable with
 * @param drawable - the drawable from an object
 * @return - fully created drawable
 */
public static Drawable getDrawable(boolean cloneDrawable,int paint,Drawable drawable){
  Drawable retDrawable;
  if (drawable == null || drawable instanceof ColorDrawable) {
    retDrawable=new ColorDrawable(paint);
  }
 else   if (cloneDrawable) {
    retDrawable=drawable.getCurrent().getCurrent();
  }
 else {
    retDrawable=drawable;
  }
  return retDrawable;
}

Fixed version (ground truth):
/** 
 * This method will check to see if the drawable is null or instance of   {@link android.graphics.drawable.ColorDrawable}(see   {@link android.graphics.drawable.ColorDrawable#setColorFilter(int,android.graphics.PorterDuff.Mode)}, if so it will create one. Otherwise this will see if cloneDrawable is true and clone the drawable.
 * @param cloneDrawable - whether to clone the drawable found
 * @param paint - the paint to initialize the new color drawable with
 * @param drawable - the drawable from an object
 * @return - fully created drawable
 */
public static Drawable getDrawable(boolean cloneDrawable,int paint,Drawable drawable){
  Drawable retDrawable;
  if (drawable == null || drawable instanceof ColorDrawable) {
    retDrawable=new ColorDrawable(paint);
  }
 else   if (cloneDrawable) {
    retDrawable=drawable.getConstantState().newDrawable();
  }
 else {
    retDrawable=drawable;
  }
  return retDrawable;
}