nus-yam/ex-repair huggingface dataset:
Program: 164803
Project: 164803
Buggy source:
void instantiateWithInjectableValues(@Nonnull Object testClassInstance){
  if (isAvailableDuringSetup() && getFieldValue(testedField,testClassInstance) != null) {
    return;
  }
  Object testedObject=null;
  if (!createAutomatically) {
    testedObject=getFieldValue(testedField,testClassInstance);
    createAutomatically=testedObject == null && !isFinal(testedField.getModifiers());
  }
  injectionState.setTestedField(testedField);
  Class<?> testedClass;
  if (createAutomatically) {
    testedClass=testedField.getType();
    testedObject=testedObjectCreation.create();
    setFieldValue(testedField,testClassInstance,testedObject);
  }
 else {
    testedClass=testedObject == null ? null : testedObject.getClass();
  }
  if (testedObject != null) {
    FieldInjection fieldInjection=new FieldInjection(this,testedClass,metadata.fullyInitialized());
    if (targetFields == null) {
      targetFields=fieldInjection.findAllTargetInstanceFieldsInTestedClassHierarchy(testedClass);
    }
    fieldInjection.injectIntoEligibleFields(targetFields,testedObject);
    if (createAutomatically) {
      injectionState.lifecycleMethods.executePostConstructMethodIfAny(testedClass,testedObject);
    }
  }
}

Fixed version (ground truth):
void instantiateWithInjectableValues(@Nonnull Object testClassInstance){
  if (isAvailableDuringSetup() && getFieldValue(testedField,testClassInstance) != null) {
    return;
  }
  Object testedObject=null;
  if (!createAutomatically) {
    testedObject=getFieldValue(testedField,testClassInstance);
    createAutomatically=testedObject == null && !isFinal(testedField.getModifiers());
  }
  injectionState.setTestedField(testedField);
  Class<?> testedClass;
  if (createAutomatically) {
    testedClass=testedField.getType();
    testedObject=testedObjectCreation.create();
    setFieldValue(testedField,testClassInstance,testedObject);
  }
 else {
    testedClass=testedObject == null ? null : testedObject.getClass();
  }
  if (testedObject != null) {
    FieldInjection fieldInjection=new FieldInjection(this,testedClass,metadata.fullyInitialized());
    if (targetFields == null) {
      targetFields=fieldInjection.findAllTargetInstanceFieldsInTestedClassHierarchy(testedClass);
      requireDIAnnotation=fieldInjection.requireDIAnnotation;
    }
    fieldInjection.injectIntoEligibleFields(targetFields,testedObject);
    if (createAutomatically) {
      injectionState.lifecycleMethods.executePostConstructMethodIfAny(testedClass,testedObject);
    }
  }
}
Program: 164804
Project: 164804
Buggy source:
public void loadAgent(){
  VirtualMachine vm;
  if (AttachProvider.providers().isEmpty()) {
    String vmName=System.getProperty("String_Node_Str");
    if (vmName.contains("String_Node_Str")) {
      vm=getVirtualMachineImplementationFromEmbeddedOnes();
    }
 else {
      String helpMessage=getHelpMessageForNonHotSpotVM(vmName);
      throw new IllegalStateException(helpMessage);
    }
  }
 else {
    vm=attachToRunningVM();
  }
  loadAgentAndDetachFromRunningVM(vm);
}

Fixed version (ground truth):
public void loadAgent(){
  VirtualMachine vm;
  if (AttachProvider.providers().isEmpty()) {
    if (HOTSPOT_VM) {
      vm=getVirtualMachineImplementationFromEmbeddedOnes();
    }
 else {
      String helpMessage=getHelpMessageForNonHotSpotVM();
      throw new IllegalStateException(helpMessage);
    }
  }
 else {
    vm=attachToRunningVM();
  }
  loadAgentAndDetachFromRunningVM(vm);
}
Program: 164805
Project: 164805
Buggy source:
@Nonnull private String getHelpMessageForNonHotSpotVM(@Nonnull String vmName){
  String helpMessage="String_Node_Str" + vmName;
  if (vmName.contains("String_Node_Str")) {
    helpMessage+="String_Node_Str";
  }
  return helpMessage + "String_Node_Str" + jarFilePath;
}

Fixed version (ground truth):
@Nonnull private String getHelpMessageForNonHotSpotVM(){
  String vmName=System.getProperty("String_Node_Str");
  String helpMessage="String_Node_Str" + vmName;
  if (vmName.contains("String_Node_Str")) {
    helpMessage+="String_Node_Str";
  }
  return helpMessage + "String_Node_Str" + jarFilePath;
}
Program: 164806
Project: 164806
Buggy source:
boolean hasUnusedMocks(){
  for (  MockMethod method : methods) {
    if (!method.hasMatchingRealMethod) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
boolean hasUnusedMocks(){
  if (adviceMethod != null) {
    return true;
  }
  for (  MockMethod method : methods) {
    if (!method.hasMatchingRealMethod) {
      return true;
    }
  }
  return false;
}
Program: 164807
Project: 164807
Buggy source:
@Override public void visitLocalVariable(@Nonnull String name,@Nonnull String desc,@Nullable String signature,@Nonnull Label start,@Nonnull Label end,int index){
  int parameterIndex=index;
  if ("String_Node_Str".equals(previousDesc) || "String_Node_Str".equals(previousDesc)) {
    parameterIndex=previousIndex + 1;
  }
  ParameterNames.registerName(classDesc,methodAccess,methodName,methodDesc,name,parameterIndex);
  previousIndex=parameterIndex;
  previousDesc=desc;
}

Fixed version (ground truth):
@Override public void visitLocalVariable(@Nonnull String name,String desc,String signature,Label start,Label end,int index){
  ParameterNames.registerName(classDesc,methodName,methodDesc,name);
}
Program: 164808
Project: 164808
Buggy source:
@Nullable @Override public MethodVisitor visitMethod(int access,@Nonnull String name,@Nonnull String desc,@Nullable String signature,@Nullable String[] exceptions){
  if ((access & ACC_SYNTHETIC) == 0) {
    boolean visitingAMethod=name.charAt(0) != '<';
    if (visitingAMethod == forMethods) {
      methodAccess=access;
      methodName=name;
      methodDesc=desc;
      return new MethodOrConstructorVisitor();
    }
  }
  return null;
}

Fixed version (ground truth):
@Nullable @Override public MethodVisitor visitMethod(int access,@Nonnull String name,@Nonnull String desc,@Nullable String signature,@Nullable String[] exceptions){
  if ((access & ACC_SYNTHETIC) == 0) {
    boolean visitingAMethod=name.charAt(0) != '<';
    if (visitingAMethod == forMethods) {
      methodName=name;
      methodDesc=desc;
      return new MethodOrConstructorVisitor();
    }
  }
  return null;
}
Program: 164809
Project: 164809
Buggy source:
@Override public void visitLocalVariable(@Nonnull String name,@Nonnull String desc,@Nullable String signature,@Nonnull Label start,@Nonnull Label end,int index){
  String classDesc=mockMethods.getMockClassInternalName();
  ParameterNames.registerName(classDesc,access,methodName,methodDesc,name,index);
}

Fixed version (ground truth):
@Override public void visitLocalVariable(@Nonnull String name,String desc,String signature,Label start,Label end,int index){
  String classDesc=mockMethods.getMockClassInternalName();
  ParameterNames.registerName(classDesc,methodName,methodDesc,name);
}
Program: 164810
Project: 164810
Buggy source:
/** 
 * Adds the method specified to the set of mock methods, as long as it's annotated with   {@code @Mock}.
 * @param methodSignature generic signature for a Java 5 generic method, ignored since redefinition only needs toconsider the "erased" signature
 * @param exceptions zero or more thrown exceptions in the method "throws" clause, also ignored
 */
@SuppressWarnings("String_Node_Str") @Nullable @Override public MethodVisitor visitMethod(final int access,@Nonnull final String methodName,@Nonnull final String methodDesc,@Nullable String methodSignature,@Nullable String[] exceptions){
  if ((access & INVALID_METHOD_ACCESSES) != 0) {
    return null;
  }
  if ("String_Node_Str".equals(methodName)) {
    if (!collectingFromSuperClass && methodDesc.equals(enclosingClassDescriptor)) {
      enclosingClassDescriptor=null;
    }
    return null;
  }
  return new MethodVisitor(){
    @Override @Nullable public AnnotationVisitor visitAnnotation(    String desc,    boolean visible){
      if ("String_Node_Str".equals(desc)) {
        MockMethods.MockMethod mockMethod=mockMethods.addMethod(collectingFromSuperClass,access,methodName,methodDesc);
        if (mockMethod != null) {
          return new MockAnnotationVisitor(mockMethod);
        }
      }
      return null;
    }
    @Override public void visitLocalVariable(    @Nonnull String name,    @Nonnull String desc,    @Nullable String signature,    @Nonnull Label start,    @Nonnull Label end,    int index){
      String classDesc=mockMethods.getMockClassInternalName();
      ParameterNames.registerName(classDesc,access,methodName,methodDesc,name,index);
    }
  }
;
}

Fixed version (ground truth):
/** 
 * Adds the method specified to the set of mock methods, as long as it's annotated with   {@code @Mock}.
 * @param methodSignature generic signature for a Java 5 generic method, ignored since redefinition only needs toconsider the "erased" signature
 * @param exceptions zero or more thrown exceptions in the method "throws" clause, also ignored
 */
@SuppressWarnings("String_Node_Str") @Nullable @Override public MethodVisitor visitMethod(int access,@Nonnull String methodName,@Nonnull String methodDesc,String methodSignature,String[] exceptions){
  if ((access & INVALID_METHOD_ACCESSES) != 0) {
    return null;
  }
  if ("String_Node_Str".equals(methodName)) {
    if (!collectingFromSuperClass && methodDesc.equals(enclosingClassDescriptor)) {
      enclosingClassDescriptor=null;
    }
    return null;
  }
  return new MockMethodVisitor(access,methodName,methodDesc);
}
Program: 164811
Project: 164811
Buggy source:
@Override @Nullable public AnnotationVisitor visitAnnotation(String desc,boolean visible){
  if ("String_Node_Str".equals(desc)) {
    MockMethods.MockMethod mockMethod=mockMethods.addMethod(collectingFromSuperClass,access,methodName,methodDesc);
    if (mockMethod != null) {
      return new MockAnnotationVisitor(mockMethod);
    }
  }
  return null;
}

Fixed version (ground truth):
@Nullable @Override public AnnotationVisitor visitAnnotation(@Nullable String desc,boolean visible){
  if ("String_Node_Str".equals(desc)) {
    MockMethods.MockMethod mockMethod=mockMethods.addMethod(collectingFromSuperClass,access,methodName,methodDesc);
    if (mockMethod != null) {
      return new MockAnnotationVisitor(mockMethod);
    }
  }
  return null;
}
Program: 164812
Project: 164812
Buggy source:
public static void registerName(@Nonnull String classDesc,int methodAccess,@Nonnull String methodName,@Nonnull String methodDesc,@Nonnull String name,int index){
  if ("String_Node_Str".equals(name)) {
    return;
  }
  Map<String,String[]> methodsToParameters=classesToMethodsToParameters.get(classDesc);
  if (methodsToParameters == null) {
    methodsToParameters=new HashMap<String,String[]>();
    classesToMethodsToParameters.put(classDesc,methodsToParameters);
  }
  String methodKey=methodName + methodDesc;
  String[] parameterNames=methodsToParameters.get(methodKey);
  if (parameterNames == null) {
    int numParameters=Type.getArgumentTypes(methodDesc).length;
    parameterNames=numParameters == 0 ? NO_PARAMETERS : new String[numParameters];
    methodsToParameters.put(methodKey,parameterNames);
  }
  if (!isStatic(methodAccess)) {
    index--;
  }
  if (index < parameterNames.length) {
    parameterNames[index]=name;
  }
}

Fixed version (ground truth):
public static void registerName(@Nonnull String classDesc,@Nonnull String methodName,@Nonnull String methodDesc,@Nonnull String name){
  if ("String_Node_Str".equals(name)) {
    return;
  }
  Map<String,String[]> methodsToParameters=classesToMethodsToParameters.get(classDesc);
  if (methodsToParameters == null) {
    methodsToParameters=new HashMap<String,String[]>();
    classesToMethodsToParameters.put(classDesc,methodsToParameters);
  }
  String methodKey=methodName + methodDesc;
  String[] parameterNames=methodsToParameters.get(methodKey);
  if (parameterNames == null) {
    int numParameters=Type.getArgumentTypes(methodDesc).length;
    parameterNames=numParameters == 0 ? NO_PARAMETERS : new String[numParameters];
    methodsToParameters.put(methodKey,parameterNames);
  }
  for (int i=0, n=parameterNames.length; i < n; i++) {
    if (parameterNames[i] == null) {
      parameterNames[i]=name;
      break;
    }
  }
}
Program: 164813
Project: 164813
Buggy source:
@Test public void verifyInstantiationOfTestedObjectsThroughConstructorsWithNonMockedParameters(){
  assertNotNull(tested0);
  assertNotNull(tested1);
  assertNotNull(tested2);
  assertNotNull(tested3);
  assertNotNull(tested4);
  assertNotNull(tested5);
}

Fixed version (ground truth):
@Test public void verifyInstantiationOfTestedObjectsThroughConstructorsWithNonMockedParameters(){
  assertNotNull(tested0);
  assertNotNull(tested1);
  assertNotNull(tested2);
  assertNotNull(tested3);
  assertNotNull(tested4);
  assertNotNull(tested5);
  assertNotNull(tested6);
}
Program: 164814
Project: 164814
Buggy source:
@Nonnull Object instantiate(@Nonnull List<MockedType> injectablesForConstructor){
  Type[] parameterTypes=constructor.getGenericParameterTypes();
  int n=parameterTypes.length;
  Object[] arguments=n == 0 ? NO_ARGS : new Object[n];
  boolean varArgs=constructor.isVarArgs();
  if (varArgs) {
    n--;
  }
  for (int i=0; i < n; i++) {
    MockedType injectable=injectablesForConstructor.get(i);
    Object value=getArgumentValueToInject(injectable);
    arguments[i]=wrapInProviderIfNeeded(parameterTypes[i],value);
  }
  if (varArgs) {
    arguments[n]=obtainInjectedVarargsArray(parameterTypes,n);
  }
  return invoke(constructor,arguments);
}

Fixed version (ground truth):
@Nonnull Object instantiate(@Nonnull List<MockedType> injectablesForConstructor){
  Type[] parameterTypes=constructor.getGenericParameterTypes();
  int n=parameterTypes.length;
  Object[] arguments=n == 0 ? NO_ARGS : new Object[n];
  boolean varArgs=constructor.isVarArgs();
  if (varArgs) {
    n--;
  }
  for (int i=0; i < n; i++) {
    MockedType injectable=injectablesForConstructor.get(i);
    Object value=getArgumentValueToInject(injectable);
    arguments[i]=wrapInProviderIfNeeded(parameterTypes[i],value);
  }
  if (varArgs) {
    arguments[n]=obtainInjectedVarargsArray(parameterTypes,n);
  }
  TestRun.exitNoMockingZone();
  try {
    return invoke(constructor,arguments);
  }
  finally {
    TestRun.enterNoMockingZone();
  }
}
Program: 164815
Project: 164815
Buggy source:
public TestedClass(GenericClass<String> go,List<Integer> values,Callable<Number>... actions){
  this.go=go;
  this.values=values;
  action1=actions[0];
  if (actions.length > 1)   action2=actions[1];
  if (actions.length > 2)   action3=actions[2];
}

Fixed version (ground truth):
public TestedClass(GenericClass<String> go,List<Integer> values,Callable<Number>... actions){
  this.go=go;
  this.values=values;
  action1=actions[0];
  if (actions.length > 1)   action2=actions[1];
  if (actions.length > 2)   action3=actions[2];
  try {
    InitialContext context=new InitialContext();
    database=(DataSource)context.lookup("String_Node_Str");
    context.close();
  }
 catch (  NamingException e) {
    throw new RuntimeException(e);
  }
}
Program: 164816
Project: 164816
Buggy source:
@Before public void recordCommonExpectations(){
  new NonStrictExpectations(){
{
      mockGO.doSomething();
      result="String_Node_Str";
    }
  }
;
}

Fixed version (ground truth):
@Before public void recordCommonExpectations() throws Exception {
  new NonStrictExpectations(){
{
      mockGO.doSomething();
      result="String_Node_Str";
    }
  }
;
  new NonStrictExpectations(){
{
      jndiContext.lookup("String_Node_Str");
      result=testDB;
    }
  }
;
}
Program: 164817
Project: 164817
Buggy source:
protected static boolean notToBeMocked(@Nullable Object mocked,@Nonnull String mockedClassDesc){
  Thread currentThread=Thread.currentThread();
  if ("String_Node_Str".equals(currentThread.getClass().getName())) {
    return true;
  }
  if ("String_Node_Str".equals(currentThread.getName())) {
    return true;
  }
  return (mocked == null && "String_Node_Str".equals(mockedClassDesc) || mocked != null && instanceOfClassThatParticipatesInClassLoading(mocked.getClass())) && wasCalledDuringClassLoading();
}

Fixed version (ground truth):
protected static boolean notToBeMocked(@Nullable Object mocked,@Nonnull String mockedClassDesc){
  return (mocked == null && "String_Node_Str".equals(mockedClassDesc) || mocked != null && instanceOfClassThatParticipatesInClassLoading(mocked.getClass())) && wasCalledDuringClassLoading();
}
Program: 164818
Project: 164818
Buggy source:
@Nullable @Override public Object invoke(@Nullable Object mocked,Method method,@Nonnull Object[] args) throws Throwable {
  String mockedClassDesc=(String)args[1];
  if (notToBeMocked(mocked,mockedClassDesc)) {
    return Void.class;
  }
  String mockName=(String)args[2];
  String mockDesc=(String)args[3];
  String mockNameAndDesc=mockName + mockDesc;
  Integer executionMode=(Integer)args[5];
  Object[] mockArgs=extractMockArguments(6,args);
  boolean regularExecutionWithRecordReplayLock=executionMode == ExecutionMode.Regular.ordinal() && RECORD_OR_REPLAY_LOCK.isHeldByCurrentThread();
  Object rv;
  if (regularExecutionWithRecordReplayLock && mocked != null) {
    rv=ObjectMethods.evaluateOverride(mocked,mockNameAndDesc,args);
    if (rv != null) {
      return rv;
    }
  }
  if (TestRun.getExecutingTest().isProceedingIntoRealImplementation() || regularExecutionWithRecordReplayLock || TestRun.isInsideNoMockingZone()) {
    return Void.class;
  }
  TestRun.enterNoMockingZone();
  try {
    int mockAccess=(Integer)args[0];
    String genericSignature=(String)args[4];
    rv=recordOrReplay(mocked,mockAccess,mockedClassDesc,mockNameAndDesc,genericSignature,executionMode,mockArgs);
  }
  finally {
    TestRun.exitNoMockingZone();
  }
  return rv;
}

Fixed version (ground truth):
@Nullable @Override public Object invoke(@Nullable Object mocked,Method method,@Nonnull Object[] args) throws Throwable {
  String mockedClassDesc=(String)args[1];
  if (calledFromSpecialThread() || notToBeMocked(mocked,mockedClassDesc)) {
    return Void.class;
  }
  String mockName=(String)args[2];
  String mockDesc=(String)args[3];
  String mockNameAndDesc=mockName + mockDesc;
  Integer executionMode=(Integer)args[5];
  Object[] mockArgs=extractMockArguments(6,args);
  boolean regularExecutionWithRecordReplayLock=executionMode == ExecutionMode.Regular.ordinal() && RECORD_OR_REPLAY_LOCK.isHeldByCurrentThread();
  Object rv;
  if (regularExecutionWithRecordReplayLock && mocked != null) {
    rv=ObjectMethods.evaluateOverride(mocked,mockNameAndDesc,args);
    if (rv != null) {
      return rv;
    }
  }
  if (TestRun.getExecutingTest().isProceedingIntoRealImplementation() || regularExecutionWithRecordReplayLock || TestRun.isInsideNoMockingZone()) {
    return Void.class;
  }
  TestRun.enterNoMockingZone();
  try {
    int mockAccess=(Integer)args[0];
    String genericSignature=(String)args[4];
    rv=recordOrReplay(mocked,mockAccess,mockedClassDesc,mockNameAndDesc,genericSignature,executionMode,mockArgs);
  }
  finally {
    TestRun.exitNoMockingZone();
  }
  return rv;
}
Program: 164819
Project: 164819
Buggy source:
@Nullable @Override public Object invoke(@Nullable Object mockedInstance,Method method,@Nonnull Object[] args) throws Throwable {
  String mockClassDesc=(String)args[0];
  String mockedClassDesc=(String)args[1];
  String mockDesc=(String)args[4];
  Object mockUp=TestRun.getMock(mockClassDesc,mockedInstance);
  if (mockUp == null || notToBeMocked(mockedInstance,mockedClassDesc)) {
    Integer mockedAccess=(Integer)args[2];
    return isNative(mockedAccess) ? DefaultValues.computeForReturnType(mockDesc) : Void.class;
  }
  String mockName=(String)args[3];
  int mockStateIndex=(Integer)args[5];
  Object[] mockArgs=extractMockArguments(6,args);
  return callMock(mockedInstance,mockUp,mockedClassDesc,mockName,mockDesc,mockStateIndex,mockArgs);
}

Fixed version (ground truth):
@Nullable @Override public Object invoke(@Nullable Object mockedInstance,Method method,@Nonnull Object[] args) throws Throwable {
  String mockClassDesc=(String)args[0];
  String mockedClassDesc=(String)args[1];
  String mockDesc=(String)args[4];
  Object mockUp=TestRun.getMock(mockClassDesc,mockedInstance);
  if (mockUp == null || notToBeMocked(mockedInstance,mockedClassDesc)) {
    return DefaultValues.computeForReturnType(mockDesc);
  }
  String mockName=(String)args[3];
  int mockStateIndex=(Integer)args[5];
  Object[] mockArgs=extractMockArguments(6,args);
  return callMock(mockedInstance,mockUp,mockedClassDesc,mockName,mockDesc,mockStateIndex,mockArgs);
}
Program: 164820
Project: 164820
Buggy source:
@Mock void run(){
}

Fixed version (ground truth):
@Override public void run(){
  boolean hasAccess=Collaborator.doSomethingElse();
  assertTrue(hasAccess);
}
Program: 164821
Project: 164821
Buggy source:
@Mock boolean doSomethingElse(Invocation inv){
  return true;
}

Fixed version (ground truth):
@Mock boolean doSomethingElse(){
  return true;
}
Program: 164822
Project: 164822
Buggy source:
@Nonnull Member getRealMethodOrConstructor(@Nonnull String mockedClassDesc,@Nonnull String mockedMethodName,@Nonnull String mockedMethodDesc){
  if (realMethodOrConstructor == null) {
    String memberName="String_Node_Str".equals(mockedMethodName) ? "String_Node_Str" : mockedMethodName;
    RealMethodOrConstructor realMember;
    try {
      realMember=new RealMethodOrConstructor(mockedClassDesc,memberName,mockedMethodDesc);
    }
 catch (    NoSuchMethodException e) {
      throw new RuntimeException(e);
    }
    Member member=realMember.getMember();
    if (mockMethod.isAdvice) {
      return member;
    }
    realMethodOrConstructor=member;
  }
  return realMethodOrConstructor;
}

Fixed version (ground truth):
@Nonnull Member getRealMethodOrConstructor(@Nonnull String mockedClassDesc,@Nonnull String mockedMethodName,@Nonnull String mockedMethodDesc){
  if (realMethodOrConstructor == null || !mockedClassDesc.equals(realClassDesc)) {
    String memberName="String_Node_Str".equals(mockedMethodName) ? "String_Node_Str" : mockedMethodName;
    RealMethodOrConstructor realMember;
    try {
      realMember=new RealMethodOrConstructor(mockedClassDesc,memberName,mockedMethodDesc);
    }
 catch (    NoSuchMethodException e) {
      throw new RuntimeException(e);
    }
    Member member=realMember.getMember();
    if (mockMethod.isAdvice) {
      return member;
    }
    realMethodOrConstructor=member;
    realClassDesc=mockedClassDesc;
  }
  return realMethodOrConstructor;
}
Program: 164823
Project: 164823
Buggy source:
InterfaceInstanceFactory(@NotNull Object emptyProxy){
  this.emptyProxy=emptyProxy;
}

Fixed version (ground truth):
InterfaceInstanceFactory(@NotNull Object emptyProxy){
  super(emptyProxy.getClass());
  this.emptyProxy=emptyProxy;
}
Program: 164824
Project: 164824
Buggy source:
ClassInstanceFactory(@NotNull Class<?> concreteClass){
  this.concreteClass=concreteClass;
}

Fixed version (ground truth):
ClassInstanceFactory(@NotNull Class<?> concreteClass){
  super(concreteClass);
}
Program: 164825
Project: 164825
Buggy source:
public final void clearLastInstance(){
  lastInstance=null;
}

Fixed version (ground truth):
@Override public void clearLastInstance(){
  lastInstance=null;
}
Program: 164826
Project: 164826
Buggy source:
Baz getBaz(){
  return null;
}

Fixed version (ground truth):
Baz getBaz(@SuppressWarnings("String_Node_Str") int i){
  return null;
}
Program: 164827
Project: 164827
Buggy source:
@Nullable private MockUp<?> findPreviouslyMockedClassIfMockUpAlreadyApplied(){
  MockUpInstances mockUpInstances=TestRun.getMockClasses().findPreviouslyAppliedMockUps(this);
  if (mockUpInstances != null) {
    if (mockUpInstances.hasMockUpsForSingleInstances()) {
      return mockUpInstances.initialMockUp;
    }
    tearDown();
  }
  return null;
}

Fixed version (ground truth):
@Nullable private MockUp<?> findPreviouslyMockedClassIfMockUpAlreadyApplied(){
  MockUpInstances mockUpInstances=TestRun.getMockClasses().findPreviouslyAppliedMockUps(this);
  if (mockUpInstances != null) {
    MockUp<?> previousMockUp=mockUpInstances.initialMockUp;
    if (mockUpInstances.hasMockUpsForSingleInstances()) {
      return previousMockUp;
    }
    previousMockUp.tearDown();
  }
  return null;
}
Program: 164828
Project: 164828
Buggy source:
@NotNull public Type resolveReturnType(@NotNull TypeVariable<?> genericReturnType){
  Type typeArgument=typeParametersToTypeArguments.get(genericReturnType.getName());
  if (typeArgument == null) {
    typeArgument=genericReturnType.getBounds()[0];
  }
  return typeArgument;
}

Fixed version (ground truth):
@NotNull public Type resolveReturnType(@NotNull TypeVariable<?> genericReturnType){
  Type typeArgument=typeParametersToTypeArguments.get(genericReturnType.getName());
  if (typeArgument == null) {
    typeArgument=genericReturnType.getBounds()[0];
    if (typeArgument instanceof TypeVariable<?>) {
      typeArgument=resolveReturnType((TypeVariable<?>)typeArgument);
    }
  }
  return typeArgument;
}
Program: 164829
Project: 164829
Buggy source:
@Nullable private static String getGenericReturnTypeWithTypeArguments(@NotNull String genericSignature,@NotNull ParameterizedType mockedGenericType){
  String typeName=getInternalTypeName(genericSignature);
  if (typeName.charAt(0) == 'T') {
    typeName=typeName.substring(1);
  }
  TypeVariable<?>[] typeParameters=((GenericDeclaration)mockedGenericType.getRawType()).getTypeParameters();
  Type[] actualTypeArguments=mockedGenericType.getActualTypeArguments();
  for (int i=0; i < typeParameters.length; i++) {
    TypeVariable<?> typeParameter=typeParameters[i];
    if (typeName.equals(typeParameter.getName())) {
      Type actualType=actualTypeArguments[i];
      Class<?> actualClass;
      if (actualType instanceof Class<?>) {
        actualClass=(Class<?>)actualType;
      }
 else       if (actualType instanceof WildcardType) {
        actualClass=(Class<?>)((WildcardType)actualType).getUpperBounds()[0];
      }
 else       if (actualType instanceof GenericArrayType) {
        Class<?> componentClass=getClassType((GenericArrayType)actualType);
        return getInternalName(componentClass);
      }
 else {
        return null;
      }
      return getReturnTypeIfCascadingSupportedForIt(actualClass);
    }
  }
  return null;
}

Fixed version (ground truth):
@Nullable private static String getGenericReturnTypeWithTypeArguments(@NotNull String genericSignature,@NotNull ParameterizedType mockedGenericType){
  String typeCodeAndName=getInternalReturnTypeCodeAndName(genericSignature);
  char typeCode=typeCodeAndName.charAt(0);
  String typeName=typeCodeAndName.substring(1);
  if (typeCode == 'L') {
    return isTypeSupportedForCascading(typeName) ? typeName : null;
  }
  TypeVariable<?>[] typeParameters=((GenericDeclaration)mockedGenericType.getRawType()).getTypeParameters();
  Type[] actualTypeArguments=mockedGenericType.getActualTypeArguments();
  for (int i=0; i < typeParameters.length; i++) {
    TypeVariable<?> typeParameter=typeParameters[i];
    if (typeName.equals(typeParameter.getName())) {
      Type actualType=actualTypeArguments[i];
      Class<?> actualClass;
      if (actualType instanceof Class<?>) {
        actualClass=(Class<?>)actualType;
      }
 else       if (actualType instanceof WildcardType) {
        actualClass=(Class<?>)((WildcardType)actualType).getUpperBounds()[0];
      }
 else       if (actualType instanceof GenericArrayType) {
        Class<?> componentClass=getClassType((GenericArrayType)actualType);
        return getInternalName(componentClass);
      }
 else {
        return null;
      }
      return getReturnTypeIfCascadingSupportedForIt(actualClass);
    }
  }
  return null;
}
Program: 164830
Project: 164830
Buggy source:
@NotNull private static String getInternalTypeName(@NotNull String typeDesc){
  int p=typeDesc.indexOf('(');
  return typeDesc.substring(p + 2,typeDesc.length() - 1);
}

Fixed version (ground truth):
@NotNull private static String getInternalTypeName(@NotNull String typeDesc){
  return typeDesc.substring(1,typeDesc.length() - 1);
}
Program: 164831
Project: 164831
Buggy source:
public CustomRunner(Class<?> klass) throws InitializationError {
  super(klass);
}

Fixed version (ground truth):
public CustomRunner(Class<?> testClass) throws InitializationError {
  super(testClass);
}
Program: 164832
Project: 164832
Buggy source:
private void appendToFormattedLine(@NotNull LineElement firstElement,@NotNull LineSegmentData segmentData){
  if (firstElement == element) {
    return;
  }
  appendStartTag(segmentData);
  firstElement.appendAllBefore(line,element);
  appendEndTag(segmentData);
  segmentIndex++;
}

Fixed version (ground truth):
private void appendToFormattedLine(@NotNull LineElement firstElement,@NotNull LineSegmentData segmentData){
  if (firstElement == element) {
    return;
  }
  if (element == null && !firstElement.containsExecutableCodeBeforeEndOfLine()) {
    firstElement.appendAllBefore(line,null);
  }
 else {
    appendStartTag(segmentData);
    firstElement.appendAllBefore(line,element);
    appendEndTag(segmentData);
  }
  segmentIndex++;
}
Program: 164833
Project: 164833
Buggy source:
private static boolean isTestMethod(@NotNull StackTraceElement ste){
  if (ste.getClassName() == null || ste.getMethodName() == null) {
    return false;
  }
  if (steCache.containsKey(ste)) {
    return steCache.get(ste);
  }
  if (ste.getFileName() == null || ste.getLineNumber() < 0) {
    steCache.put(ste,false);
    return false;
  }
  Class<?> aClass=loadClass(ste.getClassName());
  Method method=findMethod(aClass,ste.getMethodName());
  if (method == null) {
    steCache.put(ste,false);
    return false;
  }
  boolean isTestMethod=checkTestAnnotationOnClass && aClass.isAnnotationPresent(testAnnotation) || containsATestFrameworkAnnotation(method.getDeclaredAnnotations()) || checkIfTestCaseSubclass && isJUnit3xTestMethod(aClass,method);
  steCache.put(ste,isTestMethod);
  return isTestMethod;
}

Fixed version (ground truth):
private static boolean isTestMethod(@NotNull StackTraceElement ste){
  String className=ste.getClassName();
  String methodName=ste.getMethodName();
  if (className == null || methodName == null) {
    return false;
  }
  if (steCache.containsKey(ste)) {
    return steCache.get(ste);
  }
  boolean isTestMethod=false;
  if (ste.getFileName() != null && ste.getLineNumber() >= 0 && !className.startsWith("String_Node_Str") && !className.startsWith("String_Node_Str") && !className.startsWith("String_Node_Str") && !className.startsWith("String_Node_Str") && !className.startsWith("String_Node_Str") && !className.startsWith("String_Node_Str")) {
    Class<?> aClass=loadClass(className);
    if (aClass != null) {
      if (checkTestAnnotationOnClass && aClass.isAnnotationPresent(testAnnotation)) {
        isTestMethod=true;
      }
 else {
        Method method=findMethod(aClass,methodName);
        if (method != null) {
          isTestMethod=containsATestFrameworkAnnotation(method.getDeclaredAnnotations()) || checkIfTestCaseSubclass && isJUnit3xTestMethod(aClass,method);
        }
      }
    }
  }
  steCache.put(ste,isTestMethod);
  return isTestMethod;
}
Program: 164834
Project: 164834
Buggy source:
@Nullable private static Method findMethod(@NotNull Class<?> aClass,@NotNull String name){
  try {
    for (    Method method : aClass.getDeclaredMethods()) {
      if (isPublic(method.getModifiers()) && method.getReturnType() == void.class && name.equals(method.getName())) {
        return method;
      }
    }
  }
 catch (  NoClassDefFoundError e) {
    System.out.println(e + "String_Node_Str" + name+ "String_Node_Str"+ aClass);
  }
  return null;
}

Fixed version (ground truth):
@Nullable private static Method findMethod(@NotNull Class<?> aClass,@NotNull String name){
  try {
    for (    Method method : aClass.getDeclaredMethods()) {
      if (method.getReturnType() == void.class && name.equals(method.getName())) {
        return method;
      }
    }
  }
 catch (  NoClassDefFoundError ignore) {
  }
  return null;
}
Program: 164835
Project: 164835
Buggy source:
@NotNull private static Class<?> loadClass(@NotNull String className){
  try {
    return Class.forName(className);
  }
 catch (  ClassNotFoundException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
@Nullable private static Class<?> loadClass(@NotNull String className){
  try {
    return Class.forName(className);
  }
 catch (  ClassNotFoundException ignore) {
    return null;
  }
catch (  LinkageError ignore) {
    return null;
  }
}
Program: 164836
Project: 164836
Buggy source:
private static boolean isJUnit3xTestMethod(@NotNull Class<?> aClass,@NotNull Method method){
  if (!method.getName().startsWith("String_Node_Str")) {
    return false;
  }
  Class<?> superClass=aClass.getSuperclass();
  while (superClass != Object.class) {
    if ("String_Node_Str".equals(superClass.getName())) {
      return true;
    }
    superClass=superClass.getSuperclass();
  }
  return false;
}

Fixed version (ground truth):
private static boolean isJUnit3xTestMethod(@NotNull Class<?> aClass,@NotNull Method method){
  if (!isPublic(method.getModifiers()) || !method.getName().startsWith("String_Node_Str")) {
    return false;
  }
  Class<?> superClass=aClass.getSuperclass();
  while (superClass != Object.class) {
    if ("String_Node_Str".equals(superClass.getName())) {
      return true;
    }
    superClass=superClass.getSuperclass();
  }
  return false;
}
Program: 164837
Project: 164837
Buggy source:
public void insertListOfCallPoints(@Nullable List<CallPoint> callPoints){
  if (callPoints == null) {
    return;
  }
  if (content.length() == 0) {
    content.append(EOL).append("String_Node_Str");
  }
  content.append("String_Node_Str").append(EOL);
  CallPoint currentCP=callPoints.get(0);
  appendTestMethod(currentCP.getStackTraceElement());
  appendRepetitionCountIfNeeded(currentCP);
  for (int i=1, n=callPoints.size(); i < n; i++) {
    CallPoint nextCP=callPoints.get(i);
    StackTraceElement ste=nextCP.getStackTraceElement();
    if (nextCP.isSameTestMethod(currentCP)) {
      content.append("String_Node_Str").append(ste.getLineNumber());
    }
 else {
      content.append("String_Node_Str").append(EOL);
      appendTestMethod(ste);
    }
    appendRepetitionCountIfNeeded(nextCP);
    currentCP=nextCP;
  }
  content.append("String_Node_Str").append(EOL).append("String_Node_Str").append(EOL).append("String_Node_Str");
}

Fixed version (ground truth):
public void insertListOfCallPoints(@Nullable List<CallPoint> callPoints){
  if (content.length() == 0) {
    content.append(EOL).append("String_Node_Str");
  }
  content.append("String_Node_Str");
  if (callPoints == null) {
    content.append("String_Node_Str").append(EOL).append("String_Node_Str");
    return;
  }
  content.append(EOL);
  CallPoint currentCP=callPoints.get(0);
  appendTestMethod(currentCP.getStackTraceElement());
  appendRepetitionCountIfNeeded(currentCP);
  for (int i=1, n=callPoints.size(); i < n; i++) {
    CallPoint nextCP=callPoints.get(i);
    StackTraceElement ste=nextCP.getStackTraceElement();
    if (nextCP.isSameTestMethod(currentCP)) {
      content.append("String_Node_Str").append(ste.getLineNumber());
    }
 else {
      content.append("String_Node_Str").append(EOL);
      appendTestMethod(ste);
    }
    appendRepetitionCountIfNeeded(nextCP);
    currentCP=nextCP;
  }
  content.append("String_Node_Str").append(EOL).append("String_Node_Str").append(EOL).append("String_Node_Str");
}
Program: 164838
Project: 164838
Buggy source:
@Override public void visit(int version,int access,@NotNull String name,@Nullable String signature,@Nullable String superName,@Nullable String[] interfaces){
  interfaceName=name;
  String classSignature=signature + mockedTypeInfo.implementationSignature;
  super.visit(version,access,name,classSignature,superName,interfaces);
}

Fixed version (ground truth):
@Override public void visit(int version,int access,@NotNull String name,@Nullable String signature,@Nullable String superName,@Nullable String[] interfaces){
  interfaceName=name;
  String classSignature=signature == null ? null : signature + mockedTypeInfo.implementationSignature;
  super.visit(version,access,name,classSignature,superName,interfaces);
}
Program: 164839
Project: 164839
Buggy source:
LineSegmentsFormatter(boolean withCallPoints,@NotNull StringBuilder line){
  listOfCallPoints=withCallPoints ? new ListOfCallPoints() : null;
  this.line=line;
}

Fixed version (ground truth):
LineSegmentsFormatter(boolean withCallPoints,@NotNull StringBuilder formattedLine){
  listOfCallPoints=withCallPoints ? new ListOfCallPoints() : null;
  this.formattedLine=formattedLine;
}
Program: 164840
Project: 164840
Buggy source:
private void appendStartTag(@NotNull LineSegmentData segmentData){
  line.append("String_Node_Str").append(lineNumber).append('s').append(segmentIndex).append("String_Node_Str");
  appendTooltipWithExecutionCounts(segmentData);
  if (segmentData.isCovered()) {
    if (segmentData.containsCallPoints()) {
      line.append("String_Node_Str").append(segmentIndex).append("String_Node_Str");
    }
 else {
      line.append("String_Node_Str");
    }
  }
 else {
    line.append("String_Node_Str");
  }
}

Fixed version (ground truth):
private void appendStartTag(){
  formattedLine.append("String_Node_Str").append(lineNumber).append('s').append(segmentIndex);
  formattedLine.append("String_Node_Str").append(segmentData.getExecutionCount()).append("String_Node_Str");
  if (segmentData.isCovered()) {
    if (segmentData.containsCallPoints()) {
      formattedLine.append("String_Node_Str").append(segmentIndex).append("String_Node_Str");
    }
 else {
      formattedLine.append("String_Node_Str");
    }
  }
 else {
    formattedLine.append("String_Node_Str");
  }
}
Program: 164841
Project: 164841
Buggy source:
private void appendEndTag(@NotNull LineSegmentData segmentData){
  int i=line.length() - 1;
  while (isWhitespace(line.charAt(i))) {
    i--;
  }
  line.insert(i + 1,"String_Node_Str");
  if (listOfCallPoints != null) {
    List<CallPoint> callPoints=segmentData.getCallPoints();
    listOfCallPoints.insertListOfCallPoints(callPoints);
  }
}

Fixed version (ground truth):
private void appendEndTag(){
  int i=formattedLine.length() - 1;
  while (isWhitespace(formattedLine.charAt(i))) {
    i--;
  }
  formattedLine.insert(i + 1,"String_Node_Str");
  if (listOfCallPoints != null) {
    List<CallPoint> callPoints=segmentData.getCallPoints();
    listOfCallPoints.insertListOfCallPoints(callPoints);
  }
}
Program: 164842
Project: 164842
Buggy source:
private void appendToFormattedLine(@NotNull LineElement firstElement,@NotNull LineSegmentData segmentData){
  if (firstElement == element) {
    return;
  }
  appendStartTag(segmentData);
  firstElement.appendAllBefore(line,element);
  appendEndTag(segmentData);
  segmentIndex++;
}

Fixed version (ground truth):
private void appendToFormattedLine(@NotNull LineElement firstElement){
  if (firstElement != element) {
    appendStartTag();
    firstElement.appendAllBefore(formattedLine,element);
    appendEndTag();
    segmentIndex++;
  }
}
Program: 164843
Project: 164843
Buggy source:
void formatSegments(@NotNull LineParser lineParser,@NotNull LineCoverageData lineData){
  lineNumber=lineParser.getNumber();
  List<BranchCoverageData> branchData=lineData.getBranches();
  int numSegments=lineData.getNumberOfSegments();
  element=lineParser.getInitialElement().appendUntilNextCodeElement(line);
  segmentIndex=0;
  appendUntilFirstElementAfterNextBranchingPoint(lineData);
  while (element != null && segmentIndex < numSegments) {
    LineSegmentData segmentData=segmentIndex == 0 ? lineData : branchData.get(segmentIndex - 1);
    element=element.appendUntilNextCodeElement(line);
    appendUntilFirstElementAfterNextBranchingPoint(segmentData);
  }
  if (element != null) {
    element.appendAllBefore(line,null);
  }
  line.append("String_Node_Str");
  if (listOfCallPoints != null && lineData.containsCallPoints()) {
    line.append(listOfCallPoints.getContents());
  }
}

Fixed version (ground truth):
void formatSegments(@NotNull LineParser lineParser,@NotNull LineCoverageData lineData){
  lineNumber=lineParser.getNumber();
  List<BranchCoverageData> branchData=lineData.getBranches();
  int numSegments=lineData.getNumberOfSegments();
  element=lineParser.getInitialElement().appendUntilNextCodeElement(formattedLine);
  segmentIndex=0;
  segmentData=lineData;
  appendUntilNextBranchingPoint();
  while (element != null && segmentIndex < numSegments) {
    segmentData=segmentIndex == 0 ? lineData : branchData.get(segmentIndex - 1);
    element=element.appendUntilNextCodeElement(formattedLine);
    appendUntilNextBranchingPoint();
  }
  if (element != null) {
    element.appendAllBefore(formattedLine,null);
  }
  formattedLine.append("String_Node_Str");
  if (listOfCallPoints != null && lineData.containsCallPoints()) {
    formattedLine.append(listOfCallPoints.getContents());
  }
}
Program: 164844
Project: 164844
Buggy source:
@Test public void methodWithTrivialTernaryOperatorAndTrivialIfElse(){
  assertTrue(tested.returnsResultPreviouslyComputedFromInput(false,1));
  assertFalse(tested.returnsResultPreviouslyComputedFromInput(false,0));
  assertTrue(tested.returnsResultPreviouslyComputedFromInput(true,1));
  assertTrue(tested.returnsResultPreviouslyComputedFromInput(true,-1));
  findMethodData(77);
  assertPaths(4,3,4);
  assertPath(12,1);
  assertPath(11,1);
  assertPath(11,0);
  assertPath(10,2);
}

Fixed version (ground truth):
@Test public void methodWithTrivialTernaryOperatorAndTrivialIfElse(){
  assertTrue(tested.returnsResultPreviouslyComputedFromInput(false,1));
  assertFalse(tested.returnsResultPreviouslyComputedFromInput(false,0));
  assertTrue(tested.returnsResultPreviouslyComputedFromInput(true,1));
  assertTrue(tested.returnsResultPreviouslyComputedFromInput(true,-1));
  assertLines(77,86,5);
  assertLine(77,3,3,4,2,2);
  assertLine(80,2,2,4,3);
  assertLine(82,1,1,1);
  assertLine(83,1,1,1);
  assertLine(86,1,1,4);
  findMethodData(77);
  assertPaths(4,3,4);
  assertPath(12,1);
  assertPath(11,1);
  assertPath(11,0);
  assertPath(10,2);
}
Program: 164845
Project: 164845
Buggy source:
private void redefineTargetClassAndCreateInstanceFactory(@NotNull Type typeToMock){
  Integer mockedClassId=redefineClassesFromCache();
  if (mockedClassId == null) {
    return;
  }
  boolean redefined=redefineMethodsAndConstructorsInTargetType();
  if (redefined) {
    instanceFactory=createInstanceFactory(typeToMock);
    storeRedefinedClassesInCache(mockedClassId);
  }
}

Fixed version (ground truth):
private void redefineTargetClassAndCreateInstanceFactory(@NotNull Type typeToMock){
  Integer mockedClassId=redefineClassesFromCache();
  if (mockedClassId == null) {
    return;
  }
  boolean redefined=redefineMethodsAndConstructorsInTargetType();
  instanceFactory=createInstanceFactory(typeToMock);
  if (redefined) {
    storeRedefinedClassesInCache(mockedClassId);
  }
}
Program: 164846
Project: 164846
Buggy source:
@Test public void cascadeOneLevelDuringReplay(@Mocked Foo foo){
  cascadedBar1=foo.getBar();
  assertEquals(0,cascadedBar1.doSomething());
  cascadedBar2=Foo.globalBar();
  assertEquals(0,cascadedBar2.doSomething());
  Bar bar=foo.getBar();
  assertSame(cascadedBar1,bar);
  Bar globalBar=Foo.globalBar();
  assertSame(cascadedBar2,globalBar);
  assertNotSame(bar,globalBar);
  foo.doSomething("String_Node_Str");
  assertEquals(0,foo.getIntValue());
  assertFalse(foo.getBooleanValue());
  assertTrue(foo.getList().isEmpty());
  assertNotNull(foo.returnTypeWithWildcard());
  assertNotNull(foo.returnTypeWithBoundedTypeVariable());
  Entry<Baz,List<Integer>> x=foo.returnTypeWithMultipleTypeVariables();
  assertNotNull(x);
  HashMap<?,?> map=foo.getMap();
  assertNull(map);
}

Fixed version (ground truth):
@Test public void cascadeOneLevelDuringReplay(@Mocked Foo foo){
  cascadedBar1=foo.getBar();
  assertEquals(0,cascadedBar1.doSomething());
  cascadedBar2=Foo.globalBar();
  assertEquals(0,cascadedBar2.doSomething());
  Bar bar=foo.getBar();
  assertSame(cascadedBar1,bar);
  Bar globalBar=Foo.globalBar();
  assertSame(cascadedBar2,globalBar);
  assertNotSame(bar,globalBar);
  foo.doSomething("String_Node_Str");
  assertEquals(0,foo.getIntValue());
  assertFalse(foo.getBooleanValue());
  assertTrue(foo.getList().isEmpty());
  assertNotNull(foo.returnTypeWithWildcard());
  assertNotNull(foo.returnTypeWithBoundedTypeVariable());
  Entry<Baz,List<Integer>> x=foo.returnTypeWithMultipleTypeVariables();
  assertNotNull(x);
  HashMap<?,?> map=foo.getMap();
  assertNotNull(map);
}
Program: 164847
Project: 164847
Buggy source:
@Test public void recordSameInvocationInNotStrictExpectationBlockThenInStrictOne(){
  thrown.handleAssertionErrors();
  thrown.expect(AssertionError.class);
  new Expectations(){
{
      mock.value();
      result=1;
    }
  }
;
  new StrictExpectations(){
{
      mock.value();
      result=2;
    }
  }
;
  assertEquals(1,mock.value());
  assertEquals(1,mock.value());
}

Fixed version (ground truth):
@Test public void recordSameInvocationInNotStrictExpectationBlockThenInStrictOne(){
  thrown.expect(AssertionError.class);
  new Expectations(){
{
      mock.value();
      result=1;
    }
  }
;
  new StrictExpectations(){
{
      mock.value();
      result=2;
    }
  }
;
  assertEquals(1,mock.value());
  assertEquals(1,mock.value());
}
Program: 164848
Project: 164848
Buggy source:
void clearIfAutomaticCreation(){
  if (createAutomatically) {
    Object testClassInstance=injectionState.getCurrentTestClassInstance();
    FieldReflection.setFieldValue(testedField,testClassInstance,null);
  }
}

Fixed version (ground truth):
void clearIfAutomaticCreation(){
  if (createAutomatically) {
    injectionState.clearInstantiatedDependencies();
    Object testClassInstance=injectionState.getCurrentTestClassInstance();
    FieldReflection.setFieldValue(testedField,testClassInstance,null);
  }
}
Program: 164849
Project: 164849
Buggy source:
void formatSegments(@NotNull LineParser lineParser,@NotNull LineCoverageData lineData){
  lineNumber=lineParser.getNumber();
  List<BranchCoverageData> branchData=lineData.getBranches();
  int numSegments=lineData.getNumberOfSegments();
  element=lineParser.getInitialElement().appendUntilNextCodeElement(formattedLine);
  segmentIndex=0;
  segmentData=lineData;
  appendUntilNextBranchingPoint();
  while (element != null && segmentIndex < numSegments) {
    segmentData=segmentIndex == 0 ? lineData : branchData.get(segmentIndex - 1);
    element=element.appendUntilNextCodeElement(formattedLine);
    appendUntilNextBranchingPoint();
  }
  if (element != null) {
    element.appendAllBefore(formattedLine,null);
  }
  formattedLine.append("String_Node_Str");
  if (listOfCallPoints != null && lineData.containsCallPoints()) {
    formattedLine.append(listOfCallPoints.getContents());
  }
}

Fixed version (ground truth):
void formatSegments(@NotNull LineParser lineParser,@NotNull LineCoverageData lineData){
  lineNumber=lineParser.getNumber();
  List<BranchCoverageData> branchData=lineData.getBranches();
  int numSegments=lineData.getNumberOfSegments();
  element=lineParser.getInitialElement().appendUntilNextCodeElement(formattedLine);
  segmentIndex=0;
  segmentData=lineData;
  appendUntilNextBranchingPoint();
  while (element != null && segmentIndex < numSegments) {
    segmentData=segmentIndex == 0 ? lineData : branchData.get(segmentIndex - 1);
    element=element.appendUntilNextCodeElement(formattedLine);
    appendUntilNextBranchingPoint();
  }
  if (element != null) {
    element.appendAllBefore(formattedLine,null);
  }
  formattedLine.append("String_Node_Str");
  if (listOfCallPoints != null) {
    formattedLine.append(listOfCallPoints.getContents());
  }
}