nus-yam/ex-repair huggingface dataset:
Program: 83408
Project: 83408
Buggy source:
public static int digit(char c,int radix){
  if (radix < MIN_RADIX || radix > MAX_RADIX) {
    return -1;
  }
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
 else   if (c >= 'a' && c < ('a' + radix)) {
    return c - 'a';
  }
 else   if (c >= 'A' && c < ('A' + radix)) {
    return c - 'A';
  }
  return -1;
}

Fixed version (ground truth):
public static int digit(char c,int radix){
  if (radix < MIN_RADIX || radix > MAX_RADIX) {
    return -1;
  }
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
 else   if (c >= 'a' && c < ('a' + radix - 10)) {
    return c - 'a' + 10;
  }
 else   if (c >= 'A' && c < ('A' + radix - 10)) {
    return c - 'A' + 10;
  }
  return -1;
}
Program: 83409
Project: 83409
Buggy source:
public static void testToFromDigit(){
  for (int i=0; i < 16; i++) {
    assertEquals(i,Character.digit(Character.forDigit(i,16),16));
  }
  assertEquals(1,Character.digit('1',10));
  assertEquals('9',Character.forDigit(9,10));
}

Fixed version (ground truth):
public static void testToFromDigit(){
  for (int i=0; i < 16; i++) {
    assertEquals(i,Character.digit(Character.forDigit(i,16),16));
  }
  assertEquals(1,Character.digit('1',10));
  assertEquals('9',Character.forDigit(9,10));
  assertEquals(-1,Character.digit('A',10));
}
Program: 83410
Project: 83410
Buggy source:
/** 
 * This method tests <code>append</code>.
 */
public void testAppend(){
  StringBuffer x=new StringBuffer();
  x.append(C.FLOAT_VALUE);
  assertTrue(x.toString().startsWith(C.FLOAT_STRING));
  x=new StringBuffer();
  x.append(C.INT_VALUE);
  assertEquals(C.INT_STRING,x.toString());
  x=new StringBuffer();
  x.append(C.LONG_VALUE);
  assertTrue(x.toString().startsWith(C.LONG_STRING));
  x=new StringBuffer();
  x.append(C.DOUBLE_VALUE);
  assertTrue(x.toString().startsWith(C.DOUBLE_STRING));
  x=new StringBuffer();
  x.append(C.CHAR_VALUE);
  assertEquals(C.CHAR_STRING,x.toString());
  x=new StringBuffer();
  x.append(C.CHAR_ARRAY_VALUE);
  assertEquals(C.CHAR_ARRAY_STRING,x.toString());
  x=new StringBuffer();
  x.append(C.CHAR_ARRAY_VALUE,1,4);
  assertEquals(C.CHAR_ARRAY_STRING.substring(1,5),x.toString());
  x=new StringBuffer();
  x.append(C.FALSE_VALUE);
  assertEquals(C.FALSE_STRING,x.toString());
  x=new StringBuffer();
  x.append(C.TRUE_VALUE);
  assertEquals(C.TRUE_STRING,x.toString());
}

Fixed version (ground truth):
/** 
 * This method tests <code>append</code>.
 */
public void testAppend(){
  StringBuffer x=new StringBuffer();
  x.append(C.FLOAT_VALUE);
  assertTrue(x.toString().startsWith(C.FLOAT_STRING));
  x=new StringBuffer();
  x.append(C.INT_VALUE);
  assertEquals(C.INT_STRING,x.toString());
  x=new StringBuffer();
  x.append(C.LONG_VALUE);
  assertTrue(x.toString().startsWith(C.LONG_STRING));
  x=new StringBuffer();
  x.append(C.DOUBLE_VALUE);
  assertTrue(x.toString().startsWith(C.DOUBLE_STRING));
  x=new StringBuffer();
  x.append(C.CHAR_VALUE);
  assertEquals(C.CHAR_STRING,x.toString());
  x=new StringBuffer();
  x.append(C.CHAR_ARRAY_VALUE);
  assertEquals(C.CHAR_ARRAY_STRING,x.toString());
  x=new StringBuffer();
  x.append(C.CHAR_ARRAY_VALUE,1,4);
  assertEquals(C.CHAR_ARRAY_STRING.substring(1,5),x.toString());
  x=new StringBuffer();
  x.append(C.FALSE_VALUE);
  assertEquals(C.FALSE_STRING,x.toString());
  x=new StringBuffer();
  x.append(C.TRUE_VALUE);
  assertEquals(C.TRUE_STRING,x.toString());
  x=new StringBuffer();
  x.append((String)null);
  assertEquals("String_Node_Str",x.toString());
}
Program: 83411
Project: 83411
Buggy source:
/** 
 * Tests correctness under repeated insertion and append.
 */
public void testRepeatedAppendsAndInserts(){
  StringBuffer x=new StringBuffer();
  final int SIZE=1000;
  for (int i=0; i < SIZE; i++) {
    x.append("String_Node_Str" + i % 10);
  }
  assertTrue("String_Node_Str",x.toString().endsWith("String_Node_Str"));
  assertTrue("String_Node_Str",x.toString().startsWith("String_Node_Str"));
  assertEquals(x.length(),SIZE);
  x=new StringBuffer();
  for (int i=0; i < SIZE * 4; i++) {
    x.append("String_Node_Str" + i % 10);
  }
  assertTrue("String_Node_Str",x.toString().endsWith("String_Node_Str"));
  assertTrue("String_Node_Str",x.toString().startsWith("String_Node_Str"));
  assertEquals("String_Node_Str",x.length(),SIZE * 4);
  x=new StringBuffer();
  for (int i=0; i < SIZE; i++) {
    x.insert(0,"String_Node_Str" + i % 10);
  }
  assertTrue("String_Node_Str",x.toString().endsWith("String_Node_Str"));
  assertTrue("String_Node_Str",x.toString().startsWith("String_Node_Str"));
  assertEquals("String_Node_Str",x.length(),SIZE);
  x=new StringBuffer();
  for (int i=0; i < SIZE * 4; i++) {
    x.insert(0,"String_Node_Str" + i % 10);
  }
  assertTrue("String_Node_Str",x.toString().endsWith("String_Node_Str"));
  assertTrue("String_Node_Str",x.toString().startsWith("String_Node_Str"));
  assertEquals("String_Node_Str",x.length(),SIZE * 4);
}

Fixed version (ground truth):
/** 
 * Tests correctness under repeated insertion and append.
 */
public void testRepeatedAppendsAndInserts(){
  StringBuffer x=new StringBuffer();
  final int size=1000;
  for (int i=0; i < size; i++) {
    x.append("String_Node_Str" + i % 10);
  }
  assertTrue("String_Node_Str",x.toString().endsWith("String_Node_Str"));
  assertTrue("String_Node_Str",x.toString().startsWith("String_Node_Str"));
  assertEquals(x.length(),size);
  x=new StringBuffer();
  for (int i=0; i < size * 4; i++) {
    x.append("String_Node_Str" + i % 10);
  }
  assertTrue("String_Node_Str",x.toString().endsWith("String_Node_Str"));
  assertTrue("String_Node_Str",x.toString().startsWith("String_Node_Str"));
  assertEquals("String_Node_Str",x.length(),size * 4);
  x=new StringBuffer();
  for (int i=0; i < size; i++) {
    x.insert(0,"String_Node_Str" + i % 10);
  }
  assertTrue("String_Node_Str",x.toString().endsWith("String_Node_Str"));
  assertTrue("String_Node_Str",x.toString().startsWith("String_Node_Str"));
  assertEquals("String_Node_Str",x.length(),size);
  x=new StringBuffer();
  for (int i=0; i < size * 4; i++) {
    x.insert(0,"String_Node_Str" + i % 10);
  }
  assertTrue("String_Node_Str",x.toString().endsWith("String_Node_Str"));
  assertTrue("String_Node_Str",x.toString().startsWith("String_Node_Str"));
  assertEquals("String_Node_Str",x.length(),size * 4);
}
Program: 83412
Project: 83412
Buggy source:
/** 
 * tests toCharArray 
 */
public void testGetChars(){
  StringBuffer x=new StringBuffer("String_Node_Str");
  char[] a1="String_Node_Str".toCharArray();
  char[] desired="String_Node_Str".toCharArray();
  x.getChars(3,6,a1,3);
  for (int i=0; i < a1.length; i++) {
    assertEquals(a1[i],desired[i]);
  }
}

Fixed version (ground truth):
/** 
 * Tests toCharArray.
 */
public void testGetChars(){
  StringBuffer x=new StringBuffer("String_Node_Str");
  char[] a1="String_Node_Str".toCharArray();
  char[] desired="String_Node_Str".toCharArray();
  x.getChars(3,6,a1,3);
  for (int i=0; i < a1.length; i++) {
    assertEquals(a1[i],desired[i]);
  }
}
Program: 83413
Project: 83413
Buggy source:
public ArrayList(Collection c){
  initArray();
  addAll(c);
}

Fixed version (ground truth):
/** 
 * There is no speed advantage to pre-allocating array sizes in JavaScript, so the <code>intialCapacity</code> parameter is ignored. This constructor is only present for compatibility with JDK 1.4's API.
 */
public ArrayList(int initialCapacity){
  this();
}
Program: 83414
Project: 83414
Buggy source:
public Vector(Collection c){
  arrayList=new ArrayList();
  addAll(c);
}

Fixed version (ground truth):
/** 
 * There is no speed advantage to pre-allocating array sizes in JavaScript, so the <code>intialCapacity</code> parameter is ignored. This constructor is only present for compatibility with JDK 1.4's API.
 */
public Vector(int initialCapacity){
  arrayList=new ArrayList(initialCapacity);
}
Program: 83415
Project: 83415
Buggy source:
private void lazyInitTargetMembers(){
  if (memberById == null) {
    memberById=new ArrayList();
    try {
      memberById.add(cls.getMethod("String_Node_Str",null));
    }
 catch (    SecurityException e) {
      e.printStackTrace();
    }
catch (    NoSuchMethodException e) {
      if (cls.isInterface()) {
        try {
          memberById.add(Object.class.getMethod("String_Node_Str",null));
        }
 catch (        Exception e1) {
          e1.printStackTrace();
        }
      }
 else {
        e.printStackTrace();
      }
    }
    memberIdByName=new HashMap();
    lazyInitTargetMembersUsingReflectionHelper(cls);
  }
}

Fixed version (ground truth):
private void lazyInitTargetMembers(){
  if (memberById == null) {
    memberById=new ArrayList();
    memberById.add(null);
    memberIdByName=new HashMap();
    lazyInitTargetMembersUsingReflectionHelper(cls);
  }
}
Program: 83416
Project: 83416
Buggy source:
/** 
 * @param dispId the unique number of a method or field
 * @return the member
 */
protected Member getMember(int dispId){
  if (dispId == 0) {
    try {
      return Object.class.getDeclaredMethod("String_Node_Str",null);
    }
 catch (    SecurityException e) {
      e.printStackTrace();
    }
catch (    NoSuchMethodException e) {
      e.printStackTrace();
    }
  }
  DispatchClassInfo clsInfo=classLoader.getClassInfoByDispId(dispId);
  return clsInfo.getMember(dispId);
}

Fixed version (ground truth):
/** 
 * @param dispId the unique number of a method or field
 * @return the member
 */
protected Member getMember(int dispId){
  DispatchClassInfo clsInfo=classLoader.getClassInfoByDispId(dispId);
  return clsInfo.getMember(dispId);
}
Program: 83417
Project: 83417
Buggy source:
/** 
 * Retrieve a field and store in the passed JsValue. This function is called exclusively from native code.
 * @param name name of the field to retrieve
 * @param jsValue a reference to the JsValue object to receive the value of the field
 */
public void getField(String name,int jsRootedValue){
  JsValueMoz jsValue=new JsValueMoz(jsRootedValue);
  int dispId=classLoader.getDispId(name);
  if (dispId < 0) {
    jsValue.setUndefined();
    return;
  }
  if (javaDispatch.isField(dispId)) {
    Field field=javaDispatch.getField(dispId);
    JsValueGlue.set(jsValue,classLoader,field.getType(),javaDispatch.getFieldValue(dispId));
    return;
  }
 else {
    Method method=javaDispatch.getMethod(dispId);
    DispatchMethod dispMethod;
    dispMethod=(DispatchMethod)classLoader.getMethodDispatch(method);
    if (dispMethod == null) {
      dispMethod=new MethodDispatch(classLoader,method);
      classLoader.putMethodDispatch(method,dispMethod);
    }
    jsValue.setWrappedFunction(method.toString(),dispMethod);
    return;
  }
}

Fixed version (ground truth):
/** 
 * Retrieve a field and store in the passed JsValue. This function is called exclusively from native code.
 * @param name name of the field to retrieve
 * @param jsValue a reference to the JsValue object to receive the value of the field
 */
public void getField(String name,int jsRootedValue){
  JsValueMoz jsValue=new JsValueMoz(jsRootedValue);
  int dispId=classLoader.getDispId(name);
  if (dispId < 0) {
    jsValue.setUndefined();
    return;
  }
  if (javaDispatch.isField(dispId)) {
    Field field=javaDispatch.getField(dispId);
    JsValueGlue.set(jsValue,classLoader,field.getType(),javaDispatch.getFieldValue(dispId));
    return;
  }
 else {
    Method method=javaDispatch.getMethod(dispId);
    DispatchMethod dispMethod;
    dispMethod=(DispatchMethod)classLoader.getMethodDispatch(method);
    if (dispMethod == null) {
      dispMethod=new MethodDispatch(classLoader,method);
      classLoader.putMethodDispatch(method,dispMethod);
    }
    jsValue.setWrappedFunction(method.toString(),dispMethod);
  }
}
Program: 83418
Project: 83418
Buggy source:
/** 
 * This constructor initializes a dispatcher, around a particular instance.
 * @param cl this class's classLoader
 * @param aScriptObject the execution iframe's window
 * @param target the object being wrapped as an IDispatch
 */
WebKitDispatchAdapter(CompilingClassLoader cl,Object target){
  javaDispatch=new JavaDispatchImpl(cl,target);
  this.classLoader=cl;
}

Fixed version (ground truth):
/** 
 * This constructor initializes a dispatcher, around a particular instance.
 * @param cl this class's classLoader
 * @param target the object being wrapped as an IDispatch
 */
WebKitDispatchAdapter(CompilingClassLoader cl,Object target){
  javaDispatch=new JavaDispatchImpl(cl,target);
  this.classLoader=cl;
}
Program: 83419
Project: 83419
Buggy source:
/** 
 * Creates an empty menu bar.
 * @param vertical <code>true</code> to orient the menu bar vertically
 */
public MenuBar(boolean vertical){
  super();
  Element table=DOM.createTable();
  body=DOM.createTBody();
  DOM.appendChild(table,body);
  if (!vertical) {
    Element tr=DOM.createTR();
    DOM.appendChild(body,tr);
  }
  this.vertical=vertical;
  Element outer=DOM.createDiv();
  DOM.appendChild(outer,table);
  setElement(outer);
  setStyleName("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Creates an empty menu bar.
 * @param vertical <code>true</code> to orient the menu bar vertically
 */
public MenuBar(boolean vertical){
  super();
  Element table=DOM.createTable();
  body=DOM.createTBody();
  DOM.appendChild(table,body);
  if (!vertical) {
    Element tr=DOM.createTR();
    DOM.appendChild(body,tr);
  }
  this.vertical=vertical;
  Element outer=DOM.createDiv();
  DOM.appendChild(outer,table);
  setElement(outer);
  sinkEvents(Event.ONCLICK | Event.ONMOUSEOVER | Event.ONMOUSEOUT);
  setStyleName("String_Node_Str");
}
Program: 83420
Project: 83420
Buggy source:
private MenuItem(String text,boolean asHTML){
  setElement(DOM.createTD());
  sinkEvents(Event.ONCLICK | Event.ONMOUSEOVER | Event.ONMOUSEOUT);
  setSelectionStyle(false);
  if (asHTML) {
    setHTML(text);
  }
 else {
    setText(text);
  }
  setStyleName("String_Node_Str");
}

Fixed version (ground truth):
private MenuItem(String text,boolean asHTML){
  setElement(DOM.createTD());
  setSelectionStyle(false);
  if (asHTML) {
    setHTML(text);
  }
 else {
    setText(text);
  }
  setStyleName("String_Node_Str");
}
Program: 83421
Project: 83421
Buggy source:
/** 
 * Attempts to get a <code>PrintWriter</code> so that the caller can generate the source code for the named type. If the named types already exists, <code>null</code> is returned to indicate that no work needs to be done.
 * @param logger a logger; normally the logger passed into{@link Generator#generate(TreeLogger,GeneratorContext,String)}or a branch thereof
 * @param packageName the name of the package to which the create type belongs
 * @param simpleName the unqualified source name of the type being generated
 * @return null if the package and class already exists, otherwise a<code>PrintWriter</code> is returned.
 */
PrintWriter tryCreate(TreeLogger logger,String packageName,String simpleName);

Fixed version (ground truth):
/** 
 * Attempts to get a <code>PrintWriter</code> so that the caller can generate the source code for the named type. If the named types already exists, <code>null</code> is returned to indicate that no work needs to be done. The file is not committed until  {@link #commit(TreeLogger,PrintWriter)} is called.
 * @param logger a logger; normally the logger passed into{@link Generator#generate(TreeLogger,GeneratorContext,String)}or a branch thereof
 * @param packageName the name of the package to which the create type belongs
 * @param simpleName the unqualified source name of the type being generated
 * @return <code>null</code> if the package and class already exists,otherwise a <code>PrintWriter</code> is returned.
 */
PrintWriter tryCreate(TreeLogger logger,String packageName,String simpleName);
Program: 83422
Project: 83422
Buggy source:
public CompilationRebindOracle(){
  super(typeOracle,propOracle,rules,genDir,cacheManager);
}

Fixed version (ground truth):
public CompilationRebindOracle(){
  super(typeOracle,propOracle,rules,genDir,outDir,cacheManager);
}
Program: 83423
Project: 83423
Buggy source:
public ModuleSpaceHost createModuleSpaceHost(BrowserWidget widget,final String moduleName) throws UnableToCompleteException {
  TreeLogger logger=getLogger();
  Shell widgetShell=widget.getShell();
  try {
    Cursor waitCursor=display.getSystemCursor(SWT.CURSOR_WAIT);
    widgetShell.setCursor(waitCursor);
    ModuleDef moduleDef=loadModule(moduleName,logger);
    assert(moduleDef != null);
    TypeOracle typeOracle=moduleDef.getTypeOracle(logger);
    ShellModuleSpaceHost host=doCreateShellModuleSpaceHost(logger,typeOracle,moduleDef,genDir);
    return host;
  }
  finally {
    Cursor normalCursor=display.getSystemCursor(SWT.CURSOR_ARROW);
    widgetShell.setCursor(normalCursor);
  }
}

Fixed version (ground truth):
public ModuleSpaceHost createModuleSpaceHost(BrowserWidget widget,final String moduleName) throws UnableToCompleteException {
  TreeLogger logger=getLogger();
  Shell widgetShell=widget.getShell();
  try {
    Cursor waitCursor=display.getSystemCursor(SWT.CURSOR_WAIT);
    widgetShell.setCursor(waitCursor);
    ModuleDef moduleDef=loadModule(moduleName,logger);
    assert(moduleDef != null);
    TypeOracle typeOracle=moduleDef.getTypeOracle(logger);
    ShellModuleSpaceHost host=doCreateShellModuleSpaceHost(logger,typeOracle,moduleDef,genDir,outDir);
    return host;
  }
  finally {
    Cursor normalCursor=display.getSystemCursor(SWT.CURSOR_ARROW);
    widgetShell.setCursor(normalCursor);
  }
}
Program: 83424
Project: 83424
Buggy source:
/** 
 * Creates an instance of ShellModuleSpaceHost (or a derived class) using the specified constituent parts. This method is made to be overridden for subclasses that need to change the behavior of ShellModuleSpaceHost.
 * @param logger TreeLogger to use
 * @param typeOracle
 * @param moduleDef
 * @param genDir
 * @return ShellModuleSpaceHost instance
 */
protected ShellModuleSpaceHost doCreateShellModuleSpaceHost(TreeLogger logger,TypeOracle typeOracle,ModuleDef moduleDef,File genDir){
  return new ShellModuleSpaceHost(logger,typeOracle,moduleDef,genDir);
}

Fixed version (ground truth):
/** 
 * Creates an instance of ShellModuleSpaceHost (or a derived class) using the specified constituent parts. This method is made to be overridden for subclasses that need to change the behavior of ShellModuleSpaceHost.
 * @param logger TreeLogger to use
 * @param typeOracle
 * @param moduleDef
 * @param genDir
 * @return ShellModuleSpaceHost instance
 */
protected ShellModuleSpaceHost doCreateShellModuleSpaceHost(TreeLogger logger,TypeOracle typeOracle,ModuleDef moduleDef,File genDir,File outDir){
  return new ShellModuleSpaceHost(logger,typeOracle,moduleDef,genDir,outDir);
}
Program: 83425
Project: 83425
Buggy source:
public void onModuleReady(ModuleSpace readySpace) throws UnableToCompleteException {
  this.space=readySpace;
  SourceOracle srcOracle=new HostedModeSourceOracle(typeOracle,module.getName());
  ByteCodeCompiler compiler=getOrCreateByteCodeCompiler(srcOracle);
  ModuleSpacePropertyOracle propOracle=new ModuleSpacePropertyOracle(module.getProperties(),readySpace);
  Rules rules=module.getRules();
  rebindOracle=new StandardRebindOracle(typeOracle,propOracle,rules,genDir,module.getCacheManager());
  classLoader=new CompilingClassLoader(logger,compiler);
}

Fixed version (ground truth):
public void onModuleReady(ModuleSpace readySpace) throws UnableToCompleteException {
  this.space=readySpace;
  SourceOracle srcOracle=new HostedModeSourceOracle(typeOracle,module.getName());
  ByteCodeCompiler compiler=getOrCreateByteCodeCompiler(srcOracle);
  ModuleSpacePropertyOracle propOracle=new ModuleSpacePropertyOracle(module.getProperties(),readySpace);
  Rules rules=module.getRules();
  rebindOracle=new StandardRebindOracle(typeOracle,propOracle,rules,genDir,outDir,module.getCacheManager());
  classLoader=new CompilingClassLoader(logger,compiler);
}
Program: 83426
Project: 83426
Buggy source:
/** 
 * @param module the module associated with the hosted module space
 */
public ShellModuleSpaceHost(TreeLogger logger,TypeOracle typeOracle,ModuleDef module,File genDir){
  this.logger=logger;
  this.typeOracle=typeOracle;
  this.module=module;
  this.genDir=genDir;
}

Fixed version (ground truth):
/** 
 * @param module the module associated with the hosted module space
 */
public ShellModuleSpaceHost(TreeLogger logger,TypeOracle typeOracle,ModuleDef module,File genDir,File outDir){
  this.logger=logger;
  this.typeOracle=typeOracle;
  this.module=module;
  this.genDir=genDir;
  this.outDir=new File(outDir,module.getName());
}
Program: 83427
Project: 83427
Buggy source:
/** 
 * Creates an HTML THEAD element.
 * @return the newly-created element
 */
public static Element createTH(){
  return impl.createElement("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Creates an HTML TH element.
 * @return the newly-created element
 */
public static Element createTH(){
  return impl.createElement("String_Node_Str");
}
Program: 83428
Project: 83428
Buggy source:
/** 
 * Creates an HTML BODY element.
 * @return the newly-created element
 */
public static Element createTBody(){
  return impl.createElement("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Creates an HTML TBODY element.
 * @return the newly-created element
 */
public static Element createTBody(){
  return impl.createElement("String_Node_Str");
}
Program: 83429
Project: 83429
Buggy source:
/** 
 * By default we will open the application window.
 * @return
 */
protected boolean isHeadless(){
  return headlessMode;
}

Fixed version (ground truth):
/** 
 * By default we will open the application window.
 * @return true if we are running in headless mode
 */
protected boolean isHeadless(){
  return headlessMode;
}
Program: 83430
Project: 83430
Buggy source:
/** 
 * @param moduleName
 * @param logger
 * @return
 * @throws UnableToCompleteException
 */
private ModuleDef loadModule(final String moduleName,TreeLogger logger) throws UnableToCompleteException {
}

Fixed version (ground truth):
/** 
 * Load a module.
 * @param moduleName name of the module to load
 * @param logger TreeLogger to use
 * @return the loaded module
 * @throws UnableToCompleteException
 */
private ModuleDef loadModule(final String moduleName,TreeLogger logger) throws UnableToCompleteException {
}
Program: 83431
Project: 83431
Buggy source:
/** 
 * Creates an instance of ShellModuleSpaceHost (or a derived class) using the specified constituent parts. This method is made to be overridden for subclasses that need to change the behavior of ShellModuleSpaceHost.
 * @param logger
 * @param typeOracle
 * @param moduleDef
 * @param genDir
 * @return
 */
protected ShellModuleSpaceHost doCreateShellModuleSpaceHost(TreeLogger logger,TypeOracle typeOracle,ModuleDef moduleDef,File genDir){
  return new ShellModuleSpaceHost(logger,typeOracle,moduleDef,genDir);
}

Fixed version (ground truth):
/** 
 * Creates an instance of ShellModuleSpaceHost (or a derived class) using the specified constituent parts. This method is made to be overridden for subclasses that need to change the behavior of ShellModuleSpaceHost.
 * @param logger TreeLogger to use
 * @param typeOracle
 * @param moduleDef
 * @param genDir
 * @return ShellModuleSpaceHost instance
 */
protected ShellModuleSpaceHost doCreateShellModuleSpaceHost(TreeLogger logger,TypeOracle typeOracle,ModuleDef moduleDef,File genDir){
  return new ShellModuleSpaceHost(logger,typeOracle,moduleDef,genDir);
}
Program: 83432
Project: 83432
Buggy source:
/** 
 * Disposes all the attached module spaces from the prior page (not the one that just loaded). Called when this widget is disposed but, more interestingly, whenever the browser's page changes.
 */
protected void onPageUnload(){
  for (Iterator iter=moduleSpacesByName.entrySet().iterator(); iter.hasNext(); ) {
    Map.Entry entry=(Map.Entry)iter.next();
    String moduleName=(String)entry.getKey();
    ModuleSpace space=(ModuleSpace)entry.getValue();
    space.dispose();
    logger.log(TreeLogger.SPAM,"String_Node_Str" + moduleName,null);
  }
  moduleSpacesByName.clear();
  if (!toolbar.openWebModeButton.isDisposed()) {
    toolbar.openWebModeButton.setEnabled(false);
  }
}

Fixed version (ground truth):
/** 
 * Disposes all the attached module spaces from the prior page (not the one that just loaded). Called when this widget is disposed but, more interestingly, whenever the browser's page changes.
 */
protected void onPageUnload(){
  for (Iterator iter=moduleSpacesByName.entrySet().iterator(); iter.hasNext(); ) {
    Map.Entry entry=(Map.Entry)iter.next();
    String moduleName=(String)entry.getKey();
    ModuleSpace space=(ModuleSpace)entry.getValue();
    unloadModule(space,moduleName);
  }
  moduleSpacesByName.clear();
  if (!toolbar.openWebModeButton.isDisposed()) {
    toolbar.openWebModeButton.setEnabled(false);
  }
}
Program: 83434
Project: 83434
Buggy source:
/** 
 * Constructs a log type with an optional parent.
 */
private Type(boolean needsAttention,String name,Type parent){
  if (instances == null) {
    instances=new HashMap();
  }
  Object existing=instances.put(name.toUpperCase(),this);
  assert(existing == null);
  this.needsAttention=needsAttention;
  this.label=name;
  this.parent=parent;
}

Fixed version (ground truth):
/** 
 * Constructs a log type with an optional parent.
 */
private Type(boolean needsAttention,String name,int priority){
  if (labelMap == null) {
    labelMap=new HashMap();
  }
  if (typeList == null) {
    typeList=new Type[TYPES_COUNT];
  }
  Object existing=labelMap.put(name.toUpperCase(),this);
  assert(existing == null);
  assert(typeList[priority] == null);
  typeList[priority]=this;
  this.needsAttention=needsAttention;
  this.label=name;
  this.priority=priority;
}
Program: 83435
Project: 83435
Buggy source:
/** 
 * Gets all the possible severity types as an array.
 * @return an array of severity types
 */
public static Type[] instances(){
  return (Type[])instances.values().toArray(NO_TYPES);
}

Fixed version (ground truth):
/** 
 * Gets all the possible severity types as an array.
 * @return an array of severity types
 */
public static Type[] instances(){
  return (Type[])typeList.clone();
}
Program: 83436
Project: 83436
Buggy source:
/** 
 * Looks up a severity type by label.
 * @param label the label of the desired severity
 * @return the severity type labelled <code>label</code>, or<code>null</code> if no such type exists
 */
public static Type valueOf(String label){
  return (Type)instances.get(label.toUpperCase());
}

Fixed version (ground truth):
/** 
 * Looks up a severity type by label.
 * @param label the label of the desired severity
 * @return the severity type labelled <code>label</code>, or<code>null</code> if no such type exists
 */
public static Type valueOf(String label){
  return (Type)labelMap.get(label.toUpperCase());
}
Program: 83437
Project: 83437
Buggy source:
public final synchronized boolean isLoggable(TreeLogger.Type type){
  TreeLogger.Type maxLevel=logLevel;
  while (maxLevel != null && maxLevel != type) {
    maxLevel=maxLevel.getParent();
  }
  return maxLevel == type;
}

Fixed version (ground truth):
public final synchronized boolean isLoggable(TreeLogger.Type type){
  return !type.isLowerPriorityThan(logLevel);
}
Program: 83438
Project: 83438
Buggy source:
/** 
 * Can only be called by the UI thread.
 */
private void uiStyleChildAndAncestors(TreeLogger.Type type,TreeItem child){
  Display display=child.getDisplay();
  Color color;
  Image image=null;
  if (type == TreeLogger.ERROR) {
    color=display.getSystemColor(SWT.COLOR_RED);
    image=imageError;
  }
 else   if (type == TreeLogger.WARN) {
    color=display.getSystemColor(SWT.COLOR_DARK_YELLOW);
    image=imageWarning;
  }
 else   if (type == TreeLogger.INFO) {
    color=display.getSystemColor(SWT.COLOR_BLACK);
    image=imageInfo;
  }
 else   if (type == TreeLogger.TRACE) {
    color=display.getSystemColor(SWT.COLOR_DARK_GRAY);
    image=imageTrace;
  }
 else   if (type == TreeLogger.DEBUG) {
    color=display.getSystemColor(SWT.COLOR_DARK_CYAN);
    image=imageDebug;
  }
 else {
    color=display.getSystemColor(SWT.COLOR_DARK_GREEN);
    image=imageSpam;
  }
  if (image != null) {
    child.setImage(image);
  }
  child.setForeground(color);
  if (type.needsAttention()) {
    TreeItem parent=child.getParentItem();
    while (parent != null) {
      parent.setExpanded(true);
      parent.setForeground(color);
      parent=parent.getParentItem();
    }
  }
}

Fixed version (ground truth):
/** 
 * Can only be called by the UI thread.
 */
private void uiStyleChildAndAncestors(TreeLogger.Type type,TreeItem child){
  Display display=child.getDisplay();
  Color color;
  Image image=null;
  if (type == TreeLogger.ERROR) {
    color=display.getSystemColor(SWT.COLOR_RED);
    image=imageError;
  }
 else   if (type == TreeLogger.WARN) {
    color=display.getSystemColor(SWT.COLOR_DARK_YELLOW);
    image=imageWarning;
  }
 else   if (type == TreeLogger.INFO) {
    color=display.getSystemColor(SWT.COLOR_BLACK);
    image=imageInfo;
  }
 else   if (type == TreeLogger.TRACE) {
    color=display.getSystemColor(SWT.COLOR_DARK_GRAY);
    image=imageTrace;
  }
 else   if (type == TreeLogger.DEBUG) {
    color=display.getSystemColor(SWT.COLOR_DARK_CYAN);
    image=imageDebug;
  }
 else {
    color=display.getSystemColor(SWT.COLOR_DARK_GREEN);
    image=imageSpam;
  }
  if (image != null) {
    child.setImage(image);
  }
  child.setForeground(color);
  if (type.needsAttention()) {
    boolean propagateColor=true;
    TreeItem parent=child.getParentItem();
    while (parent != null) {
      LogEvent parentEvent=(LogEvent)parent.getData();
      if (propagateColor) {
        if (parentEvent.type.isLowerPriorityThan(type)) {
          parent.setForeground(color);
        }
 else {
          propagateColor=false;
        }
      }
      parent.setExpanded(true);
      parent=parent.getParentItem();
    }
  }
}
Program: 83439
Project: 83439
Buggy source:
private String getHtmlSuffix(){
  StringBuffer sb=new StringBuffer();
  String moduleFunction=module.getName().replace('.','_');
  sb.append("String_Node_Str");
  sb.append("String_Node_Str" + moduleFunction + "String_Node_Str");
  sb.append("String_Node_Str");
  String s=sb.toString();
  return s;
}

Fixed version (ground truth):
private String getHtmlSuffix(){
  StringBuffer sb=new StringBuffer();
  String moduleFunction=module.getName().replace('.','_');
  sb.append("String_Node_Str");
  sb.append("String_Node_Str" + moduleFunction + "String_Node_Str"+ moduleFunction+ "String_Node_Str");
  sb.append("String_Node_Str");
  String s=sb.toString();
  return s;
}
Program: 83440
Project: 83440
Buggy source:
private static String scriptInjector(String scriptUrl){
  return "String_Node_Str" + scriptUrl + "String_Node_Str"+ "String_Node_Str"+ scriptUrl+ "String_Node_Str"+ "String_Node_Str"+ scriptUrl+ "String_Node_Str"+ "String_Node_Str";
}

Fixed version (ground truth):
private static String scriptInjector(String scriptUrl){
  if (isRelativeURL(scriptUrl)) {
    return "String_Node_Str" + scriptUrl + "String_Node_Str"+ "String_Node_Str"+ scriptUrl+ "String_Node_Str"+ "String_Node_Str"+ scriptUrl+ "String_Node_Str"+ "String_Node_Str";
  }
 else {
    return "String_Node_Str" + scriptUrl + "String_Node_Str"+ "String_Node_Str"+ scriptUrl+ "String_Node_Str"+ "String_Node_Str"+ scriptUrl+ "String_Node_Str"+ "String_Node_Str";
  }
}
Program: 83441
Project: 83441
Buggy source:
private void genAnswers(PrintWriter pw){
  for (Iterator iter=propertyValuesSetByStrongName.entrySet().iterator(); iter.hasNext(); ) {
    Map.Entry entry=(Entry)iter.next();
    String strongName=(String)entry.getKey();
    Set propValuesSet=(Set)entry.getValue();
    for (Iterator iterator=propValuesSet.iterator(); iterator.hasNext(); ) {
      String[] propValues=(String[])iterator.next();
      pw.print("String_Node_Str");
      for (int i=0; i < orderedProps.length; i++) {
        if (i > 0) {
          pw.print("String_Node_Str");
        }
        pw.print(literal(propValues[i]));
      }
      pw.print("String_Node_Str");
      pw.print("String_Node_Str");
      pw.print(literal(strongName));
      pw.println("String_Node_Str");
    }
  }
}

Fixed version (ground truth):
private void genAnswers(PrintWriter pw){
  for (Iterator iter=propertyValuesSetByStrongName.entrySet().iterator(); iter.hasNext(); ) {
    Map.Entry entry=(Entry)iter.next();
    String strongName=(String)entry.getKey();
    Set propValuesSet=(Set)entry.getValue();
    for (Iterator iterator=propValuesSet.iterator(); iterator.hasNext(); ) {
      String[] propValues=(String[])iterator.next();
      pw.print("String_Node_Str");
      boolean firstPrint=true;
      for (int i=0; i < orderedProps.length; i++) {
        Property prop=orderedProps[i];
        String activeValue=prop.getActiveValue();
        if (activeValue == null) {
          if (!firstPrint) {
            pw.print("String_Node_Str");
          }
          firstPrint=false;
          pw.print(literal(propValues[i]));
        }
 else {
        }
      }
      pw.print("String_Node_Str");
      pw.print("String_Node_Str");
      pw.print(literal(strongName));
      pw.println("String_Node_Str");
    }
  }
}
Program: 83442
Project: 83442
Buggy source:
private static String cssInjector(String cssUrl){
  return "String_Node_Str" + cssUrl + "String_Node_Str"+ "String_Node_Str"+ cssUrl+ "String_Node_Str"+ "String_Node_Str"+ cssUrl+ "String_Node_Str"+ "String_Node_Str";
}

Fixed version (ground truth):
private static String cssInjector(String cssUrl){
  if (isRelativeURL(cssUrl)) {
    return "String_Node_Str" + cssUrl + "String_Node_Str"+ "String_Node_Str"+ cssUrl+ "String_Node_Str"+ "String_Node_Str"+ cssUrl+ "String_Node_Str"+ "String_Node_Str";
  }
 else {
    return "String_Node_Str" + cssUrl + "String_Node_Str"+ "String_Node_Str"+ cssUrl+ "String_Node_Str"+ "String_Node_Str"+ cssUrl+ "String_Node_Str"+ "String_Node_Str";
  }
}
Program: 83444
Project: 83444
Buggy source:
/** 
 * Determines whether or not the URL is relative.
 * @param src the test url
 * @return <code>true</code> if the URL is relative, <code>false</code> ifnot
 */
private boolean isRelativeURL(String src){
  if (src.startsWith("String_Node_Str")) {
    return false;
  }
  try {
    URL testUrl=new URL(src);
    return false;
  }
 catch (  MalformedURLException e) {
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Determines whether or not the URL is relative.
 * @param src the test url
 * @return <code>true</code> if the URL is relative, <code>false</code> ifnot
 */
private static boolean isRelativeURL(String src){
  if (src.startsWith("String_Node_Str")) {
    return false;
  }
  try {
    URL testUrl=new URL(src);
    return false;
  }
 catch (  MalformedURLException e) {
  }
  return true;
}
Program: 83445
Project: 83445
Buggy source:
private String literal(String lit){
  return "String_Node_Str" + lit + "String_Node_Str";
}

Fixed version (ground truth):
private static String literal(String lit){
  return "String_Node_Str" + lit + "String_Node_Str";
}
Program: 83446
Project: 83446
Buggy source:
private JNode internalGet(Binding binding){
  JNode cached=(JNode)crossRefMap.get(binding);
  if (cached != null) {
    return cached;
  }
 else   if (binding instanceof BaseTypeBinding) {
    BaseTypeBinding baseTypeBinding=(BaseTypeBinding)binding;
switch (baseTypeBinding.id) {
case BaseTypeBinding.T_void:
      return program.getTypeVoid();
case BaseTypeBinding.T_boolean:
    return program.getTypePrimitiveBoolean();
case BaseTypeBinding.T_char:
  return program.getTypePrimitiveChar();
case BaseTypeBinding.T_byte:
return program.getTypePrimitiveByte();
case BaseTypeBinding.T_short:
return program.getTypePrimitiveShort();
case BaseTypeBinding.T_int:
return program.getTypePrimitiveInt();
case BaseTypeBinding.T_long:
return program.getTypePrimitiveLong();
case BaseTypeBinding.T_float:
return program.getTypePrimitiveFloat();
case BaseTypeBinding.T_double:
return program.getTypePrimitiveDouble();
}
}
 else if (binding instanceof ArrayBinding) {
ArrayBinding arrayBinding=(ArrayBinding)binding;
JType leafType=(JType)get(arrayBinding.leafComponentType);
JArrayType arrayType=program.getTypeArray(leafType,arrayBinding.dimensions);
return arrayType;
}
return null;
}

Fixed version (ground truth):
private JNode internalGet(Binding binding){
  JNode cached=(JNode)crossRefMap.get(binding);
  if (cached != null) {
    return cached;
  }
 else   if (binding instanceof BaseTypeBinding) {
    BaseTypeBinding baseTypeBinding=(BaseTypeBinding)binding;
switch (baseTypeBinding.id) {
case BaseTypeBinding.T_undefined:
      return null;
case BaseTypeBinding.T_JavaLangObject:
    return program.getTypeJavaLangObject();
case BaseTypeBinding.T_char:
  return program.getTypePrimitiveChar();
case BaseTypeBinding.T_byte:
return program.getTypePrimitiveByte();
case BaseTypeBinding.T_short:
return program.getTypePrimitiveShort();
case BaseTypeBinding.T_boolean:
return program.getTypePrimitiveBoolean();
case BaseTypeBinding.T_void:
return program.getTypeVoid();
case BaseTypeBinding.T_long:
return program.getTypePrimitiveLong();
case BaseTypeBinding.T_double:
return program.getTypePrimitiveDouble();
case BaseTypeBinding.T_float:
return program.getTypePrimitiveFloat();
case BaseTypeBinding.T_int:
return program.getTypePrimitiveInt();
case BaseTypeBinding.T_JavaLangString:
return program.getTypeJavaLangString();
case BaseTypeBinding.T_null:
return program.getTypeNull();
default :
return null;
}
}
 else if (binding instanceof ArrayBinding) {
ArrayBinding arrayBinding=(ArrayBinding)binding;
JType leafType=(JType)get(arrayBinding.leafComponentType);
JArrayType arrayType=program.getTypeArray(leafType,arrayBinding.dimensions);
return arrayType;
}
 else {
return null;
}
}
Program: 83448
Project: 83448
Buggy source:
private boolean tryInlineSimpleMethodCall(JMethodCall x,Mutator m,JMethod method,JReturnStatement returnStmt){
  List params=method.params;
  HolderList args=x.args;
  ChangeList changes=new ChangeList("String_Node_Str" + method + "String_Node_Str");
  Mutator resultExpression;
  int magicArg[]=new int[1];
  JExpression targetReturnExpr=returnStmt.getExpression();
  resultExpression=canInlineResultExpression(targetReturnExpr,params,args,magicArg,changes);
  if (resultExpression == null) {
    return false;
  }
  int iMagicArg=magicArg[0];
  JMultiExpression multi=new JMultiExpression(program);
  JExpression instance=x.getInstance();
  if (instance != null && instance.hasSideEffects()) {
    changes.addExpression(x.instance,multi.exprs);
  }
  for (int i=0; i < params.size(); ++i) {
    if (args.getExpr(i).hasSideEffects()) {
      if (i < iMagicArg) {
        changes.addExpression(args.getMutator(i),multi.exprs);
      }
 else       if (i == iMagicArg) {
      }
 else {
        assert(i > iMagicArg);
        return false;
      }
    }
  }
  changes.addExpression(resultExpression,multi.exprs);
  changes.replaceExpression(m,multi);
  changeList.add(changes);
  return true;
}

Fixed version (ground truth):
private boolean tryInlineSimpleMethodCall(JMethodCall x,Mutator m,JMethod method,JReturnStatement returnStmt){
  List params=method.params;
  HolderList args=x.args;
  ChangeList changes=new ChangeList("String_Node_Str" + method + "String_Node_Str");
  Mutator resultExpression;
  int magicArg[]=new int[1];
  JExpression targetReturnExpr=returnStmt.getExpression();
  resultExpression=canInlineResultExpression(targetReturnExpr,params,args,magicArg,changes);
  if (resultExpression == null) {
    return false;
  }
  int iMagicArg=magicArg[0];
  JMultiExpression multi=new JMultiExpression(program);
  JExpression instance=x.getInstance();
  if (instance != null && instance.hasSideEffects()) {
    changes.addExpression(x.instance,multi.exprs);
  }
  for (int i=0; i < params.size(); ++i) {
    if (args.getExpr(i).hasSideEffects()) {
      if (i < iMagicArg) {
        changes.addExpression(args.getMutator(i),multi.exprs);
      }
 else       if (i == iMagicArg) {
      }
 else {
        assert(i > iMagicArg);
        return true;
      }
    }
  }
  changes.addExpression(resultExpression,multi.exprs);
  changes.replaceExpression(m,multi);
  changeList.add(changes);
  return true;
}
Program: 83449
Project: 83449
Buggy source:
/** 
 * Tighten based on assignment, and for parameters, callArgs as well.
 */
private void tighten(JVariable x){
  if (!(x.getType() instanceof JReferenceType)) {
    return;
  }
  JReferenceType refType=(JReferenceType)x.getType();
  if (refType == typeNull) {
    return;
  }
  if (!program.typeOracle.isInstantiatedType(refType)) {
    changeList.changeType(x,typeNull);
    return;
  }
  List typeList=new ArrayList();
  typeList.add(typeNull);
  Set myAssignments=(Set)assignments.get(x);
  if (myAssignments != null) {
    for (Iterator iter=myAssignments.iterator(); iter.hasNext(); ) {
      JExpression expr=(JExpression)iter.next();
      JType type=expr.getType();
      if (!(type instanceof JReferenceType)) {
        return;
      }
      typeList.add(type);
    }
  }
  if (x instanceof JParameter) {
    Set myParams=(Set)paramUpRefs.get(x);
    if (myParams != null) {
      for (Iterator iter=myParams.iterator(); iter.hasNext(); ) {
        JParameter param=(JParameter)iter.next();
        typeList.add(param.getType());
      }
    }
  }
  JReferenceType resultType=program.generalizeTypes(typeList);
  resultType=program.strongerType(refType,resultType);
  if (refType != resultType) {
    changeList.changeType(x,resultType);
  }
}

Fixed version (ground truth):
/** 
 * Tighten based on assignment, and for parameters, callArgs as well.
 */
private void tighten(JVariable x){
  if (!(x.getType() instanceof JReferenceType)) {
    return;
  }
  JReferenceType refType=(JReferenceType)x.getType();
  if (refType == typeNull) {
    return;
  }
  if (!program.typeOracle.isInstantiatedType(refType)) {
    changeList.changeType(x,typeNull);
    return;
  }
  List typeList=new ArrayList();
  if (!(x instanceof JParameter)) {
    typeList.add(typeNull);
  }
  Set myAssignments=(Set)assignments.get(x);
  if (myAssignments != null) {
    for (Iterator iter=myAssignments.iterator(); iter.hasNext(); ) {
      JExpression expr=(JExpression)iter.next();
      JType type=expr.getType();
      if (!(type instanceof JReferenceType)) {
        return;
      }
      typeList.add(type);
    }
  }
  if (x instanceof JParameter) {
    Set myParams=(Set)paramUpRefs.get(x);
    if (myParams != null) {
      for (Iterator iter=myParams.iterator(); iter.hasNext(); ) {
        JParameter param=(JParameter)iter.next();
        typeList.add(param.getType());
      }
    }
  }
  if (typeList.isEmpty()) {
    return;
  }
  JReferenceType resultType=program.generalizeTypes(typeList);
  resultType=program.strongerType(refType,resultType);
  if (refType != resultType) {
    changeList.changeType(x,resultType);
  }
}
Program: 83450
Project: 83450
Buggy source:
public Throwable initCause(Throwable cause){
  if (cause != null) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (cause == this) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  cause=cause;
  return this;
}

Fixed version (ground truth):
public Throwable initCause(Throwable cause){
  if (this.cause != null) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (cause == this) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.cause=cause;
  return this;
}
Program: 83452
Project: 83452
Buggy source:
/** 
 * Create a method call whose type is overriden to the specified type, ignoring the return type of the target method. This constructor is used during normalizing transformations to preserve type semantics when calling externally-defined compiler implementation methods. For example, Cast.dynamicCast() returns Object but that method is used to implement the cast operation. Using a stronger type on the call expression allows us to preserve type information during the latter phases of compilation.
 */
public JMethodCall(JProgram program,JExpression instance,JMethod method,JType overrideReturnType){
  super(program);
  this.instance.set(instance);
  this.method=method;
  this.canBePolymorphic=false;
  assert(overrideReturnType != null);
  this.overrideReturnType=overrideReturnType;
}

Fixed version (ground truth):
/** 
 * Create a method call whose type is overriden to the specified type, ignoring the return type of the target method. This constructor is used during normalizing transformations to preserve type semantics when calling externally-defined compiler implementation methods. For example, Cast.dynamicCast() returns Object but that method is used to implement the cast operation. Using a stronger type on the call expression allows us to preserve type information during the latter phases of compilation.
 */
public JMethodCall(JProgram program,JExpression instance,JMethod method,JType overrideReturnType){
  super(program);
  this.instance.set(instance);
  this.method=method;
  assert(overrideReturnType != null);
  this.overrideReturnType=overrideReturnType;
}
Program: 83453
Project: 83453
Buggy source:
public boolean canBePolymorphic(){
  return canBePolymorphic && !method.isFinal() && !method.isStatic();
}

Fixed version (ground truth):
public boolean canBePolymorphic(){
  return !staticDispatchOnly && !method.isFinal() && !method.isStatic();
}
Program: 83454
Project: 83454
Buggy source:
public JsniMethodRef(JProgram program,JMethod method){
  super(program,null,method);
  setCanBePolymorphic(true);
}

Fixed version (ground truth):
public JsniMethodRef(JProgram program,JMethod method){
  super(program,null,method);
}
Program: 83455
Project: 83455
Buggy source:
public void endVisit(JMethodCall x,Mutator m){
  JMethod method=x.getTarget();
  JExpression instance=x.getInstance();
  if (!x.canBePolymorphic()) {
    return;
  }
  JType instanceType=instance.getType();
  JReferenceType enclosingType=method.getEnclosingType();
  if (instanceType == enclosingType || instanceType instanceof JInterfaceType) {
    return;
  }
  if (instanceType instanceof JArrayType) {
    return;
  }
  if (instanceType instanceof JNullType) {
    return;
  }
  assert(instanceType instanceof JClassType);
  JMethod foundMethod=null;
  JClassType type;
  outer:   for (type=(JClassType)instanceType; type != null && type != enclosingType; type=type.extnds) {
    for (int i=0; i < type.methods.size(); ++i) {
      JMethod methodIt=(JMethod)type.methods.get(i);
      if (JProgram.methodsDoMatch(method,methodIt)) {
        foundMethod=methodIt;
        break outer;
      }
    }
  }
  if (foundMethod == null) {
    return;
  }
  ChangeList changes=new ChangeList("String_Node_Str" + x + "String_Node_Str"+ enclosingType+ "String_Node_Str"+ foundMethod.getEnclosingType()+ "String_Node_Str");
  JMethodCall call=new JMethodCall(program,null,foundMethod);
  call.setCanBePolymorphic(true);
  changes.replaceExpression(m,call);
  changes.replaceExpression(call.instance,x.instance);
  for (int i=0; i < x.args.size(); ++i) {
    Mutator arg=x.args.getMutator(i);
    changes.addExpression(arg,call.args);
  }
  changeList.add(changes);
  return;
}

Fixed version (ground truth):
public void endVisit(JMethodCall x,Mutator m){
  JMethod method=x.getTarget();
  JExpression instance=x.getInstance();
  if (!x.canBePolymorphic()) {
    return;
  }
  JType instanceType=instance.getType();
  JReferenceType enclosingType=method.getEnclosingType();
  if (instanceType == enclosingType || instanceType instanceof JInterfaceType) {
    return;
  }
  if (instanceType instanceof JArrayType) {
    return;
  }
  if (instanceType instanceof JNullType) {
    return;
  }
  assert(instanceType instanceof JClassType);
  JMethod foundMethod=null;
  JClassType type;
  outer:   for (type=(JClassType)instanceType; type != null && type != enclosingType; type=type.extnds) {
    for (int i=0; i < type.methods.size(); ++i) {
      JMethod methodIt=(JMethod)type.methods.get(i);
      if (JProgram.methodsDoMatch(method,methodIt)) {
        foundMethod=methodIt;
        break outer;
      }
    }
  }
  if (foundMethod == null) {
    return;
  }
  ChangeList changes=new ChangeList("String_Node_Str" + x + "String_Node_Str"+ enclosingType+ "String_Node_Str"+ foundMethod.getEnclosingType()+ "String_Node_Str");
  JMethodCall call=new JMethodCall(program,null,foundMethod);
  changes.replaceExpression(m,call);
  changes.replaceExpression(call.instance,x.instance);
  for (int i=0; i < x.args.size(); ++i) {
    Mutator arg=x.args.getMutator(i);
    changes.addExpression(arg,call.args);
  }
  changeList.add(changes);
  return;
}