nus-yam/ex-repair huggingface dataset:
Program: 164709
Project: 164709
Buggy source:
@Nullable private MockedTypeCascade getCascade(@Nonnull String invokedTypeDesc,@Nonnull Class<?> mockedClass){
  Class<?> typeToLookFor=mockedClass;
  do {
    String typeDesc=Type.getInternalName(typeToLookFor);
    if (invokedTypeDesc.equals(typeDesc)) {
      return null;
    }
    MockedTypeCascade cascade=cascadingTypes.get(typeDesc);
    if (cascade != null) {
      cascade.mockedClass=mockedClass;
      return cascade;
    }
    typeToLookFor=typeToLookFor.getSuperclass();
  }
 while (typeToLookFor != Object.class);
  return null;
}

Fixed version (ground truth):
@Nullable private MockedTypeCascade getCascade(@Nonnull String invokedTypeDesc,@Nonnull Class<?> mockedClass){
  Class<?> typeToLookFor=mockedClass;
  do {
    String typeDesc=Type.getInternalName(typeToLookFor);
    if (invokedTypeDesc.equals(typeDesc)) {
      return null;
    }
    MockedTypeCascade cascade=cascadingTypes.get(typeDesc);
    if (cascade != null) {
      cascade.mockedClass=mockedClass;
      return cascade;
    }
    cascade=getCascadeForInterface(invokedTypeDesc,typeToLookFor);
    if (cascade != null) {
      return cascade;
    }
    typeToLookFor=typeToLookFor.getSuperclass();
  }
 while (typeToLookFor != Object.class);
  return null;
}
Program: 164710
Project: 164710
Buggy source:
@Nullable private String resolveReturnType(@Nonnull Class<?> ownerType,@Nonnull String genericReturnType){
  String ownerTypeDesc=getOwnerClassDesc(ownerType);
  String resolvedReturnType=replaceTypeParametersWithActualTypes(ownerTypeDesc,genericReturnType);
  if (!resolvedReturnType.equals(genericReturnType)) {
    return resolvedReturnType;
  }
  if (ownerType.isInterface()) {
    for (    Class<?> superInterface : ownerType.getInterfaces()) {
      resolvedReturnType=resolveReturnType(superInterface,genericReturnType);
      if (resolvedReturnType != null) {
        return resolvedReturnType;
      }
    }
    return null;
  }
  Class<?> superClass=ownerType.getSuperclass();
  return superClass == Object.class ? null : resolveReturnType(superClass,genericReturnType);
}

Fixed version (ground truth):
@Nullable private String resolveReturnType(@Nonnull Class<?> ownerType,@Nonnull String genericReturnType){
  do {
    String ownerTypeDesc=getOwnerClassDesc(ownerType);
    String resolvedReturnType=replaceTypeParametersWithActualTypes(ownerTypeDesc,genericReturnType);
    if (!resolvedReturnType.equals(genericReturnType)) {
      return resolvedReturnType;
    }
    resolvedReturnType=resolveReturnTypeForInterfaceMethod(ownerType,genericReturnType);
    if (resolvedReturnType != null) {
      return resolvedReturnType;
    }
    ownerType=ownerType.getSuperclass();
  }
 while (ownerType != null && ownerType != Object.class);
  return null;
}
Program: 164711
Project: 164711
Buggy source:
@Nonnull public static Class<?> getReturnType(@Nonnull String methodDesc){
  Type returnType=Type.getReturnType(methodDesc);
  return getClassForType(returnType);
}

Fixed version (ground truth):
@Nonnull public static Class<?> getReturnType(@Nonnull String methodSignature){
  String methodDesc=methodDescriptionWithoutTypeArguments(methodSignature);
  Type returnType=Type.getReturnType(methodDesc);
  return getClassForType(returnType);
}
Program: 164712
Project: 164712
Buggy source:
<T extends Runnable>T doSomething();

Fixed version (ground truth):
Outer<String>.Inner doSomething(){
  return null;
}
Program: 164713
Project: 164713
Buggy source:
@Nonnull private Object getArgumentValueToInject(@Nonnull InjectionPointProvider injectable){
  Object argument=injectionState.getValueToInject(injectable);
  if (argument == null) {
    String parameterName=injectable.getName();
    throw new IllegalArgumentException("String_Node_Str" + missingValueDescription(parameterName));
  }
  return argument;
}

Fixed version (ground truth):
@Nonnull private Object getArgumentValueToInject(@Nonnull InjectionPointProvider injectable,int parameterIndex){
  Object argument=injectionState.getValueToInject(injectable);
  if (argument == null) {
    String classDesc=getClassDesc();
    String constructorDesc=getConstructorDesc();
    String parameterName=ParameterNames.getName(classDesc,constructorDesc,parameterIndex);
    if (parameterName == null) {
      parameterName=injectable.getName();
    }
    throw new IllegalArgumentException("String_Node_Str" + missingValueDescription(parameterName));
  }
  return argument;
}
Program: 164714
Project: 164714
Buggy source:
@Nonnull private String missingValueDescription(@Nonnull String name){
  String classDesc=mockit.external.asm.Type.getInternalName(constructor.getDeclaringClass());
  String constructorDesc="String_Node_Str" + mockit.external.asm.Type.getConstructorDescriptor(constructor);
  String constructorDescription=new MethodFormatter(classDesc,constructorDesc).toString();
  return "String_Node_Str" + name + "String_Node_Str"+ constructorDescription.replace("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
@Nonnull private String missingValueDescription(@Nonnull String name){
  String classDesc=getClassDesc();
  String constructorDesc=getConstructorDesc();
  String constructorDescription=new MethodFormatter(classDesc,constructorDesc).toString();
  return "String_Node_Str" + name + "String_Node_Str"+ constructorDescription.replace("String_Node_Str","String_Node_Str");
}
Program: 164715
Project: 164715
Buggy source:
@Nonnull Object instantiate(@Nonnull List<InjectionPointProvider> parameterProviders){
  Type[] parameterTypes=constructor.getGenericParameterTypes();
  int n=parameterTypes.length;
  List<InjectionPointProvider> consumedInjectables=n == 0 ? null : injectionState.saveConsumedInjectables();
  Object[] arguments=n == 0 ? NO_ARGS : new Object[n];
  boolean varArgs=constructor.isVarArgs();
  if (varArgs) {
    n--;
  }
  for (int i=0; i < n; i++) {
    InjectionPointProvider parameterProvider=parameterProviders.get(i);
    Object value;
    if (parameterProvider instanceof ConstructorParameter) {
      value=createOrReuseArgumentValue((ConstructorParameter)parameterProvider);
    }
 else {
      value=getArgumentValueToInject(parameterProvider);
    }
    Type parameterType=parameterTypes[i];
    arguments[i]=wrapInProviderIfNeeded(parameterType,value);
  }
  if (varArgs) {
    Type parameterType=parameterTypes[n];
    arguments[n]=obtainInjectedVarargsArray(parameterType);
  }
  if (consumedInjectables != null) {
    injectionState.restoreConsumedInjectables(consumedInjectables);
  }
  return invokeConstructor(arguments);
}

Fixed version (ground truth):
@Nonnull Object instantiate(@Nonnull List<InjectionPointProvider> parameterProviders){
  Type[] parameterTypes=constructor.getGenericParameterTypes();
  int n=parameterTypes.length;
  List<InjectionPointProvider> consumedInjectables=n == 0 ? null : injectionState.saveConsumedInjectables();
  Object[] arguments=n == 0 ? NO_ARGS : new Object[n];
  boolean varArgs=constructor.isVarArgs();
  if (varArgs) {
    n--;
  }
  for (int i=0; i < n; i++) {
    InjectionPointProvider parameterProvider=parameterProviders.get(i);
    Object value;
    if (parameterProvider instanceof ConstructorParameter) {
      value=createOrReuseArgumentValue((ConstructorParameter)parameterProvider);
    }
 else {
      value=getArgumentValueToInject(parameterProvider,i);
    }
    Type parameterType=parameterTypes[i];
    arguments[i]=wrapInProviderIfNeeded(parameterType,value);
  }
  if (varArgs) {
    Type parameterType=parameterTypes[n];
    arguments[n]=obtainInjectedVarargsArray(parameterType);
  }
  if (consumedInjectables != null) {
    injectionState.restoreConsumedInjectables(consumedInjectables);
  }
  return invokeConstructor(arguments);
}
Program: 164716
Project: 164716
Buggy source:
@Nonnull public String getCallerClassName(){
  StackTrace st=new StackTrace(invocationCause);
  int steIndex=3;
  String firstCaller=st.getElement(steIndex).getClassName();
  steIndex+="String_Node_Str".equals(firstCaller) ? 2 : 1;
  String secondCaller=st.getElement(steIndex).getClassName();
  if (secondCaller.contains("String_Node_Str")) {
    steIndex+=3;
    while (true) {
      String nextCaller=st.getElement(steIndex).getClassName();
      steIndex++;
      if ("String_Node_Str".equals(nextCaller)) {
        continue;
      }
      if (!nextCaller.contains("String_Node_Str") && !nextCaller.startsWith("String_Node_Str")) {
        return nextCaller;
      }
    }
  }
  if (!secondCaller.equals(firstCaller)) {
    return secondCaller;
  }
  String thirdCaller=st.getElement(steIndex + 1).getClassName();
  return thirdCaller;
}

Fixed version (ground truth):
@Nonnull public String getCallerClassName(){
  StackTrace st=new StackTrace(invocationCause);
  int steIndex=3;
  StackTraceElement ste=st.getElement(steIndex);
  if (ste.getFileName() != null && ste.getLineNumber() == -1 && ste.getMethodName().charAt(0) != '<') {
    StackTraceElement steNext=st.getElement(steIndex + 1);
    if (steNext.getMethodName().equals(ste.getMethodName())) {
      ste=steNext;
      steIndex++;
    }
  }
  String firstCaller=ste.getClassName();
  steIndex+="String_Node_Str".equals(firstCaller) ? 2 : 1;
  String secondCaller=st.getElement(steIndex).getClassName();
  if (secondCaller.contains("String_Node_Str")) {
    return getNextCallerAfterReflectionCalls(st,steIndex);
  }
  if (!secondCaller.equals(firstCaller)) {
    return secondCaller;
  }
  String thirdCaller=st.getElement(steIndex + 1).getClassName();
  return thirdCaller;
}
Program: 164718
Project: 164718
Buggy source:
@Nonnull Object instantiate(@Nonnull List<InjectionPointProvider> parameterProviders){
}

Fixed version (ground truth):
@Nonnull Object instantiate(@Nonnull List<InjectionPointProvider> parameterProviders){
  Type[] parameterTypes=constructor.getGenericParameterTypes();
  int n=parameterTypes.length;
  List<InjectionPointProvider> consumedInjectables=n == 0 ? null : injectionState.saveConsumedInjectables();
  Object[] arguments=n == 0 ? NO_ARGS : new Object[n];
  boolean varArgs=constructor.isVarArgs();
  if (varArgs) {
    n--;
  }
  for (int i=0; i < n; i++) {
    InjectionPointProvider parameterProvider=parameterProviders.get(i);
    Object value;
    if (parameterProvider instanceof ConstructorParameter) {
      value=createOrReuseArgumentValue((ConstructorParameter)parameterProvider);
    }
 else {
      value=getArgumentValueToInject(parameterProvider);
    }
    Type parameterType=parameterTypes[i];
    arguments[i]=wrapInProviderIfNeeded(parameterType,value);
  }
  if (varArgs) {
    Type parameterType=parameterTypes[n];
    arguments[n]=obtainInjectedVarargsArray(parameterType);
  }
  if (consumedInjectables != null) {
    injectionState.restoreConsumedInjectables(consumedInjectables);
  }
  return invokeConstructor(arguments);
}
Program: 164719
Project: 164719
Buggy source:
public MethodCoverageData(){
  nodes=Collections.emptyList();
  paths=Collections.emptyList();
  nonShadowedPaths=Collections.emptyList();
  nodesReached=new ThreadLocal<List<Node>>();
  previousNodeIndex=new ThreadLocal<Integer>();
}

Fixed version (ground truth):
public MethodCoverageData(){
  nodes=Collections.emptyList();
  paths=Collections.emptyList();
  nonShadowedPaths=Collections.emptyList();
  nodesReached=new ThreadLocal<List<Node>>();
  previousNodeIndex=new ThreadLocal<Integer>();
  clearNodes();
}
Program: 164720
Project: 164720
Buggy source:
@Override public void visitEnd(){
}

Fixed version (ground truth):
@Override public void visitEnd(){
  for (  String superInterface : superInterfaces) {
    new MethodGeneratorForImplementedSuperInterface(superInterface);
  }
}
Program: 164721
Project: 164721
Buggy source:
@Override public void visit(int version,int access,String name,@Nullable String signature,@Nullable String superName,@Nullable String[] interfaces){
  superInterfaces=interfaces;
}

Fixed version (ground truth):
@Override public void visit(int version,int access,String name,@Nullable String signature,@Nullable String superName,@Nullable String[] interfaces){
  methodOwner=name;
  superInterfaces=interfaces;
}
Program: 164722
Project: 164722
Buggy source:
@Override protected void generateMethodBody(int access,@Nonnull String name,@Nonnull String desc,@Nullable String signature,@Nullable String[] exceptions){
  String resolvedSignature=signature;
  if (signature != null) {
    resolvedSignature=mockedTypeInfo.genericTypeMap.resolveReturnType(interfaceName,signature);
  }
  mw=cw.visitMethod(ACC_PUBLIC,name,desc,resolvedSignature,exceptions);
  generateDirectCallToHandler(mw,interfaceName,access,name,desc,resolvedSignature);
  generateReturnWithObjectAtTopOfTheStack(desc);
  mw.visitMaxs(1,0);
}

Fixed version (ground truth):
@Override protected void generateMethodBody(int access,@Nonnull String name,@Nonnull String desc,@Nullable String signature,@Nullable String[] exceptions){
  String resolvedSignature=signature;
  if (signature != null) {
    resolvedSignature=mockedTypeInfo.genericTypeMap.resolveReturnType(methodOwner,signature);
  }
  mw=cw.visitMethod(ACC_PUBLIC,name,desc,resolvedSignature,exceptions);
  generateDirectCallToHandler(mw,interfaceName,access,name,desc,resolvedSignature);
  generateReturnWithObjectAtTopOfTheStack(desc);
  mw.visitMaxs(1,0);
}
Program: 164723
Project: 164723
Buggy source:
@Test @Ignore("String_Node_Str") public void recordGenericInterfaceMethodWithReturnTypeGivenByTypeParameterDependentOnAnotherTypeParameterOfSameName(@Mocked final DerivedGenericInterface<String> dep) throws Exception {
  Method mockedMethod=dep.getClass().getDeclaredMethod("String_Node_Str");
  Type rt=mockedMethod.getGenericReturnType();
  assertNotSame(String.class,rt);
  final List<String> values=asList("String_Node_Str","String_Node_Str");
  new Expectations(){
{
      dep.doSomething();
      result=values;
    }
  }
;
  List<String> result=dep.doSomething();
  assertSame(values,result);
}

Fixed version (ground truth):
@Test public void recordGenericInterfaceMethodWithReturnTypeGivenByTypeParameterDependentOnAnotherTypeParameterOfSameName(@Mocked final DerivedGenericInterface<String> dep) throws Exception {
  Class<?> generatedClass=dep.getClass();
  Method mockedBaseMethod=generatedClass.getDeclaredMethod("String_Node_Str");
  Type rt=mockedBaseMethod.getGenericReturnType();
  assertSame(List.class,rt);
  Method mockedSubInterfaceMethod=generatedClass.getDeclaredMethod("String_Node_Str");
  rt=mockedSubInterfaceMethod.getGenericReturnType();
  assertSame(String.class,rt);
  final List<String> values=asList("String_Node_Str","String_Node_Str");
  new Expectations(){
{
      dep.doSomething();
      result=values;
      dep.doSomethingElse();
      result="String_Node_Str";
    }
  }
;
  List<String> resultFromBase=dep.doSomething();
  String resultFromSub=dep.doSomethingElse();
  assertSame(values,resultFromBase);
  assertEquals("String_Node_Str",resultFromSub);
}
Program: 164724
Project: 164724
Buggy source:
protected final void generateCodeToFillArrayElement(int arrayIndex,@Nullable Object value){
  mw.visitInsn(DUP);
  mw.visitIntInsn(BIPUSH,arrayIndex);
  if (value == null) {
    mw.visitInsn(ACONST_NULL);
  }
 else   if (value instanceof Integer) {
    mw.visitIntInsn(SIPUSH,(Integer)value);
    mw.visitMethodInsn(INVOKESTATIC,"String_Node_Str","String_Node_Str","String_Node_Str",false);
  }
 else   if (value instanceof Boolean) {
    mw.visitInsn((Boolean)value ? ICONST_1 : ICONST_0);
    mw.visitMethodInsn(INVOKESTATIC,"String_Node_Str","String_Node_Str","String_Node_Str",false);
  }
 else {
    mw.visitLdcInsn(value);
  }
  mw.visitInsn(AASTORE);
}

Fixed version (ground truth):
protected final void generateCodeToFillArrayElement(int arrayIndex,@Nullable Object value){
  mw.visitInsn(DUP);
  mw.visitIntInsn(SIPUSH,arrayIndex);
  if (value == null) {
    mw.visitInsn(ACONST_NULL);
  }
 else   if (value instanceof Integer) {
    mw.visitIntInsn(SIPUSH,(Integer)value);
    mw.visitMethodInsn(INVOKESTATIC,"String_Node_Str","String_Node_Str","String_Node_Str",false);
  }
 else   if (value instanceof Boolean) {
    mw.visitInsn((Boolean)value ? ICONST_1 : ICONST_0);
    mw.visitMethodInsn(INVOKESTATIC,"String_Node_Str","String_Node_Str","String_Node_Str",false);
  }
 else {
    mw.visitLdcInsn(value);
  }
  mw.visitInsn(AASTORE);
}
Program: 164725
Project: 164725
Buggy source:
public static void generateCodeToCreateArrayOfObject(@Nonnull MethodWriter mw,int arrayLength){
  mw.visitIntInsn(BIPUSH,arrayLength);
  mw.visitTypeInsn(ANEWARRAY,"String_Node_Str");
}

Fixed version (ground truth):
public static void generateCodeToCreateArrayOfObject(@Nonnull MethodWriter mw,int arrayLength){
  mw.visitIntInsn(SIPUSH,arrayLength);
  mw.visitTypeInsn(ANEWARRAY,"String_Node_Str");
}
Program: 164726
Project: 164726
Buggy source:
public static void generateCodeToFillArrayWithParameterValues(@Nonnull MethodWriter mw,@Nonnull Type[] parameterTypes,int initialArrayIndex,int initialParameterIndex){
  int i=initialArrayIndex;
  int j=initialParameterIndex;
  for (  Type parameterType : parameterTypes) {
    mw.visitInsn(DUP);
    mw.visitIntInsn(BIPUSH,i++);
    mw.visitVarInsn(parameterType.getOpcode(ILOAD),j);
    TypeConversion.generateCastToObject(mw,parameterType);
    mw.visitInsn(AASTORE);
    j+=parameterType.getSize();
  }
}

Fixed version (ground truth):
public static void generateCodeToFillArrayWithParameterValues(@Nonnull MethodWriter mw,@Nonnull Type[] parameterTypes,int initialArrayIndex,int initialParameterIndex){
  int i=initialArrayIndex;
  int j=initialParameterIndex;
  for (  Type parameterType : parameterTypes) {
    mw.visitInsn(DUP);
    mw.visitIntInsn(SIPUSH,i++);
    mw.visitVarInsn(parameterType.getOpcode(ILOAD),j);
    TypeConversion.generateCastToObject(mw,parameterType);
    mw.visitInsn(AASTORE);
    j+=parameterType.getSize();
  }
}
Program: 164728
Project: 164728
Buggy source:
@Nonnull @Override protected Member findRealMember(){
  return mockState.getRealMethodOrConstructor(mockedClassDesc,mockedMethodName,mockedMethodDesc);
}

Fixed version (ground truth):
@Nonnull @Override protected Member findRealMember(){
  Object invokedInstance=getInvokedInstance();
  if (invokedInstance != null) {
    Class<?> mockedClass=invokedInstance.getClass();
    return mockState.getRealMethodOrConstructor(mockedClass,mockedMethodName,mockedMethodDesc);
  }
  return mockState.getRealMethodOrConstructor(mockedClassDesc,mockedMethodName,mockedMethodDesc);
}
Program: 164729
Project: 164729
Buggy source:
@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;
}

Fixed version (ground truth):
@Nonnull Member getRealMethodOrConstructor(@Nonnull Class<?> mockedClass,@Nonnull String mockedMethodName,@Nonnull String mockedMethodDesc){
  if (realMethodOrConstructor == null || !mockedClass.equals(realClass)) {
    String memberName="String_Node_Str".equals(mockedMethodName) ? "String_Node_Str" : mockedMethodName;
    RealMethodOrConstructor realMember;
    try {
      realMember=new RealMethodOrConstructor(mockedClass,memberName,mockedMethodDesc);
    }
 catch (    NoSuchMethodException e) {
      throw new RuntimeException(e);
    }
    Member member=realMember.getMember();
    if (mockMethod.isAdvice) {
      return member;
    }
    realMethodOrConstructor=member;
    realClass=mockedClass;
  }
  return realMethodOrConstructor;
}
Program: 164730
Project: 164730
Buggy source:
@Override public boolean equals(@Nonnull Object other){
  return mockMethod.equals(((MockState)other).mockMethod);
}

Fixed version (ground truth):
@Override @SuppressWarnings("String_Node_Str") public boolean equals(@Nonnull Object other){
  return mockMethod.equals(((MockState)other).mockMethod);
}
Program: 164731
Project: 164731
Buggy source:
public RealMethodOrConstructor(@Nonnull Class<?> realClass,@Nonnull String methodNameAndDesc) throws NoSuchMethodException {
  int p=methodNameAndDesc.indexOf('(');
  String memberDesc=methodNameAndDesc.substring(p);
  if (methodNameAndDesc.charAt(0) == '<') {
    member=findConstructor(realClass,memberDesc);
  }
 else {
    String methodName=methodNameAndDesc.substring(0,p);
    member=findMethod(realClass,methodName,memberDesc);
  }
}

Fixed version (ground truth):
public RealMethodOrConstructor(@Nonnull Class<?> realClass,@Nonnull String methodName,@Nonnull String memberDesc) throws NoSuchMethodException {
  if (methodName.charAt(0) == '<') {
    member=findConstructor(realClass,memberDesc);
  }
 else {
    member=findMethod(realClass,methodName,memberDesc);
  }
}
Program: 164732
Project: 164732
Buggy source:
@Mock int doSomething(){
  return 2;
}

Fixed version (ground truth):
@Mock void doSomething(Invocation invocation){
  invocation.proceed();
}
Program: 164733
Project: 164733
Buggy source:
void registerTypeToCaptureIntoListIfApplicable(int varIndex,@Nonnull String signature){
  if (signature.startsWith("String_Node_Str")) {
    String typeDesc=signature.substring(16,signature.length() - 2);
    Type type=Type.getType(typeDesc);
    ActiveInvocations.varIndexToTypeDesc.put(varIndex,type.getInternalName());
  }
}

Fixed version (ground truth):
void registerTypeToCaptureIntoListIfApplicable(int varIndex,@Nonnull String signature){
  if (signature.startsWith("String_Node_Str")) {
    String typeDesc=signature.substring(16,signature.length() - 2);
    int p=typeDesc.indexOf('<');
    if (p > 0) {
      typeDesc=typeDesc.substring(0,p) + ';';
    }
    Type type=Type.getType(typeDesc);
    ActiveInvocations.varIndexToTypeDesc.put(varIndex,type.getInternalName());
  }
}
Program: 164734
Project: 164734
Buggy source:
@Override public void visit(int version,int access,@Nonnull String name,@Nullable String signature,@Nullable String superName,@Nullable String[] interfaces){
  classExtendsCapturedType=false;
  if (capturedTypeDesc.equals(superName)) {
    classExtendsCapturedType=true;
  }
 else   if (interfaces != null && interfaces.length > 0) {
    for (    String implementedInterface : interfaces) {
      if (capturedTypeDesc.equals(implementedInterface)) {
        classExtendsCapturedType=true;
        break;
      }
    }
  }
  if (superName != null && !classExtendsCapturedType && !"String_Node_Str".contains(superName)) {
    ClassReader cr=ClassFile.createClassFileReader(loader,superName);
    cr.accept(this,SKIP_DEBUG);
  }
  throw VisitInterruptedException.INSTANCE;
}

Fixed version (ground truth):
@Override public void visit(int version,int access,@Nonnull String name,@Nullable String signature,@Nullable String superName,@Nullable String[] interfaces){
  classExtendsCapturedType=false;
  if (capturedTypeDesc.equals(superName)) {
    classExtendsCapturedType=true;
    throw VisitInterruptedException.INSTANCE;
  }
  boolean haveInterfaces=interfaces != null && interfaces.length > 0;
  if (haveInterfaces) {
    for (    String implementedInterface : interfaces) {
      if (capturedTypeDesc.equals(implementedInterface)) {
        classExtendsCapturedType=true;
        throw VisitInterruptedException.INSTANCE;
      }
    }
  }
  if (superName != null) {
    if (!"String_Node_Str".contains(superName)) {
      ClassReader cr=ClassFile.createClassFileReader(loader,superName);
      cr.accept(this,SKIP_DEBUG);
    }
 else     if (haveInterfaces) {
      for (      String implementedInterface : interfaces) {
        ClassReader cr=ClassFile.createClassFileReader(loader,implementedInterface);
        cr.accept(this,SKIP_DEBUG);
      }
    }
  }
  throw VisitInterruptedException.INSTANCE;
}
Program: 164735
Project: 164735
Buggy source:
static boolean isNotToBeCaptured(@Nullable ClassLoader loader,@Nullable ProtectionDomain protectionDomain,@Nonnull String classNameOrDesc){
  if (loader == null && classNameOrDesc.startsWith("String_Node_Str") || protectionDomain == JMOCKIT_DOMAIN || isGeneratedClass(classNameOrDesc)) {
    return true;
  }
  return classNameOrDesc.endsWith("String_Node_Str") || classNameOrDesc.startsWith("String_Node_Str") || classNameOrDesc.startsWith("String_Node_Str")|| classNameOrDesc.startsWith("String_Node_Str") && (hasSubPackage(classNameOrDesc,"String_Node_Str") || hasSubPackage(classNameOrDesc,"String_Node_Str") || hasSubPackage(classNameOrDesc,"String_Node_Str")) || classNameOrDesc.startsWith("String_Node_Str") && hasSubPackage(classNameOrDesc,"String_Node_Str") || ClassLoad.isGeneratedSubclass(classNameOrDesc);
}

Fixed version (ground truth):
static boolean isNotToBeCaptured(@Nullable ClassLoader loader,@Nullable ProtectionDomain protectionDomain,@Nonnull String classNameOrDesc){
  if (loader == null && classNameOrDesc.startsWith("String_Node_Str") || protectionDomain == JMOCKIT_DOMAIN || isGeneratedClass(classNameOrDesc)) {
    return true;
  }
  return classNameOrDesc.endsWith("String_Node_Str") || classNameOrDesc.startsWith("String_Node_Str") || classNameOrDesc.startsWith("String_Node_Str") && !hasSubPackage(classNameOrDesc,4,"String_Node_Str") || classNameOrDesc.startsWith("String_Node_Str") && (hasSubPackage(classNameOrDesc,4,"String_Node_Str") || hasSubPackage(classNameOrDesc,4,"String_Node_Str") || hasSubPackage(classNameOrDesc,4,"String_Node_Str")) || classNameOrDesc.startsWith("String_Node_Str") && (hasSubPackage(classNameOrDesc,4,"String_Node_Str") && !hasSubPackage(classNameOrDesc,8,"String_Node_Str") || hasSubPackage(classNameOrDesc,4,"String_Node_Str")) || ClassLoad.isGeneratedSubclass(classNameOrDesc);
}
Program: 164736
Project: 164736
Buggy source:
private static boolean hasSubPackage(@Nonnull String nameOrDesc,@Nonnull String subPackage){
  return nameOrDesc.regionMatches(4,subPackage,0,subPackage.length());
}

Fixed version (ground truth):
private static boolean hasSubPackage(@Nonnull String nameOrDesc,int offset,@Nonnull String subPackage){
  return nameOrDesc.regionMatches(offset,subPackage,0,subPackage.length());
}
Program: 164737
Project: 164737
Buggy source:
@SuppressWarnings("String_Node_Str") boolean isToBeCaptured(@Nonnull Class<?> aClass){
  if (baseType == Object.class) {
    if (aClass.isArray() || mockit.MockUp.class.isAssignableFrom(aClass) || mockit.Delegate.class.isAssignableFrom(aClass)|| mockit.Expectations.class.isAssignableFrom(aClass)|| mockit.Verifications.class.isAssignableFrom(aClass)) {
      return false;
    }
  }
 else   if (aClass == baseType || !baseType.isAssignableFrom(aClass)) {
    return false;
  }
  if (aClass.isInterface()) {
    return false;
  }
  return !isNotToBeCaptured(aClass.getClassLoader(),aClass.getProtectionDomain(),aClass.getName());
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") boolean isToBeCaptured(@Nonnull Class<?> aClass){
  if (baseType == Object.class) {
    if (aClass.isArray() || mockit.MockUp.class.isAssignableFrom(aClass) || mockit.Delegate.class.isAssignableFrom(aClass)|| mockit.Expectations.class.isAssignableFrom(aClass)|| mockit.Verifications.class.isAssignableFrom(aClass)) {
      return false;
    }
  }
 else   if (aClass == baseType || !baseType.isAssignableFrom(aClass)) {
    return false;
  }
  return !aClass.isInterface() && !isNotToBeCaptured(aClass.getClassLoader(),aClass.getProtectionDomain(),aClass.getName());
}
Program: 164738
Project: 164738
Buggy source:
@Nullable private static String getReturnTypeIfCascadingSupportedForIt(@Nonnull String typeDesc){
  String typeName=getInternalTypeName(typeDesc);
  return isTypeSupportedForCascading(typeName) ? typeName : null;
}

Fixed version (ground truth):
@Nullable private static String getReturnTypeIfCascadingSupportedForIt(@Nonnull String typeDesc){
  String typeName=typeDesc.substring(1,typeDesc.length() - 1);
  return isTypeSupportedForCascading(typeName) ? typeName : null;
}
Program: 164739
Project: 164739
Buggy source:
@Nonnull private Type getGenericReturnType(@Nonnull Class<?> cascadingClass,@Nonnull String methodNameAndDesc) throws NoSuchMethodException {
  Method cascadingMethod=new RealMethodOrConstructor(cascadingClass,methodNameAndDesc).getMember();
  Type genericReturnType=cascadingMethod.getGenericReturnType();
  if (genericReturnType instanceof TypeVariable<?>) {
    GenericTypeReflection typeReflection=new GenericTypeReflection(cascadingClass,mockedType);
    genericReturnType=typeReflection.resolveReturnType((TypeVariable<?>)genericReturnType);
  }
  return genericReturnType;
}

Fixed version (ground truth):
@Nonnull private Type getGenericReturnType(@Nonnull Class<?> cascadingClass,@Nonnull String methodNameAndDesc) throws NoSuchMethodException {
  Method cascadingMethod=new RealMethodOrConstructor(cascadingClass,methodNameAndDesc).getMember();
  Type genericReturnType=cascadingMethod.getGenericReturnType();
  if (genericReturnType instanceof TypeVariable<?>) {
    genericReturnType=genericReflection.resolveReturnType((TypeVariable<?>)genericReturnType);
  }
  return genericReturnType;
}
Program: 164740
Project: 164740
Buggy source:
@Nonnull private static <T>Constructor<T> findCompatibleConstructor(@Nonnull Class<?> theClass,@Nonnull Class<?>[] argTypes){
  Constructor<T> found=null;
  Class<?>[] foundParameters=null;
  Constructor<?>[] declaredConstructors=theClass.getDeclaredConstructors();
  for (  Constructor<?> declaredConstructor : declaredConstructors) {
    Class<?>[] declaredParamTypes=declaredConstructor.getParameterTypes();
    int firstRealParameter=indexOfFirstRealParameter(declaredParamTypes,argTypes);
    if (firstRealParameter >= 0 && (matchesParameterTypes(declaredParamTypes,argTypes,firstRealParameter) || acceptsArgumentTypes(declaredParamTypes,argTypes,firstRealParameter)) && (found == null || hasMoreSpecificTypes(declaredParamTypes,foundParameters))) {
      found=(Constructor<T>)declaredConstructor;
      foundParameters=declaredParamTypes;
    }
  }
  if (found != null) {
    return found;
  }
  Class<?> declaringClass=theClass.getDeclaringClass();
  Class<?>[] paramTypes=declaredConstructors[0].getParameterTypes();
  if (paramTypes[0] == declaringClass && paramTypes.length > argTypes.length) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  String argTypesDesc=getParameterTypesDescription(argTypes);
  throw new IllegalArgumentException("String_Node_Str" + theClass.getSimpleName() + argTypesDesc);
}

Fixed version (ground truth):
@Nonnull private static <T>Constructor<T> findCompatibleConstructor(@Nonnull Class<?> theClass,@Nonnull Class<?>[] argTypes){
  Constructor<T> found=null;
  Class<?>[] foundParameters=null;
  Constructor<?>[] declaredConstructors=theClass.getDeclaredConstructors();
  for (  Constructor<?> declaredConstructor : declaredConstructors) {
    Class<?>[] declaredParamTypes=declaredConstructor.getParameterTypes();
    int firstRealParameter=indexOfFirstRealParameter(declaredParamTypes,argTypes);
    if (firstRealParameter >= 0 && (matchesParameterTypes(declaredParamTypes,argTypes,firstRealParameter) || acceptsArgumentTypes(declaredParamTypes,argTypes,firstRealParameter)) && (found == null || hasMoreSpecificTypes(declaredParamTypes,foundParameters))) {
      found=(Constructor<T>)declaredConstructor;
      foundParameters=declaredParamTypes;
    }
  }
  if (found != null) {
    return found;
  }
  Class<?> declaringClass=theClass.getDeclaringClass();
  Class<?>[] paramTypes=declaredConstructors[0].getParameterTypes();
  if (paramTypes.length > argTypes.length && paramTypes[0] == declaringClass) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  String argTypesDesc=getParameterTypesDescription(argTypes);
  throw new IllegalArgumentException("String_Node_Str" + theClass.getSimpleName() + argTypesDesc);
}
Program: 164741
Project: 164741
Buggy source:
private boolean generateArgumentsForMockMethodInvocation(){
  Type[] argTypes=Type.getArgumentTypes(mockMethod.mockDescWithoutInvocationParameter);
  int varIndex=isStatic(methodAccess) ? 0 : 1;
  boolean canProceedIntoConstructor=false;
  if (mockMethod.hasInvocationParameter) {
    generateCallToCreateNewMockInvocation(argTypes,varIndex);
    if (isConstructor) {
      mw.visitInsn(mockMethod.isStatic() ? DUP : DUP_X1);
      canProceedIntoConstructor=true;
    }
  }
  boolean forGenericMethod=mockMethod.isForGenericMethod();
  for (  Type argType : argTypes) {
    int opcode=argType.getOpcode(ILOAD);
    mw.visitVarInsn(opcode,varIndex);
    if (forGenericMethod && argType.getSort() >= Type.ARRAY) {
      mw.visitTypeInsn(CHECKCAST,argType.getInternalName());
    }
    varIndex+=argType.getSize();
  }
  return canProceedIntoConstructor;
}

Fixed version (ground truth):
private boolean generateArgumentsForMockMethodInvocation(){
  String mockedDesc=mockMethod.isAdvice ? methodDesc : mockMethod.mockDescWithoutInvocationParameter;
  Type[] argTypes=Type.getArgumentTypes(mockedDesc);
  int varIndex=isStatic(methodAccess) ? 0 : 1;
  boolean canProceedIntoConstructor=false;
  if (mockMethod.hasInvocationParameter) {
    generateCallToCreateNewMockInvocation(argTypes,varIndex);
    if (isConstructor) {
      mw.visitInsn(mockMethod.isStatic() ? DUP : DUP_X1);
      canProceedIntoConstructor=true;
    }
  }
  if (!mockMethod.isAdvice) {
    boolean forGenericMethod=mockMethod.isForGenericMethod();
    for (    Type argType : argTypes) {
      int opcode=argType.getOpcode(ILOAD);
      mw.visitVarInsn(opcode,varIndex);
      if (forGenericMethod && argType.getSort() >= Type.ARRAY) {
        mw.visitTypeInsn(CHECKCAST,argType.getInternalName());
      }
      varIndex+=argType.getSize();
    }
  }
  return canProceedIntoConstructor;
}
Program: 164742
Project: 164742
Buggy source:
private void generateMethodReturn(){
  if (shouldUseMockingBridge()) {
    generateReturnWithObjectAtTopOfTheStack(methodDesc);
  }
 else {
    Type returnType=Type.getReturnType(methodDesc);
    mw.visitInsn(returnType.getOpcode(IRETURN));
  }
}

Fixed version (ground truth):
private void generateMethodReturn(){
  if (shouldUseMockingBridge() || mockMethod.isAdvice) {
    generateReturnWithObjectAtTopOfTheStack(methodDesc);
  }
 else {
    Type returnType=Type.getReturnType(methodDesc);
    mw.visitInsn(returnType.getOpcode(IRETURN));
  }
}
Program: 164743
Project: 164743
Buggy source:
@Mock Object $advice(Invocation invocation){
  long startTime=System.nanoTime() / 1000000;
  try {
    return invocation.proceed();
  }
  finally {
    long endTime=System.nanoTime() / 1000000;
    long dt=endTime - startTime;
    Method invokedMethod=invocation.getInvokedMember();
    addMethodExecutionTime(invokedMethod,dt);
  }
}

Fixed version (ground truth):
@Mock public static Object $advice(Invocation inv){
  Object[] args=inv.getInvokedArguments();
  if (args.length > 0) {
    Integer i=(Integer)args[0];
    return -i;
  }
  return null;
}
Program: 164744
Project: 164744
Buggy source:
@Nullable public static <T>T getFieldValue(@Nonnull Field field,@Nullable Object targetObject){
  Utilities.ensureThatMemberIsAccessible(field);
  try {
    return (T)field.get(targetObject);
  }
 catch (  IllegalAccessException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
@Nullable public static <T>T getFieldValue(@Nonnull Field field,@Nullable Object targetObject){
  ensureThatMemberIsAccessible(field);
  try {
    return (T)field.get(targetObject);
  }
 catch (  IllegalAccessException e) {
    throw new RuntimeException(e);
  }
}
Program: 164745
Project: 164745
Buggy source:
public static void setFieldValue(@Nonnull Field field,@Nullable Object targetObject,@Nullable Object value){
  try {
    if (isStatic(field.getModifiers()) && isFinal(field.getModifiers())) {
      setStaticFinalField(field,value);
    }
 else {
      Utilities.ensureThatMemberIsAccessible(field);
      field.set(targetObject,value);
    }
  }
 catch (  IllegalAccessException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
public static void setFieldValue(@Nonnull Field field,@Nullable Object targetObject,@Nullable Object value){
  try {
    if (isStatic(field.getModifiers()) && isFinal(field.getModifiers())) {
      setStaticFinalField(field,value);
    }
 else {
      ensureThatMemberIsAccessible(field);
      field.set(targetObject,value);
    }
  }
 catch (  IllegalAccessException e) {
    throw new RuntimeException(e);
  }
}
Program: 164746
Project: 164746
Buggy source:
private static void setStaticFinalField(@Nonnull Field field,@Nullable Object value) throws IllegalAccessException {
  Field modifiersField;
  try {
    modifiersField=Field.class.getDeclaredField("String_Node_Str");
  }
 catch (  NoSuchFieldException e) {
    throw new RuntimeException(e);
  }
  modifiersField.setAccessible(true);
  int nonFinalModifiers=modifiersField.getInt(field) - FINAL;
  modifiersField.setInt(field,nonFinalModifiers);
  sun.reflect.FieldAccessor accessor=sun.reflect.ReflectionFactory.getReflectionFactory().newFieldAccessor(field,false);
  accessor.set(null,value);
}

Fixed version (ground truth):
private static void setStaticFinalField(@Nonnull Field field,@Nullable Object value) throws IllegalAccessException {
  int nonFinalModifiers=MODIFIERS_FIELD.getInt(field) - FINAL;
  MODIFIERS_FIELD.setInt(field,nonFinalModifiers);
  ensureThatMemberIsAccessible(field);
  field.set(null,value);
}
Program: 164747
Project: 164747
Buggy source:
@Test public void setStaticFinalFields(){
  if (!JAVA9) {
    setField(Subclass.class,"String_Node_Str",54);
    setField(Subclass.class,"String_Node_Str");
    setField(Subclass.class,true);
    assertEquals(54,getField(Subclass.class,"String_Node_Str"));
    assertEquals("String_Node_Str",getField(Subclass.class,String.class));
    assertTrue(getField(Subclass.class,boolean.class));
    assertFalse(Subclass.FLAG);
  }
}

Fixed version (ground truth):
@Test public void setStaticFinalFields() throws Exception {
  setField(Subclass.class,"String_Node_Str",54);
  setField(Subclass.class,"String_Node_Str");
  setField(Subclass.class,true);
  assertEquals(54,getField(Subclass.class,"String_Node_Str"));
  assertEquals("String_Node_Str",getField(Subclass.class,String.class));
  assertTrue(getField(Subclass.class,boolean.class));
  assertFalse(Subclass.FLAG);
}
Program: 164748
Project: 164748
Buggy source:
@Override public void visitInnerClass(@Nonnull String internalName,@Nullable String outerName,@Nullable String innerName,int access){
  cw.visitInnerClass(internalName,outerName,innerName,access);
  if (forInnerClass || isSyntheticOrEnumClass(access) || !isNestedInsideClassBeingModified(outerName)) {
    return;
  }
  String innerClassName=internalName.replace('/','.');
  if (INNER_CLASS_MODIFIERS.containsKey(innerClassName)) {
    return;
  }
  ClassReader innerCR=createClassReader(CoverageModifier.class.getClassLoader(),internalName);
  if (innerCR != null) {
    CoverageModifier innerClassModifier=new CoverageModifier(innerCR,this,innerName);
    innerCR.accept(innerClassModifier,SKIP_FRAMES);
    INNER_CLASS_MODIFIERS.put(innerClassName,innerClassModifier);
  }
}

Fixed version (ground truth):
@Override public void visitInnerClass(@Nonnull String internalName,@Nullable String outerName,@Nullable String innerName,int access){
  cw.visitInnerClass(internalName,outerName,innerName,access);
  if (forInnerClass || isSyntheticOrEnumClass(access) || !isNestedInsideClassBeingModified(internalName,outerName)) {
    return;
  }
  String innerClassName=internalName.replace('/','.');
  if (INNER_CLASS_MODIFIERS.containsKey(innerClassName)) {
    return;
  }
  ClassReader innerCR=createClassReader(CoverageModifier.class.getClassLoader(),internalName);
  if (innerCR != null) {
    CoverageModifier innerClassModifier=new CoverageModifier(innerCR,this,innerName);
    innerCR.accept(innerClassModifier,SKIP_FRAMES);
    INNER_CLASS_MODIFIERS.put(innerClassName,innerClassModifier);
  }
}
Program: 164749
Project: 164749
Buggy source:
private boolean isNestedInsideClassBeingModified(@Nullable String outerName){
  if (outerName == null) {
    return false;
  }
  int p=outerName.indexOf('$');
  String outerClassName=p < 0 ? outerName : outerName.substring(0,p);
  return outerClassName.equals(internalClassName);
}

Fixed version (ground truth):
private boolean isNestedInsideClassBeingModified(@Nonnull String internalName,@Nullable String outerName){
  String className=outerName == null ? internalName : outerName;
  int p=className.indexOf('$');
  String outerClassName=p < 0 ? className : className.substring(0,p);
  return outerClassName.equals(internalClassName);
}
Program: 164750
Project: 164750
Buggy source:
@Test public void exerciseNestedClasses(){
  ClassWithNestedClasses.doSomething();
  assertEquals(10,fileData.lineCoverageInfo.getExecutableLineCount());
  assertEquals(60,fileData.lineCoverageInfo.getCoveragePercentage());
  assertEquals(10,fileData.lineCoverageInfo.getTotalItems());
  assertEquals(6,fileData.lineCoverageInfo.getCoveredItems());
  findMethodData(27);
  assertMethodLines(27,33);
  assertPaths(2,1,1);
  assertPath(4,0);
  assertPath(5,1);
  assertEquals(5,fileData.pathCoverageInfo.firstLineToMethodData.size());
  assertEquals(50,fileData.pathCoverageInfo.getCoveragePercentage());
  assertEquals(6,fileData.pathCoverageInfo.getTotalItems());
  assertEquals(3,fileData.pathCoverageInfo.getCoveredItems());
}

Fixed version (ground truth):
@Test public void exerciseNestedClasses(){
  ClassWithNestedClasses.doSomething();
  ClassWithNestedClasses.methodContainingAnonymousClass(1);
  assertEquals(12,fileData.lineCoverageInfo.getExecutableLineCount());
  assertEquals(64,fileData.lineCoverageInfo.getCoveragePercentage());
  assertEquals(14,fileData.lineCoverageInfo.getTotalItems());
  assertEquals(9,fileData.lineCoverageInfo.getCoveredItems());
  findMethodData(27);
  assertMethodLines(27,33);
  assertPaths(2,1,1);
  assertPath(4,0);
  assertPath(5,1);
  assertEquals(6,fileData.pathCoverageInfo.firstLineToMethodData.size());
  assertEquals(57,fileData.pathCoverageInfo.getCoveragePercentage());
  assertEquals(7,fileData.pathCoverageInfo.getTotalItems());
  assertEquals(4,fileData.pathCoverageInfo.getCoveredItems());
}
Program: 164751
Project: 164751
Buggy source:
@Override boolean hasEquivalentMatchers(@Nonnull ArgumentValuesAndMatchers other){
  int i=indexOfFirstValueAfterEquivalentMatchers(other);
  if (i < 0) {
    return false;
  }
  VarargsComparison varargsComparison=new VarargsComparison(other.values);
  int n=varargsComparison.getTotalArgumentCountWhenDifferent();
  if (n < 0) {
    return false;
  }
  while (i < n) {
    Object thisArg=varargsComparison.getThisArgument(i);
    Object otherArg=varargsComparison.getOtherArgument(i);
    if (!EqualityMatcher.areEqual(thisArg,otherArg)) {
      return false;
    }
    i++;
  }
  return true;
}

Fixed version (ground truth):
@Override boolean hasEquivalentMatchers(@Nonnull ArgumentValuesAndMatchers other){
  @SuppressWarnings("String_Node_Str") int i=indexOfFirstValueAfterEquivalentMatchers(other);
  if (i < 0) {
    return false;
  }
  VarargsComparison varargsComparison=new VarargsComparison(other.values);
  int n=varargsComparison.getTotalArgumentCountWhenDifferent();
  if (n < 0) {
    return false;
  }
  while (i < n) {
    Object thisArg=varargsComparison.getThisArgument(i);
    Object otherArg=varargsComparison.getOtherArgument(i);
    if (!EqualityMatcher.areEqual(thisArg,otherArg)) {
      return false;
    }
    i++;
  }
  return true;
}
Program: 164752
Project: 164752
Buggy source:
@Override boolean isMatch(@Nonnull Object[] replayArgs,@Nonnull Map<Object,Object> instanceMap){
  if (matchers == null) {
    return areEqual(replayArgs,instanceMap);
  }
  VarargsComparison varargsComparison=new VarargsComparison(replayArgs);
  int n=varargsComparison.getTotalArgumentCountWhenDifferent();
  if (n < 0) {
    return false;
  }
  for (int i=0; i < n; i++) {
    Object actual=varargsComparison.getOtherArgument(i);
    ArgumentMatcher<?> expected=getArgumentMatcher(i);
    if (expected == null) {
      Object arg=varargsComparison.getThisArgument(i);
      if (arg == null)       continue;
      expected=new LenientEqualityMatcher(arg,instanceMap);
    }
    if (!expected.matches(actual)) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
@Override boolean isMatch(@Nonnull Object[] replayArgs,@Nonnull Map<Object,Object> instanceMap){
  if (matchers == null) {
    return areEqual(replayArgs,instanceMap);
  }
  VarargsComparison varargsComparison=new VarargsComparison(replayArgs);
  int totalArgCount=varargsComparison.getTotalArgumentCountWhenDifferent();
  int regularArgCount=varargsComparison.regularArgCount;
  if (totalArgCount < 0) {
    return false;
  }
  for (int i=0; i < totalArgCount; i++) {
    Object actual=varargsComparison.getOtherArgument(i);
    ArgumentMatcher<?> expected=getArgumentMatcher(i);
    if (expected == null) {
      Object arg=varargsComparison.getThisArgument(i);
      if (arg == null)       continue;
      expected=new LenientEqualityMatcher(arg,instanceMap);
    }
 else     if (i == regularArgCount && expected instanceof CaptureMatcher<?>) {
      actual=varargsComparison.getOtherVarArgs();
      i=totalArgCount;
    }
    if (!expected.matches(actual)) {
      return false;
    }
  }
  return true;
}
Program: 164753
Project: 164753
Buggy source:
@Nullable public Class<?> findClassAlreadyMocked(@Nonnull Class<?> targetClass){
  return findClassAssignableFrom(mockedClasses,targetClass);
}

Fixed version (ground truth):
@Nullable public Class<?> findClassAlreadyMocked(@Nonnull Class<?> targetClass){
  int n=mockedClasses.size();
  for (int i=0; i < n; i++) {
    Class<?> mockedClass=mockedClasses.get(i);
    if (mockedClass == targetClass || !mockedClass.isInterface() && mockedClass.isAssignableFrom(targetClass)) {
      return mockedClass;
    }
  }
  return null;
}
Program: 164754
Project: 164754
Buggy source:
public boolean isInstanceOfMockedClass(@Nonnull Object mockedInstance){
  Class<?> mockedClass=mockedInstance.getClass();
  return findClassAlreadyMocked(mockedClass) != null;
}

Fixed version (ground truth):
public boolean isInstanceOfMockedClass(@Nonnull Object mockedInstance){
  Class<?> mockedClass=mockedInstance.getClass();
  return findClassAssignableFrom(mockedClasses,mockedClass) != null;
}
Program: 164755
Project: 164755
Buggy source:
@Override public void run(){
  task.doIt();
}

Fixed version (ground truth):
@Override public void run(){
}
Program: 164756
Project: 164756
Buggy source:
@Test public void dynamicMockFullyVerified_verifyAllRecordedExpectationsButNotAllOfTheReplayedOnes(){
  final Collaborator collaborator=new Collaborator(0);
  new Expectations(collaborator){
{
      collaborator.setValue(1);
    }
  }
;
  collaborator.setValue(1);
  collaborator.setValue(2);
  new FullVerifications(){
{
    }
  }
;
}

Fixed version (ground truth):
@Test public void dynamicMockFullyVerified_verifyAllRecordedExpectationsButNotAllOfTheReplayedOnes(){
  final Collaborator collaborator=new Collaborator(0);
  new Expectations(collaborator){
{
      collaborator.setValue(1);
    }
  }
;
  collaborator.setValue(1);
  collaborator.setValue(2);
  new FullVerifications(){
  }
;
}