nus-yam/ex-repair huggingface dataset:
Program: 25772
Project: 25772
Buggy source:
protected void atFieldPlusPlus(int token,boolean isPost,ASTree oprand,Expr expr,boolean doDup) throws CompileError {
  CtField f=fieldAccess(oprand);
  boolean is_static=resultStatic;
  if (!is_static)   bytecode.addOpcode(DUP);
  int fi=atFieldRead(f,is_static);
  int t=exprType;
  boolean is2w=is2word(t,arrayDim);
  int dup_code;
  if (is_static)   dup_code=(is2w ? DUP2 : DUP);
 else   dup_code=(is2w ? DUP2_X1 : DUP_X1);
  atPlusPlusCore(dup_code,doDup,token,isPost,expr);
  atFieldAssignCore(f,is_static,fi,is2w);
}

Fixed version (ground truth):
protected void atFieldPlusPlus(int token,boolean isPost,ASTree oprand,Expr expr,boolean doDup) throws CompileError {
  CtField f=fieldAccess(oprand,false);
  boolean is_static=resultStatic;
  if (!is_static)   bytecode.addOpcode(DUP);
  int fi=atFieldRead(f,is_static);
  int t=exprType;
  boolean is2w=is2word(t,arrayDim);
  int dup_code;
  if (is_static)   dup_code=(is2w ? DUP2 : DUP);
 else   dup_code=(is2w ? DUP2_X1 : DUP_X1);
  atPlusPlusCore(dup_code,doDup,token,isPost,expr);
  atFieldAssignCore(f,is_static,fi,is2w);
}
Program: 25773
Project: 25773
Buggy source:
protected void atFieldAssign(Expr expr,int op,ASTree left,ASTree right,boolean doDup) throws CompileError {
  CtField f=fieldAccess(left);
  boolean is_static=resultStatic;
  if (op != '=' && !is_static)   bytecode.addOpcode(DUP);
  int fi;
  if (op == '=') {
    FieldInfo finfo=f.getFieldInfo2();
    setFieldType(finfo);
    AccessorMaker maker=isAccessibleField(f,finfo);
    if (maker == null)     fi=addFieldrefInfo(f,finfo);
 else     fi=0;
  }
 else   fi=atFieldRead(f,is_static);
  int fType=exprType;
  int fDim=arrayDim;
  String cname=className;
  atAssignCore(expr,op,right,fType,fDim,cname);
  boolean is2w=is2word(fType,fDim);
  if (doDup) {
    int dup_code;
    if (is_static)     dup_code=(is2w ? DUP2 : DUP);
 else     dup_code=(is2w ? DUP2_X1 : DUP_X1);
    bytecode.addOpcode(dup_code);
  }
  atFieldAssignCore(f,is_static,fi,is2w);
  exprType=fType;
  arrayDim=fDim;
  className=cname;
}

Fixed version (ground truth):
protected void atFieldAssign(Expr expr,int op,ASTree left,ASTree right,boolean doDup) throws CompileError {
  CtField f=fieldAccess(left,false);
  boolean is_static=resultStatic;
  if (op != '=' && !is_static)   bytecode.addOpcode(DUP);
  int fi;
  if (op == '=') {
    FieldInfo finfo=f.getFieldInfo2();
    setFieldType(finfo);
    AccessorMaker maker=isAccessibleField(f,finfo);
    if (maker == null)     fi=addFieldrefInfo(f,finfo);
 else     fi=0;
  }
 else   fi=atFieldRead(f,is_static);
  int fType=exprType;
  int fDim=arrayDim;
  String cname=className;
  atAssignCore(expr,op,right,fType,fDim,cname);
  boolean is2w=is2word(fType,fDim);
  if (doDup) {
    int dup_code;
    if (is_static)     dup_code=(is2w ? DUP2 : DUP);
 else     dup_code=(is2w ? DUP2_X1 : DUP_X1);
    bytecode.addOpcode(dup_code);
  }
  atFieldAssignCore(f,is_static,fi,is2w);
  exprType=fType;
  arrayDim=fDim;
  className=cname;
}
Program: 25774
Project: 25774
Buggy source:
void prune(ConstPool cp){
  LinkedList newAttributes=new LinkedList();
  AttributeInfo invisibleAnnotations=getAttribute(AnnotationsAttribute.invisibleTag);
  if (invisibleAnnotations != null) {
    invisibleAnnotations=invisibleAnnotations.copy(cp,null);
    newAttributes.add(invisibleAnnotations);
  }
  AttributeInfo visibleAnnotations=getAttribute(AnnotationsAttribute.visibleTag);
  if (visibleAnnotations != null) {
    visibleAnnotations=visibleAnnotations.copy(cp,null);
    newAttributes.add(visibleAnnotations);
  }
  attribute=newAttributes;
  int index=getConstantValue();
  if (index != 0) {
    index=constPool.copy(index,cp,null);
    attribute.add(new ConstantAttribute(cp,index));
  }
  name=cp.addUtf8Info(getName());
  descriptor=cp.addUtf8Info(getDescriptor());
  constPool=cp;
}

Fixed version (ground truth):
void prune(ConstPool cp){
  LinkedList newAttributes=new LinkedList();
  AttributeInfo invisibleAnnotations=getAttribute(AnnotationsAttribute.invisibleTag);
  if (invisibleAnnotations != null) {
    invisibleAnnotations=invisibleAnnotations.copy(cp,null);
    newAttributes.add(invisibleAnnotations);
  }
  AttributeInfo visibleAnnotations=getAttribute(AnnotationsAttribute.visibleTag);
  if (visibleAnnotations != null) {
    visibleAnnotations=visibleAnnotations.copy(cp,null);
    newAttributes.add(visibleAnnotations);
  }
  int index=getConstantValue();
  if (index != 0) {
    index=constPool.copy(index,cp,null);
    newAttributes.add(new ConstantAttribute(cp,index));
  }
  attribute=newAttributes;
  name=cp.addUtf8Info(getName());
  descriptor=cp.addUtf8Info(getDescriptor());
  constPool=cp;
}
Program: 25775
Project: 25775
Buggy source:
private int compileOprands(BinExpr expr) throws CompileError {
  expr.oprand1().accept(this);
  int type1=exprType;
  int dim1=arrayDim;
  expr.oprand2().accept(this);
  if (dim1 != arrayDim && type1 != NULL && exprType != NULL)   throw new CompileError("String_Node_Str");
  if (type1 == NULL)   return exprType;
 else   return type1;
}

Fixed version (ground truth):
private int compileOprands(BinExpr expr) throws CompileError {
  expr.oprand1().accept(this);
  int type1=exprType;
  int dim1=arrayDim;
  expr.oprand2().accept(this);
  if (dim1 != arrayDim)   if (type1 != NULL && exprType != NULL)   throw new CompileError("String_Node_Str");
 else   if (exprType == NULL)   arrayDim=dim1;
  if (type1 == NULL)   return exprType;
 else   return type1;
}
Program: 25776
Project: 25776
Buggy source:
private int compileOprands(BinExpr expr) throws CompileError {
  expr.oprand1().accept(this);
  int type1=exprType;
  int dim1=arrayDim;
  expr.oprand2().accept(this);
  if (dim1 != arrayDim)   throw new CompileError("String_Node_Str");
  return type1;
}

Fixed version (ground truth):
private int compileOprands(BinExpr expr) throws CompileError {
  expr.oprand1().accept(this);
  int type1=exprType;
  int dim1=arrayDim;
  expr.oprand2().accept(this);
  if (dim1 != arrayDim && type1 != NULL && exprType != NULL)   throw new CompileError("String_Node_Str");
  if (type1 == NULL)   return exprType;
 else   return type1;
}
Program: 25777
Project: 25777
Buggy source:
/** 
 * Obtains the name of this constructor. It is the same as the simple name of the class declaring this constructor.  If this object represents a class initializer, then this method returns <code>"&lt;clinit&gt;"</code>.
 */
public String getName(){
  if (methodInfo.isStaticInitializer())   return MethodInfo.nameClinit;
 else   return declaringClass.getName();
}

Fixed version (ground truth):
/** 
 * Obtains the name of this constructor. It is the same as the simple name of the class declaring this constructor.  If this object represents a class initializer, then this method returns <code>"&lt;clinit&gt;"</code>.
 */
public String getName(){
  if (methodInfo.isStaticInitializer())   return MethodInfo.nameClinit;
 else   return declaringClass.getSimpleName();
}
Program: 25778
Project: 25778
Buggy source:
/** 
 * Finds the specified class using <code>ClassPath</code>. If the source throws an exception, this returns null. <p>This method can be overridden by a subclass of <code>Loader</code>.
 */
protected Class findClass(String name){
  byte[] classfile;
  try {
    if (source != null) {
      if (translator != null)       translator.onLoad(source,name);
      classfile=source.get(name).toBytecode();
    }
 else {
      String jarname="String_Node_Str" + name.replace('.','/') + "String_Node_Str";
      InputStream in=this.getClass().getResourceAsStream(jarname);
      classfile=ClassPoolTail.readStream(in);
    }
  }
 catch (  Exception e) {
    return null;
  }
  int i=name.lastIndexOf('.');
  if (i != -1) {
    String pname=name.substring(0,i);
    if (getPackage(pname) == null)     try {
      definePackage(pname,null,null,null,null,null,null,null);
    }
 catch (    IllegalArgumentException e) {
    }
  }
  return defineClass(name,classfile,0,classfile.length);
}

Fixed version (ground truth):
/** 
 * Finds the specified class using <code>ClassPath</code>. If the source throws an exception, this returns null. <p>This method can be overridden by a subclass of <code>Loader</code>.  Note that the overridden method must not throw an exception when it just fails to find a class file.
 * @return      null if the specified class could not be found.
 * @throws ClassNotFoundException   if an exception is thrown whileobtaining a class file.
 */
protected Class findClass(String name) throws ClassNotFoundException {
  byte[] classfile;
  try {
    if (source != null) {
      if (translator != null)       translator.onLoad(source,name);
      try {
        classfile=source.get(name).toBytecode();
      }
 catch (      NotFoundException e) {
        return null;
      }
    }
 else {
      String jarname="String_Node_Str" + name.replace('.','/') + "String_Node_Str";
      InputStream in=this.getClass().getResourceAsStream(jarname);
      if (in == null)       return null;
      classfile=ClassPoolTail.readStream(in);
    }
  }
 catch (  Exception e) {
    throw new ClassNotFoundException("String_Node_Str" + name,e);
  }
  int i=name.lastIndexOf('.');
  if (i != -1) {
    String pname=name.substring(0,i);
    if (getPackage(pname) == null)     try {
      definePackage(pname,null,null,null,null,null,null,null);
    }
 catch (    IllegalArgumentException e) {
    }
  }
  return defineClass(name,classfile,0,classfile.length);
}
Program: 25779
Project: 25779
Buggy source:
private static void getMethods0(HashMap h,CtClass cc){
  try {
    CtClass[] ifs=cc.getInterfaces();
    int size=ifs.length;
    for (int i=0; i < size; ++i)     getMethods0(h,ifs[i]);
  }
 catch (  NotFoundException e) {
  }
  try {
    CtClass s=cc.getSuperclass();
    if (s != null)     getMethods0(h,s);
  }
 catch (  NotFoundException e) {
  }
  if (cc instanceof CtClassType) {
    CtMethod cm=((CtClassType)cc).getMethodsCache();
    while (cm != null) {
      if (Modifier.isPublic(cm.getModifiers()))       h.put(cm,cm);
      cm=cm.next;
    }
  }
}

Fixed version (ground truth):
private static void getMethods0(HashMap h,CtClass cc){
  try {
    CtClass[] ifs=cc.getInterfaces();
    int size=ifs.length;
    for (int i=0; i < size; ++i)     getMethods0(h,ifs[i]);
  }
 catch (  NotFoundException e) {
  }
  try {
    CtClass s=cc.getSuperclass();
    if (s != null)     getMethods0(h,s);
  }
 catch (  NotFoundException e) {
  }
  if (cc instanceof CtClassType) {
    CtMethod cm=((CtClassType)cc).getMethodsCache();
    while (cm != null) {
      if (Modifier.isPublic(cm.getModifiers()))       h.put(cm.getStringRep(),cm);
      cm=cm.next;
    }
  }
}
Program: 25780
Project: 25780
Buggy source:
/** 
 * Returns a hash code value for the method. If two methods have the same name and signature, then the hash codes for the two methods are equal.
 */
public int hashCode(){
  if (cachedHashCode == 0) {
    String signature=methodInfo.getName() + ':' + methodInfo.getDescriptor();
    cachedHashCode=System.identityHashCode(signature.intern());
  }
  return cachedHashCode;
}

Fixed version (ground truth):
/** 
 * Returns a hash code value for the method. If two methods have the same name and signature, then the hash codes for the two methods are equal.
 */
public int hashCode(){
  return getStringRep().hashCode();
}
Program: 25781
Project: 25781
Buggy source:
/** 
 * Indicates whether <code>obj</code> has the same name and the same signature as this method.
 */
public boolean equals(Object obj){
  return obj != null && obj instanceof CtMethod && obj.hashCode() == hashCode();
}

Fixed version (ground truth):
/** 
 * Indicates whether <code>obj</code> has the same name and the same signature as this method.
 */
public boolean equals(Object obj){
  return obj != null && obj instanceof CtMethod && ((CtMethod)obj).getStringRep().equals(getStringRep());
}
Program: 25782
Project: 25782
Buggy source:
private void testExistingMethod(String name,String descriptor) throws CannotCompileException {
  ListIterator it=methods.listIterator(0);
  while (it.hasNext()) {
    MethodInfo minfo=(MethodInfo)it.next();
    if (minfo.getName().equals(name) && Descriptor.eqSignature(minfo.getDescriptor(),descriptor))     throw new CannotCompileException("String_Node_Str" + name);
  }
}

Fixed version (ground truth):
private void testExistingMethod(String name,String descriptor) throws CannotCompileException {
  ListIterator it=methods.listIterator(0);
  while (it.hasNext()) {
    MethodInfo minfo=(MethodInfo)it.next();
    if (minfo.getName().equals(name) && Descriptor.eqParamTypes(minfo.getDescriptor(),descriptor))     throw new CannotCompileException("String_Node_Str" + name);
  }
}
Program: 25783
Project: 25783
Buggy source:
/** 
 * Returns an array of the methods defined on the given reflective object.  This method is for the internal use only.
 */
public final Method[] getReflectiveMethods(){
  if (methods != null)   return methods;
  Class baseclass=getJavaClass();
  Method[] allmethods=baseclass.getMethods();
  int n=allmethods.length;
  methods=new Method[n];
  for (int i=0; i < n; ++i) {
    Method m=allmethods[i];
    if (m.getDeclaringClass() == baseclass) {
      String mname=m.getName();
      if (mname.startsWith(methodPrefix)) {
        int k=0;
        for (int j=methodPrefixLen; ; ++j) {
          char c=mname.charAt(j);
          if ('0' <= c && c <= '9')           k=k * 10 + c - '0';
 else           break;
        }
        methods[k]=m;
      }
    }
  }
  return methods;
}

Fixed version (ground truth):
/** 
 * Returns an array of the methods defined on the given reflective object.  This method is for the internal use only.
 */
public final Method[] getReflectiveMethods(){
  if (methods != null)   return methods;
  Class baseclass=getJavaClass();
  Method[] allmethods=baseclass.getDeclaredMethods();
  int n=allmethods.length;
  methods=new Method[n];
  for (int i=0; i < n; ++i) {
    Method m=allmethods[i];
    String mname=m.getName();
    if (mname.startsWith(methodPrefix)) {
      int k=0;
      for (int j=methodPrefixLen; ; ++j) {
        char c=mname.charAt(j);
        if ('0' <= c && c <= '9')         k=k * 10 + c - '0';
 else         break;
      }
      methods[k]=m;
    }
  }
  return methods;
}
Program: 25784
Project: 25784
Buggy source:
private void processMethods0(int mod,CtClass clazz,CtMethod m,int identifier,boolean dontSearch) throws CannotCompileException, NotFoundException {
  CtMethod body;
  String name=m.getName();
  if (isExcluded(name))   return;
  CtMethod m2;
  if (m.getDeclaringClass() == clazz) {
    if (Modifier.isNative(mod))     return;
    m2=m;
  }
 else {
    if (Modifier.isFinal(mod))     return;
    mod&=~Modifier.NATIVE;
    m2=CtNewMethod.delegator(findOriginal(m,dontSearch),clazz);
    m2.setModifiers(mod);
    clazz.addMethod(m2);
  }
  m2.setName(ClassMetaobject.methodPrefix + identifier + "String_Node_Str"+ name);
  if (Modifier.isStatic(mod))   body=trapStaticMethod;
 else   body=trapMethod;
  CtMethod wmethod=CtNewMethod.wrapped(m.getReturnType(),name,m.getParameterTypes(),m.getExceptionTypes(),body,ConstParameter.integer(identifier),clazz);
  wmethod.setModifiers(mod);
  clazz.addMethod(wmethod);
}

Fixed version (ground truth):
private void processMethods0(int mod,CtClass clazz,CtMethod m,int identifier,boolean dontSearch) throws CannotCompileException, NotFoundException {
  CtMethod body;
  String name=m.getName();
  if (isExcluded(name))   return;
  CtMethod m2;
  if (m.getDeclaringClass() == clazz) {
    if (Modifier.isNative(mod))     return;
    m2=m;
    if (Modifier.isFinal(mod)) {
      mod&=~Modifier.FINAL;
      m2.setModifiers(mod);
    }
  }
 else {
    if (Modifier.isFinal(mod))     return;
    mod&=~Modifier.NATIVE;
    m2=CtNewMethod.delegator(findOriginal(m,dontSearch),clazz);
    m2.setModifiers(mod);
    clazz.addMethod(m2);
  }
  m2.setName(ClassMetaobject.methodPrefix + identifier + "String_Node_Str"+ name);
  if (Modifier.isStatic(mod))   body=trapStaticMethod;
 else   body=trapMethod;
  CtMethod wmethod=CtNewMethod.wrapped(m.getReturnType(),name,m.getParameterTypes(),m.getExceptionTypes(),body,ConstParameter.integer(identifier),clazz);
  wmethod.setModifiers(mod);
  clazz.addMethod(wmethod);
}
Program: 25788
Project: 25788
Buggy source:
/** 
 * Adjusts start_pc and length if bytecode is inserted in a method body.
 */
void shiftPc(int where,int gapLength,boolean exclusive){
  int n=tableLength();
  for (int i=0; i < n; ++i) {
    int pos=i * 10 + 2;
    int pc=ByteArray.readU16bit(info,pos);
    int len=ByteArray.readU16bit(info,pos + 2);
    if (pc > where || (exclusive && pc == where))     ByteArray.write16bit(pc + gapLength,info,pos);
 else     if (pc + len > where)     ByteArray.write16bit(len + gapLength,info,pos + 2);
  }
}

Fixed version (ground truth):
/** 
 * Adjusts start_pc and length if bytecode is inserted in a method body.
 */
void shiftPc(int where,int gapLength,boolean exclusive){
  int n=tableLength();
  for (int i=0; i < n; ++i) {
    int pos=i * 10 + 2;
    int pc=ByteArray.readU16bit(info,pos);
    int len=ByteArray.readU16bit(info,pos + 2);
    if (pc > where || (exclusive && pc == where && pc != 0))     ByteArray.write16bit(pc + gapLength,info,pos);
 else     if (pc + len > where)     ByteArray.write16bit(len + gapLength,info,pos + 2);
  }
}
Program: 25789
Project: 25789
Buggy source:
/** 
 * Opens a class file. This method may be called just to examine whether the class file exists as well as to read the contents of the file. <p>This method can return null if the specified class file is not found.  If null is returned, the next search path is examined. However, if an error happens, this method must throw an exception  so that the search will be terminated. <p>This method should not modify the contents of the class file. Use <code>javassist.Translator</code> for modification.
 * @param classname         a fully-qualified class name
 * @return          the input stream for reading a class file
 * @see javassist.Translator
 */
InputStream openClassfile(String classname) throws NotFoundException ;

Fixed version (ground truth):
/** 
 * Opens a class file. This method may be called just to examine whether the class file exists as well as to read the contents of the file. <p>This method can return null if the specified class file is not found.  If null is returned, the next search path is examined. However, if an error happens, this method must throw an exception  so that the search will be terminated. <p>This method should not modify the contents of the class file.
 * @param classname         a fully-qualified class name
 * @return          the input stream for reading a class file
 * @see javassist.Translator
 */
InputStream openClassfile(String classname) throws NotFoundException ;
Program: 25790
Project: 25790
Buggy source:
/** 
 * Creates a class pool.
 * @param p         the parent of this class pool.  If this is a rootclass pool, this parameter must be <code>null</code>.
 * @see javassist.ClassPool#getDefault()
 */
public ClassPool(ClassPool parent){
  this.classes=new Hashtable();
  this.source=new ClassPoolTail();
  this.parent=parent;
  if (parent == null) {
    CtClass[] pt=CtClass.primitiveTypes;
    for (int i=0; i < pt.length; ++i)     classes.put(pt[i].getName(),pt[i]);
  }
  this.cflow=null;
}

Fixed version (ground truth):
/** 
 * Creates a class pool.
 * @param parent    the parent of this class pool.  If this is a rootclass pool, this parameter must be <code>null</code>.
 * @see javassist.ClassPool#getDefault()
 */
public ClassPool(ClassPool parent){
  this.classes=new Hashtable();
  this.source=new ClassPoolTail();
  this.parent=parent;
  if (parent == null) {
    CtClass[] pt=CtClass.primitiveTypes;
    for (int i=0; i < pt.length; ++i)     classes.put(pt[i].getName(),pt[i]);
  }
  this.cflow=null;
}
Program: 25791
Project: 25791
Buggy source:
/** 
 * Returns the default class pool. The returned object is always identical since this method is a singleton factory. <p>The default class pool searches the system search path, which usually includes the platform library, extension libraries, and the search path specified by the <code>-classpath</code> option or the <code>CLASSPATH</code> environment variable. <p>When this method is called for the first time, the default class pool is created with the following code snippet: <ul><code>ClassPool cp = new ClassPool(null); cp.appendSystemPath(); </code></ul> <p>If the default class pool cannot find any class files, try <code>ClassClassPath</code> and <code>LoaderClassPath</code>.
 * @param t         null or the translator linked to the class pool.
 * @see ClassClassPath
 * @see LoaderClassPath
 */
public static synchronized ClassPool getDefault(){
  if (defaultPool == null) {
    defaultPool=new ClassPool(null);
    defaultPool.appendSystemPath();
  }
  return defaultPool;
}

Fixed version (ground truth):
/** 
 * Returns the default class pool. The returned object is always identical since this method is a singleton factory. <p>The default class pool searches the system search path, which usually includes the platform library, extension libraries, and the search path specified by the <code>-classpath</code> option or the <code>CLASSPATH</code> environment variable. <p>When this method is called for the first time, the default class pool is created with the following code snippet: <ul><code>ClassPool cp = new ClassPool(null); cp.appendSystemPath(); </code></ul> <p>If the default class pool cannot find any class files, try <code>ClassClassPath</code> and <code>LoaderClassPath</code>.
 * @see ClassClassPath
 * @see LoaderClassPath
 */
public static synchronized ClassPool getDefault(){
  if (defaultPool == null) {
    defaultPool=new ClassPool(null);
    defaultPool.appendSystemPath();
  }
  return defaultPool;
}
Program: 25792
Project: 25792
Buggy source:
/** 
 * Converts this class to a <code>java.lang.Class</code> object. Once this method is called, further modifications are not possible any more. <p>This method is provided for convenience.  If you need more complex functionality, you should write your own class loader. <p>To load a class file, this method uses an internal class loader, which is an instance of <code>ClassPool.SimpleLoader</code>. Thus, that class file is not loaded by the system class loader, which should have loaded this <code>CtClass</code> class. The internal class loader loads only the classes explicitly specified by this method <code>toClass()</code>.  The other classes are loaded by the parent class loader (usually the sytem class loader) by delegation. <p>For example, <ul><pre>class Line { Point p1, p2; }</pre></ul> <p>If the class <code>Line</code> is loaded by the internal class loader and the class <code>Point</code> has not been loaded yet, then the class <code>Point</code> that the class <code>Line</code> refers to is loaded by the parent class loader.  There is no chance of modifying the definition of <code>Point</code> with Javassist. <p>The internal class loader is shared among all the instances of <code>ClassPool</code>.
 * @return the <code>Class</code> object representing the loaded class.  
 * @see CtClass#forName(String)
 * @see ClassPool.SimpleClassLoader
 * @see Loader
 */
public Class toClass() throws NotFoundException, IOException, CannotCompileException {
  return ClassPool.loadClass(getName(),toBytecode());
}

Fixed version (ground truth):
/** 
 * Converts this class to a <code>java.lang.Class</code> object. Once this method is called, further modifications are not possible any more. <p>This method is provided for convenience.  If you need more complex functionality, you should write your own class loader. <p>To load a class file, this method uses an internal class loader, which is an instance of <code>ClassPool.SimpleLoader</code>. Thus, that class file is not loaded by the system class loader, which should have loaded this <code>CtClass</code> class. The internal class loader loads only the classes explicitly specified by this method <code>toClass()</code>.  The other classes are loaded by the parent class loader (usually the sytem class loader) by delegation. <p>For example, <ul><pre>class Line { Point p1, p2; }</pre></ul> <p>If the class <code>Line</code> is loaded by the internal class loader and the class <code>Point</code> has not been loaded yet, then the class <code>Point</code> that the class <code>Line</code> refers to is loaded by the parent class loader.  There is no chance of modifying the definition of <code>Point</code> with Javassist. <p>The internal class loader is shared among all the instances of <code>ClassPool</code>.
 * @return the <code>Class</code> object representing the loaded class.  
 * @see CtClass#forName(String)
 * @see ClassPool.SimpleLoader
 * @see Loader
 */
public Class toClass() throws NotFoundException, IOException, CannotCompileException {
  return ClassPool.loadClass(getName(),toBytecode());
}
Program: 25793
Project: 25793
Buggy source:
/** 
 * Returns a <code>java.lang.Class</code> object that has been loaded by <code>toClass()</code>.  Such an object cannot be obtained by <code>java.lang.Class.forName()</code> because it has been loaded by an internal class loader of Javassist.
 * @see CtClass#toClass()
 * @see ClassPool.SimpleClassLoader
 */
public static Class forName(String name) throws ClassNotFoundException {
  return ClassPool.forName(name);
}

Fixed version (ground truth):
/** 
 * Returns a <code>java.lang.Class</code> object that has been loaded by <code>toClass()</code>.  Such an object cannot be obtained by <code>java.lang.Class.forName()</code> because it has been loaded by an internal class loader of Javassist.
 * @see CtClass#toClass()
 * @see ClassPool.SimpleLoader
 */
public static Class forName(String name) throws ClassNotFoundException {
  return ClassPool.forName(name);
}
Program: 25794
Project: 25794
Buggy source:
/** 
 * Finds the specified class using <code>ClassPath</code>. If the source throws an exception, this returns null. <p>This method can be overridden by a subclass of <code>Loader</code>.
 */
protected Class findClass(String name){
  byte[] classfile;
  try {
    if (source != null) {
      CtClass c=source.get(name);
      if (translator != null)       translator.onWrite(source,c);
      classfile=c.toBytecode();
    }
 else {
      String jarname="String_Node_Str" + name.replace('.','/') + "String_Node_Str";
      InputStream in=this.getClass().getResourceAsStream(jarname);
      classfile=ClassPoolTail.readStream(in);
    }
  }
 catch (  Exception e) {
    return null;
  }
  int i=name.lastIndexOf('.');
  if (i != -1) {
    String pname=name.substring(0,i);
    if (getPackage(pname) == null)     try {
      definePackage(pname,null,null,null,null,null,null,null);
    }
 catch (    IllegalArgumentException e) {
    }
  }
  return defineClass(name,classfile,0,classfile.length);
}

Fixed version (ground truth):
/** 
 * Finds the specified class using <code>ClassPath</code>. If the source throws an exception, this returns null. <p>This method can be overridden by a subclass of <code>Loader</code>.
 */
protected Class findClass(String name){
  byte[] classfile;
  try {
    if (source != null) {
      if (translator != null)       translator.onLoad(source,name);
      classfile=source.get(name).toBytecode();
    }
 else {
      String jarname="String_Node_Str" + name.replace('.','/') + "String_Node_Str";
      InputStream in=this.getClass().getResourceAsStream(jarname);
      classfile=ClassPoolTail.readStream(in);
    }
  }
 catch (  Exception e) {
    return null;
  }
  int i=name.lastIndexOf('.');
  if (i != -1) {
    String pname=name.substring(0,i);
    if (getPackage(pname) == null)     try {
      definePackage(pname,null,null,null,null,null,null,null);
    }
 catch (    IllegalArgumentException e) {
    }
  }
  return defineClass(name,classfile,0,classfile.length);
}
Program: 25795
Project: 25795
Buggy source:
private static void processClasses(CompiledClass[] entries,int n) throws Exception {
  Reflection implementor=new Reflection();
  ClassPool pool=ClassPool.getDefault();
  implementor.start(pool);
  for (int i=0; i < n; ++i) {
    CtClass c=pool.get(entries[i].classname);
    if (entries[i].metaobject != null || entries[i].classobject != null) {
      String metaobj, classobj;
      if (entries[i].metaobject == null)       metaobj="String_Node_Str";
 else       metaobj=entries[i].metaobject;
      if (entries[i].classobject == null)       classobj="String_Node_Str";
 else       classobj=entries[i].classobject;
      if (!implementor.makeReflective(c,pool.get(metaobj),pool.get(classobj)))       System.err.println("String_Node_Str" + c.getName() + "String_Node_Str");
      System.err.println(c.getName() + "String_Node_Str" + metaobj+ "String_Node_Str"+ classobj);
    }
 else     System.err.println(c.getName() + "String_Node_Str");
  }
  for (int i=0; i < n; ++i) {
    CtClass c=pool.get(entries[i].classname);
    implementor.onWrite(pool,c);
    c.writeFile();
  }
}

Fixed version (ground truth):
private static void processClasses(CompiledClass[] entries,int n) throws Exception {
  Reflection implementor=new Reflection();
  ClassPool pool=ClassPool.getDefault();
  implementor.start(pool);
  for (int i=0; i < n; ++i) {
    CtClass c=pool.get(entries[i].classname);
    if (entries[i].metaobject != null || entries[i].classobject != null) {
      String metaobj, classobj;
      if (entries[i].metaobject == null)       metaobj="String_Node_Str";
 else       metaobj=entries[i].metaobject;
      if (entries[i].classobject == null)       classobj="String_Node_Str";
 else       classobj=entries[i].classobject;
      if (!implementor.makeReflective(c,pool.get(metaobj),pool.get(classobj)))       System.err.println("String_Node_Str" + c.getName() + "String_Node_Str");
      System.err.println(c.getName() + "String_Node_Str" + metaobj+ "String_Node_Str"+ classobj);
    }
 else     System.err.println(c.getName() + "String_Node_Str");
  }
  for (int i=0; i < n; ++i) {
    implementor.onLoad(pool,entries[i].classname);
    pool.get(entries[i].classname).writeFile();
  }
}
Program: 25796
Project: 25796
Buggy source:
/** 
 * Initializes.
 */
public void start(ClassPool pool) throws NotFoundException {
  classPool=pool;
  final String msg="String_Node_Str";
  try {
    CtClass c=classPool.get("String_Node_Str");
    trapMethod=c.getDeclaredMethod("String_Node_Str");
    trapStaticMethod=c.getDeclaredMethod("String_Node_Str");
    trapRead=c.getDeclaredMethod("String_Node_Str");
    trapWrite=c.getDeclaredMethod("String_Node_Str");
    readParam=new CtClass[]{classPool.get("String_Node_Str")};
  }
 catch (  NotFoundException e) {
    throw new RuntimeException(msg);
  }
}

Fixed version (ground truth):
/** 
 * Initializes the object.
 */
public void start(ClassPool pool) throws NotFoundException {
  classPool=pool;
  final String msg="String_Node_Str";
  try {
    CtClass c=classPool.get("String_Node_Str");
    trapMethod=c.getDeclaredMethod("String_Node_Str");
    trapStaticMethod=c.getDeclaredMethod("String_Node_Str");
    trapRead=c.getDeclaredMethod("String_Node_Str");
    trapWrite=c.getDeclaredMethod("String_Node_Str");
    readParam=new CtClass[]{classPool.get("String_Node_Str")};
  }
 catch (  NotFoundException e) {
    throw new RuntimeException(msg);
  }
}
Program: 25797
Project: 25797
Buggy source:
/** 
 * Creates a public setter method.  The setter method assigns the value of the first parameter to the specified field in the class to which this method is added. The created method is initially not static even if the field is static.  Change the modifiers if the method should be static.
 * @param methodName        the name of the setter
 * @param field             the field accessed.
 */
public static CtMethod setter(String methodName,CtField field) throws CannotCompileException {
  FieldInfo finfo=field.getFieldInfo2();
  String fieldType=finfo.getDescriptor();
  String desc="String_Node_Str" + fieldType + "String_Node_Str";
  ConstPool cp=finfo.getConstPool();
  MethodInfo minfo=new MethodInfo(cp,methodName,desc);
  minfo.setAccessFlags(AccessFlag.PUBLIC);
  Bytecode code=new Bytecode(cp,3,3);
  try {
    String fieldName=finfo.getName();
    if ((finfo.getAccessFlags() & AccessFlag.STATIC) == 0) {
      code.addAload(0);
      code.addLoad(1,field.getType());
      code.addPutfield(Bytecode.THIS,fieldName,fieldType);
    }
 else {
      code.addLoad(0,field.getType());
      code.addPutstatic(Bytecode.THIS,fieldName,fieldType);
    }
    code.addReturn(null);
  }
 catch (  NotFoundException e) {
    throw new CannotCompileException(e);
  }
  minfo.setCodeAttribute(code.toCodeAttribute());
  return new CtMethod(minfo,field.getDeclaringClass());
}

Fixed version (ground truth):
/** 
 * Creates a public setter method.  The setter method assigns the value of the first parameter to the specified field in the class to which this method is added. The created method is not static even if the field is static.  You may not change it to be static by <code>setModifiers()</code> in <code>CtBehavior</code>.
 * @param methodName        the name of the setter
 * @param field             the field accessed.
 */
public static CtMethod setter(String methodName,CtField field) throws CannotCompileException {
  FieldInfo finfo=field.getFieldInfo2();
  String fieldType=finfo.getDescriptor();
  String desc="String_Node_Str" + fieldType + "String_Node_Str";
  ConstPool cp=finfo.getConstPool();
  MethodInfo minfo=new MethodInfo(cp,methodName,desc);
  minfo.setAccessFlags(AccessFlag.PUBLIC);
  Bytecode code=new Bytecode(cp,3,3);
  try {
    String fieldName=finfo.getName();
    if ((finfo.getAccessFlags() & AccessFlag.STATIC) == 0) {
      code.addAload(0);
      code.addLoad(1,field.getType());
      code.addPutfield(Bytecode.THIS,fieldName,fieldType);
    }
 else {
      code.addLoad(1,field.getType());
      code.addPutstatic(Bytecode.THIS,fieldName,fieldType);
    }
    code.addReturn(null);
  }
 catch (  NotFoundException e) {
    throw new CannotCompileException(e);
  }
  minfo.setCodeAttribute(code.toCodeAttribute());
  return new CtMethod(minfo,field.getDeclaringClass());
}
Program: 25798
Project: 25798
Buggy source:
public void write(DataOutputStream dos) throws IOException {
  dos.writeShort(type_index);
  dos.writeShort(members.size());
  Iterator it=members.keySet().iterator();
  while (it.hasNext()) {
    String name=(String)it.next();
    Short index=(Short)memberName2Index.get(name);
    dos.writeShort(index.shortValue());
    MemberValue value=(MemberValue)members.get(name);
    value.write(dos);
  }
}

Fixed version (ground truth):
public void write(DataOutputStream dos) throws IOException {
  dos.writeShort(type_index);
  if (members == null) {
    dos.writeShort((short)0);
    return;
  }
  dos.writeShort(members.size());
  Iterator it=members.keySet().iterator();
  while (it.hasNext()) {
    String name=(String)it.next();
    Short index=(Short)memberName2Index.get(name);
    dos.writeShort(index.shortValue());
    MemberValue value=(MemberValue)members.get(name);
    value.write(dos);
  }
}
Program: 25799
Project: 25799
Buggy source:
/** 
 * todo Enums are not supported right now. This is for creation at runtime
 * @param clazz
 */
public AnnotationInfo(ConstPool cp,CtClass clazz) throws javassist.NotFoundException {
  if (!clazz.isInterface())   throw new RuntimeException("String_Node_Str");
  this.cp=cp;
  type_index=(short)cp.addClassInfo(clazz);
  CtMethod methods[]=clazz.getDeclaredMethods();
  if (methods.length > 0) {
    members=new LinkedHashMap();
    memberName2Index=new HashMap();
  }
  for (int i=0; i < methods.length; i++) {
    CtClass returnType=methods[i].getReturnType();
    if (returnType.equals(CtPrimitiveType.booleanType)) {
      addMemberValue(methods[i].getName(),new BooleanMemberValue((short)-1));
    }
 else     if (returnType.equals(CtPrimitiveType.byteType)) {
      addMemberValue(methods[i].getName(),new ByteMemberValue((short)-1));
    }
 else     if (returnType.equals(CtPrimitiveType.charType)) {
      addMemberValue(methods[i].getName(),new CharMemberValue((short)-1));
    }
 else     if (returnType.equals(CtPrimitiveType.doubleType)) {
      addMemberValue(methods[i].getName(),new DoubleMemberValue((short)-1));
    }
 else     if (returnType.equals(CtPrimitiveType.floatType)) {
      addMemberValue(methods[i].getName(),new FloatMemberValue((short)-1));
    }
 else     if (returnType.equals(CtPrimitiveType.intType)) {
      addMemberValue(methods[i].getName(),new IntegerMemberValue((short)-1));
    }
 else     if (returnType.equals(CtPrimitiveType.longType)) {
      addMemberValue(methods[i].getName(),new LongMemberValue((short)-1));
    }
 else     if (returnType.equals(CtPrimitiveType.shortType)) {
      addMemberValue(methods[i].getName(),new ShortMemberValue((short)-1));
    }
 else     if (returnType.getName().equals("String_Node_Str")) {
      addMemberValue(methods[i].getName(),new ClassMemberValue((short)-1));
    }
 else     if (returnType.getName().equals("String_Node_Str") || returnType.getName().equals("String_Node_Str")) {
      addMemberValue(methods[i].getName(),new StringMemberValue((short)-1));
    }
 else     if (returnType.isArray()) {
      addMemberValue(methods[i].getName(),new ArrayMemberValue());
    }
 else     if (returnType.isInterface()) {
      addMemberValue(methods[i].getName(),new AnnotationMemberValue(null));
    }
 else {
      throw new RuntimeException("String_Node_Str" + returnType.getName());
    }
  }
}

Fixed version (ground truth):
/** 
 * todo Enums are not supported right now. This is for creation at runtime
 * @param clazz
 */
public AnnotationInfo(ConstPool cp,CtClass clazz) throws javassist.NotFoundException {
  if (!clazz.isInterface())   throw new RuntimeException("String_Node_Str");
  this.cp=cp;
  type_index=(short)cp.addClassInfo(clazz);
  CtMethod methods[]=clazz.getDeclaredMethods();
  if (methods.length > 0) {
    members=new LinkedHashMap();
    memberName2Index=new HashMap();
  }
  for (int i=0; i < methods.length; i++) {
    CtClass returnType=methods[i].getReturnType();
    addMemberValue(methods[i].getName(),createMemberValue(cp,returnType));
  }
}
Program: 25800
Project: 25800
Buggy source:
public AnnotationMemberValue(AnnotationInfo a){
  tag='@';
  this.annotation=a;
}

Fixed version (ground truth):
public AnnotationMemberValue(ConstPool cp){
  super('@',cp);
}
Program: 25801
Project: 25801
Buggy source:
public void setValue(MemberValue[] values){
  this.values=values;
}

Fixed version (ground truth):
public void setValue(MemberValue[] values){
  if (values != null && values.length > 0)   type=values[0];
  this.values=values;
}
Program: 25802
Project: 25802
Buggy source:
public static ArrayMemberValue readArray(ConstPool cp,DataInput di) throws java.io.IOException {
  ArrayMemberValue rtn=new ArrayMemberValue();
  int length=di.readShort();
  ArrayList values=new ArrayList(length);
  for (int i=0; i < length; i++) {
    values.add(MemberValue.readMemberValue(cp,di));
  }
  rtn.values=(MemberValue[])values.toArray(new MemberValue[length]);
  return rtn;
}

Fixed version (ground truth):
public static ArrayMemberValue readArray(ConstPool cp,DataInput di) throws java.io.IOException {
  ArrayMemberValue rtn=new ArrayMemberValue(cp);
  int length=di.readShort();
  ArrayList values=new ArrayList(length);
  for (int i=0; i < length; i++) {
    MemberValue type=MemberValue.readMemberValue(cp,di);
    rtn.type=type;
    values.add(type);
  }
  rtn.values=(MemberValue[])values.toArray(new MemberValue[length]);
  return rtn;
}
Program: 25803
Project: 25803
Buggy source:
public String toString(){
  StringBuffer buf=new StringBuffer("String_Node_Str");
  for (int i=0; i < values.length; i++) {
    buf.append(values[i].toString());
    if (i + 1 < values.length)     buf.append("String_Node_Str");
  }
  buf.append("String_Node_Str");
  return buf.toString();
}

Fixed version (ground truth):
public String toString(){
  StringBuffer buf=new StringBuffer("String_Node_Str");
  if (values != null) {
    for (int i=0; i < values.length; i++) {
      buf.append(values[i].toString());
      if (i + 1 < values.length)       buf.append("String_Node_Str");
    }
  }
  buf.append("String_Node_Str");
  return buf.toString();
}
Program: 25804
Project: 25804
Buggy source:
public void write(DataOutputStream dos) throws IOException {
  super.write(dos);
  dos.writeShort(values.length);
  for (int i=0; i < values.length; i++) {
    values[i].write(dos);
  }
}

Fixed version (ground truth):
public void write(DataOutputStream dos) throws IOException {
  super.write(dos);
  if (values == null) {
    dos.writeShort(0);
    return;
  }
  dos.writeShort(values.length);
  for (int i=0; i < values.length; i++) {
    values[i].write(dos);
  }
}
Program: 25805
Project: 25805
Buggy source:
public ArrayMemberValue(){
  tag='[';
}

Fixed version (ground truth):
public ArrayMemberValue(MemberValue type,ConstPool cp){
  this(cp);
  this.type=type;
}
Program: 25806
Project: 25806
Buggy source:
public BooleanMemberValue(short cvi){
  tag='Z';
  this.const_value_index=cvi;
}

Fixed version (ground truth):
public BooleanMemberValue(ConstPool cp){
  super('Z',cp);
  setValue(false);
}
Program: 25807
Project: 25807
Buggy source:
public ByteMemberValue(short const_value_index){
  tag='B';
  this.const_value_index=const_value_index;
}

Fixed version (ground truth):
public ByteMemberValue(ConstPool cp){
  super('B',cp);
  setValue((byte)0);
}
Program: 25808
Project: 25808
Buggy source:
public Method lookupMethod(CtClass clazz,MethodInfo current,String methodName,int[] argTypes,int[] argDims,String[] argClassNames,boolean onlyExact) throws CompileError {
  Method maybe=null;
  if (current != null)   if (current.getName().equals(methodName)) {
    int res=compareSignature(current.getDescriptor(),argTypes,argDims,argClassNames);
    Method r=new Method(clazz,current);
    if (res == YES)     return r;
 else     if (res == MAYBE && maybe == null)     maybe=r;
  }
  List list=clazz.getClassFile2().getMethods();
  int n=list.size();
  for (int i=0; i < n; ++i) {
    MethodInfo minfo=(MethodInfo)list.get(i);
    if (minfo.getName().equals(methodName)) {
      int res=compareSignature(minfo.getDescriptor(),argTypes,argDims,argClassNames);
      Method r=new Method(clazz,minfo);
      if (res == YES)       return r;
 else       if (res == MAYBE && maybe == null)       maybe=r;
    }
  }
  try {
    CtClass pclazz=clazz.getSuperclass();
    if (pclazz != null) {
      Method r=lookupMethod(pclazz,null,methodName,argTypes,argDims,argClassNames,(onlyExact || maybe != null));
      if (r != null)       return r;
    }
  }
 catch (  NotFoundException e) {
  }
  if (onlyExact)   return null;
 else   return maybe;
}

Fixed version (ground truth):
public Method lookupMethod(CtClass clazz,MethodInfo current,String methodName,int[] argTypes,int[] argDims,String[] argClassNames,boolean onlyExact) throws CompileError {
  Method maybe=null;
  if (current != null)   if (current.getName().equals(methodName)) {
    int res=compareSignature(current.getDescriptor(),argTypes,argDims,argClassNames);
    Method r=new Method(clazz,current);
    if (res == YES)     return r;
 else     if (res == MAYBE && maybe == null)     maybe=r;
  }
  List list=clazz.getClassFile2().getMethods();
  int n=list.size();
  for (int i=0; i < n; ++i) {
    MethodInfo minfo=(MethodInfo)list.get(i);
    if (minfo.getName().equals(methodName)) {
      int res=compareSignature(minfo.getDescriptor(),argTypes,argDims,argClassNames);
      Method r=new Method(clazz,minfo);
      if (res == YES)       return r;
 else       if (res == MAYBE && maybe == null)       maybe=r;
    }
  }
  try {
    CtClass pclazz=clazz.getSuperclass();
    if (pclazz != null) {
      Method r=lookupMethod(pclazz,null,methodName,argTypes,argDims,argClassNames,(onlyExact || maybe != null));
      if (r != null)       return r;
    }
  }
 catch (  NotFoundException e) {
  }
  int mod=clazz.getModifiers();
  if (Modifier.isAbstract(mod) || Modifier.isInterface(mod))   try {
    CtClass[] ifs=clazz.getInterfaces();
    int size=ifs.length;
    for (int i=0; i < size; ++i) {
      Method r=lookupMethod(ifs[i],null,methodName,argTypes,argDims,argClassNames,(onlyExact || maybe != null));
      if (r != null)       return r;
    }
  }
 catch (  NotFoundException e) {
  }
  if (onlyExact)   return null;
 else   return maybe;
}
Program: 25809
Project: 25809
Buggy source:
private int compareSignature(String desc,int[] argTypes,int[] argDims,String[] argClassNames) throws CompileError {
  int result=YES;
  int i=1;
  int nArgs=argTypes.length;
  if (nArgs != Descriptor.numOfParameters(desc))   return NO;
  int len=desc.length();
  for (int n=0; i < len; ++n) {
    char c=desc.charAt(i++);
    if (c == ')')     return (n == nArgs ? result : NO);
 else     if (n >= nArgs)     return NO;
    int dim=0;
    while (c == '[') {
      ++dim;
      c=desc.charAt(i++);
    }
    if (argTypes[n] == NULL) {
      if (dim == 0 && c != 'L')       return NO;
    }
 else     if (argDims[n] != dim) {
      if (!(dim == 0 && c == 'L' && desc.startsWith("String_Node_Str",i)))       return NO;
      i=desc.indexOf(';',i) + 1;
      result=MAYBE;
      if (i <= 0)       return NO;
    }
 else     if (c == 'L') {
      int j=desc.indexOf(';',i);
      if (j < 0 || argTypes[n] != CLASS)       return NO;
      String cname=desc.substring(i,j);
      if (!cname.equals(argClassNames[n])) {
        CtClass clazz=lookupClassByJvmName(argClassNames[n]);
        try {
          if (clazz.subtypeOf(lookupClassByJvmName(cname)))           result=MAYBE;
 else           return NO;
        }
 catch (        NotFoundException e) {
          result=MAYBE;
        }
      }
      i=j + 1;
    }
 else {
      int t=descToType(c);
      int at=argTypes[n];
      if (t != at)       if (t == INT && (at == SHORT || at == BYTE || at == CHAR))       result=MAYBE;
 else       return NO;
    }
  }
  return NO;
}

Fixed version (ground truth):
private int compareSignature(String desc,int[] argTypes,int[] argDims,String[] argClassNames) throws CompileError {
  int result=YES;
  int i=1;
  int nArgs=argTypes.length;
  if (nArgs != Descriptor.numOfParameters(desc))   return NO;
  int len=desc.length();
  for (int n=0; i < len; ++n) {
    char c=desc.charAt(i++);
    if (c == ')')     return (n == nArgs ? result : NO);
 else     if (n >= nArgs)     return NO;
    int dim=0;
    while (c == '[') {
      ++dim;
      c=desc.charAt(i++);
    }
    if (argTypes[n] == NULL) {
      if (dim == 0 && c != 'L')       return NO;
      if (c == 'L')       i=desc.indexOf(';',i) + 1;
    }
 else     if (argDims[n] != dim) {
      if (!(dim == 0 && c == 'L' && desc.startsWith("String_Node_Str",i)))       return NO;
      i=desc.indexOf(';',i) + 1;
      result=MAYBE;
      if (i <= 0)       return NO;
    }
 else     if (c == 'L') {
      int j=desc.indexOf(';',i);
      if (j < 0 || argTypes[n] != CLASS)       return NO;
      String cname=desc.substring(i,j);
      if (!cname.equals(argClassNames[n])) {
        CtClass clazz=lookupClassByJvmName(argClassNames[n]);
        try {
          if (clazz.subtypeOf(lookupClassByJvmName(cname)))           result=MAYBE;
 else           return NO;
        }
 catch (        NotFoundException e) {
          result=MAYBE;
        }
      }
      i=j + 1;
    }
 else {
      int t=descToType(c);
      int at=argTypes[n];
      if (t != at)       if (t == INT && (at == SHORT || at == BYTE || at == CHAR))       result=MAYBE;
 else       return NO;
    }
  }
  return NO;
}
Program: 25810
Project: 25810
Buggy source:
/** 
 * Changes the name of the field.
 */
public void setName(String newName){
  fieldInfo.setName(newName);
}

Fixed version (ground truth):
/** 
 * Changes the name of the field.
 */
public void setName(String newName){
  declaringClass.checkModify();
  fieldInfo.setName(newName);
}
Program: 25811
Project: 25811
Buggy source:
/** 
 * Sets the encoded modifiers of the field.
 * @see Modifier
 */
public void setModifiers(int mod){
  fieldInfo.setAccessFlags(AccessFlag.of(mod));
}

Fixed version (ground truth):
/** 
 * Sets the encoded modifiers of the field.
 * @see Modifier
 */
public void setModifiers(int mod){
  declaringClass.checkModify();
  fieldInfo.setAccessFlags(AccessFlag.of(mod));
}