nus-yam/ex-repair huggingface dataset:
Program: 53494
Project: 53494
Buggy source:
private static List<String> makeCodeServerArgs(HostedModeOptions options,int port){
  List<String> args=new ArrayList<String>();
  args.add("String_Node_Str");
  args.add("String_Node_Str");
  args.add(String.valueOf(port));
  args.add("String_Node_Str");
  args.add(String.valueOf(options.getSourceLevel()));
  if (options.getBindAddress() != null) {
    args.add("String_Node_Str");
    args.add(options.getBindAddress());
  }
  if (options.getWorkDir() != null) {
    args.add("String_Node_Str");
    args.add(String.valueOf(options.getWorkDir()));
  }
  args.add("String_Node_Str");
  args.add(options.getModuleBaseDir().getAbsolutePath());
  if (options.getLogLevel() != null) {
    args.add("String_Node_Str");
    args.add(String.valueOf(options.getLogLevel()));
  }
  if (options.getJsInteropMode() != OptionJsInteropMode.Mode.NONE) {
    args.add("String_Node_Str");
    args.add(options.getJsInteropMode().toString());
  }
  if (!options.isIncrementalCompileEnabled()) {
    args.add("String_Node_Str");
  }
  args.add("String_Node_Str");
  args.add(options.getMethodNameDisplayMode().toString());
  for (  String mod : options.getModuleNames()) {
    args.add(mod);
  }
  return args;
}

Fixed version (ground truth):
private static List<String> makeCodeServerArgs(HostedModeOptions options,int port){
  List<String> args=new ArrayList<String>();
  args.add("String_Node_Str");
  args.add("String_Node_Str");
  args.add(String.valueOf(port));
  args.add("String_Node_Str");
  args.add(String.valueOf(options.getSourceLevel()));
  if (options.getBindAddress() != null) {
    args.add("String_Node_Str");
    args.add(options.getBindAddress());
  }
  if (options.getWorkDir() != null) {
    args.add("String_Node_Str");
    args.add(String.valueOf(options.getWorkDir()));
  }
  args.add("String_Node_Str");
  args.add(options.getModuleBaseDir().getAbsolutePath());
  if (options.getLogLevel() != null) {
    args.add("String_Node_Str");
    args.add(String.valueOf(options.getLogLevel()));
  }
  if (options.getJsInteropMode() != OptionJsInteropMode.Mode.NONE) {
    args.add("String_Node_Str");
    args.add(options.getJsInteropMode().name());
  }
  if (!options.isIncrementalCompileEnabled()) {
    args.add("String_Node_Str");
  }
  if (options.getMethodNameDisplayMode() != OptionMethodNameDisplayMode.Mode.NONE) {
    args.add("String_Node_Str");
    args.add(options.getMethodNameDisplayMode().name());
  }
  for (  String mod : options.getModuleNames()) {
    args.add(mod);
  }
  return args;
}
Program: 53495
Project: 53495
Buggy source:
@Override public String createAssignment(TreeLogger logger,ResourceContext context,JMethod method) throws UnableToCompleteException {
  CssTreeResult cssTreeResult=cssTreeMap.get(method);
  RenamingResult renamingResult=doClassRenaming(cssTreeResult.tree,method,logger,context);
  ConstantDefinitions constantDefinitions=optimizeTree(cssTreeResult,context,true,true,logger);
  checkErrors();
  Set<String> externalClasses=revertRenamingOfExternalClasses(cssTreeResult.tree,renamingResult.mapping);
  checkErrors();
  validateExternalClasses(externalClasses,renamingResult.externalClassCandidate,method,logger);
  SourceWriter sw=new StringSourceWriter();
  sw.println("String_Node_Str" + method.getReturnType().getQualifiedSourceName() + "String_Node_Str");
  sw.indent();
  writeMethods(logger,context,method,sw,constantDefinitions,cssTreeResult.originalConstantNameMapping,renamingResult.mapping);
  sw.outdent();
  sw.println("String_Node_Str");
  return sw.toString();
}

Fixed version (ground truth):
@Override public String createAssignment(TreeLogger logger,ResourceContext context,JMethod method) throws UnableToCompleteException {
  CssTreeResult cssTreeResult=cssTreeMap.get(method);
  RenamingResult renamingResult=doClassRenaming(cssTreeResult.tree,method,logger,context);
  ConstantDefinitions constantDefinitions=optimizeTree(cssTreeResult,context,true,true,logger);
  checkErrors();
  Set<String> externalClasses=revertRenamingOfExternalClasses(cssTreeResult.tree,renamingResult);
  checkErrors();
  validateExternalClasses(externalClasses,renamingResult.externalClassCandidate,method,logger);
  SourceWriter sw=new StringSourceWriter();
  sw.println("String_Node_Str" + method.getReturnType().getQualifiedSourceName() + "String_Node_Str");
  sw.indent();
  writeMethods(logger,context,method,sw,constantDefinitions,cssTreeResult.originalConstantNameMapping,renamingResult.mapping);
  sw.outdent();
  sw.println("String_Node_Str");
  return sw.toString();
}
Program: 53496
Project: 53496
Buggy source:
/** 
 * When the tree is fully processed, we can now collect the external classes and revert the renaming for these classes. We cannot collect the external classes during the original renaming because some external at-rule could be located inside a conditional block and could be removed when these blocks are evaluated.
 */
private Set<String> revertRenamingOfExternalClasses(CssTree cssTree,Map<String,String> styleClassesMapping){
  ExternalClassesCollector externalClassesCollector=new ExternalClassesCollector(cssTree.getMutatingVisitController(),errorManager);
  externalClassesCollector.runPass();
  Set<String> styleClassSet=styleClassesMapping.keySet();
  Set<String> externalClasses=externalClassesCollector.getExternalClassNames(styleClassSet);
  final Map<String,String> revertMap=new HashMap<String,String>(externalClasses.size());
  for (  String external : externalClasses) {
    revertMap.put(styleClassesMapping.get(external),external);
    styleClassesMapping.put(external,external);
  }
  SubstitutionMap revertExternalClasses=new SubstitutionMap(){
    @Override public String get(    String key){
      return revertMap.get(key);
    }
  }
;
  new CssClassRenaming(cssTree.getMutatingVisitController(),revertExternalClasses,null).runPass();
  return externalClasses;
}

Fixed version (ground truth):
/** 
 * When the tree is fully processed, we can now collect the external classes and revert the renaming for these classes. We cannot collect the external classes during the original renaming because some external at-rule could be located inside a conditional block and could be removed when these blocks are evaluated.
 */
private Set<String> revertRenamingOfExternalClasses(CssTree cssTree,RenamingResult renamingResult){
  ExternalClassesCollector externalClassesCollector=new ExternalClassesCollector(cssTree.getMutatingVisitController(),errorManager);
  externalClassesCollector.runPass();
  Map<String,String> styleClassesMapping=renamingResult.mapping;
  Set<String> allStyleClassSet=Sets.newHashSet(styleClassesMapping.keySet());
  allStyleClassSet.addAll(renamingResult.externalClassCandidate);
  Set<String> externalClasses=externalClassesCollector.getExternalClassNames(allStyleClassSet);
  final Map<String,String> revertMap=new HashMap<String,String>(externalClasses.size());
  for (  String external : externalClasses) {
    revertMap.put(styleClassesMapping.get(external),external);
    styleClassesMapping.put(external,external);
  }
  SubstitutionMap revertExternalClasses=new SubstitutionMap(){
    @Override public String get(    String key){
      return revertMap.get(key);
    }
  }
;
  new CssClassRenaming(cssTree.getMutatingVisitController(),revertExternalClasses,null).runPass();
  return externalClasses;
}
Program: 53497
Project: 53497
Buggy source:
/** 
 * Test that style classes mentioned as external are not obfuscated.
 */
public void testExternalClasses(){
  ExternalClasses externalClasses=res().externalClasses();
  assertFalse(externalClasses.getText().contains("String_Node_Str"));
  assertNotSame("String_Node_Str",externalClasses.obfuscatedClass());
  assertEquals("String_Node_Str",externalClasses.externalClass());
  assertEquals("String_Node_Str",externalClasses.externalClass2());
  assertEquals("String_Node_Str",externalClasses.unobfuscated());
  assertEquals("String_Node_Str",externalClasses.unobfuscated2());
}

Fixed version (ground truth):
/** 
 * Test that style classes mentioned as external are not obfuscated.
 */
public void testExternalClasses(){
  ExternalClasses externalClasses=res().externalClasses();
  assertNotSame("String_Node_Str",externalClasses.obfuscatedClass());
  assertEquals("String_Node_Str",externalClasses.externalClass());
  assertEquals("String_Node_Str",externalClasses.externalClass2());
  assertEquals("String_Node_Str",externalClasses.unobfuscated());
  assertEquals("String_Node_Str",externalClasses.unobfuscated2());
  String css=externalClasses.getText();
  assertFalse(css.contains("String_Node_Str"));
  String expectedCss="String_Node_Str" + externalClasses.obfuscatedClass() + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  assertEquals(expectedCss,css);
}
Program: 53499
Project: 53499
Buggy source:
public void clearPerTypeJsCache(){
  rootTypeNames.clear();
  preambleTypeNames.clear();
  deletedResourcePaths.clear();
  modifiedResourcePaths.clear();
  lastModifiedByResourcePath.clear();
  deletedDiskSourcePaths.clear();
  modifiedDiskSourcePaths.clear();
  lastModifiedByDiskSourcePath.clear();
  contentHashByGeneratedTypeName.clear();
  jsByTypeName.clear();
  referencedTypeNamesByTypeName.clear();
  sourceMapsByTypeName.clear();
  statementRangesByTypeName.clear();
  typeNamesByReferencingTypeName.clear();
}

Fixed version (ground truth):
public void clearPerTypeJsCache(){
  rootTypeNames.clear();
  preambleTypeNames.clear();
  deletedResourcePaths.clear();
  modifiedResourcePaths.clear();
  deletedDiskSourcePaths.clear();
  modifiedDiskSourcePaths.clear();
  contentHashByGeneratedTypeName.clear();
  jsByTypeName.clear();
  referencedTypeNamesByTypeName.clear();
  sourceMapsByTypeName.clear();
  statementRangesByTypeName.clear();
  typeNamesByReferencingTypeName.clear();
}
Program: 53501
Project: 53501
Buggy source:
public native void set(int index,boolean bool);

Fixed version (ground truth):
public void set(int index,boolean bool){
  set(index,JsJsonBoolean.create(bool));
}
Program: 53502
Project: 53502
Buggy source:
private native <T extends JsonValue>T parse0(String jsonString);

Fixed version (ground truth):
private static native <T extends JsonValue>T parse0(String jsonString);
Program: 53503
Project: 53503
Buggy source:
@SuppressWarnings({"String_Node_Str"}) public <T extends JsonValue>T parse(String jsonString) throws JsonException {
  try {
    return parse0(jsonString);
  }
 catch (  Exception e) {
    throw new JsonException("String_Node_Str" + jsonString);
  }
}

Fixed version (ground truth):
public <T extends JsonValue>T parse(String jsonString) throws JsonException {
  try {
    return parse0(jsonString);
  }
 catch (  Exception e) {
    throw new JsonException("String_Node_Str" + jsonString);
  }
}
Program: 53504
Project: 53504
Buggy source:
public native JsonObject createObject();

Fixed version (ground truth):
public JsonObject createObject(){
  return JsJsonObject.create();
}
Program: 53505
Project: 53505
Buggy source:
public native void put(String key,boolean value);

Fixed version (ground truth):
public void put(String key,boolean value){
  put(key,JsJsonBoolean.create(value));
}
Program: 53506
Project: 53506
Buggy source:
public native void put0(String key,JsonValue value);

Fixed version (ground truth):
/** 
 * @deprecated use {@link #put(String,elemental.json.JsonValue)} instead.
 */
@Deprecated public void put0(String key,JsonValue value){
  put(key,value);
}
Program: 53508
Project: 53508
Buggy source:
private Annotation createAnnotation(TreeLogger logger,Class<? extends Annotation> annotationClass,AnnotationData annotationData){
  Map<String,Object> values=Maps.newHashMap(annotationData.getValues());
  for (  Map.Entry<String,Object> entry : values.entrySet()) {
    Method method=null;
    Throwable caught=null;
    try {
      method=annotationClass.getMethod(entry.getKey());
      entry.setValue(resolveAnnotationValue(logger,method.getReturnType(),entry.getValue()));
    }
 catch (    SecurityException e) {
      caught=e;
    }
catch (    NoSuchMethodException e) {
      caught=e;
    }
    if (caught != null) {
      logger.log(TreeLogger.WARN,"String_Node_Str" + annotationClass.getCanonicalName() + "String_Node_Str"+ entry.getKey(),caught);
      return null;
    }
  }
  return AnnotationProxyFactory.create(annotationClass,values);
}

Fixed version (ground truth):
private Annotation createAnnotation(TreeLogger logger,Class<? extends Annotation> annotationClass,AnnotationData annotationData){
  Map<String,Object> values=Maps.newHashMap(annotationData.getValues());
  logger=logger.branch(TreeLogger.TRACE,"String_Node_Str" + annotationClass.getName());
  for (  Map.Entry<String,Object> entry : values.entrySet()) {
    Method method=null;
    Throwable caught=null;
    try {
      method=annotationClass.getMethod(entry.getKey());
      entry.setValue(resolveAnnotationValue(logger,method.getReturnType(),entry.getValue()));
    }
 catch (    SecurityException e) {
      caught=e;
    }
catch (    NoSuchMethodException e) {
      caught=e;
    }
    if (caught != null) {
      logger.log(TreeLogger.WARN,"String_Node_Str" + annotationClass.getCanonicalName() + "String_Node_Str"+ entry.getKey()+ "String_Node_Str"+ caught.getMessage());
      return null;
    }
  }
  return AnnotationProxyFactory.create(annotationClass,values);
}
Program: 53509
Project: 53509
Buggy source:
/** 
 * Transform a call to a pruned instance method (or static impl) into a call to the null method, which will be used to replace <code>x</code>.
 */
public static JMethodCall transformToNullMethodCall(JMethodCall x,JProgram program){
  JExpression instance=x.getInstance();
  List<JExpression> args=x.getArgs();
  if (program.isStaticImpl(x.getTarget())) {
    instance=args.get(0);
    args=args.subList(1,args.size());
  }
 else {
    if (x.getTarget().isStatic() && instance == null) {
      instance=program.getLiteralNull();
    }
  }
  assert(instance != null);
  if (!instance.hasSideEffects()) {
    instance=program.getLiteralNull();
  }
  JMethodCall newCall=new JMethodCall(x.getSourceInfo(),instance,program.getNullMethod(),primitiveTypeOrNullType(program,x.getType()));
  for (  JExpression arg : args) {
    if (arg.hasSideEffects()) {
      newCall.addArg(arg);
    }
  }
  return newCall;
}

Fixed version (ground truth):
/** 
 * Transform a call to a pruned instance method (or static impl) into a call to the null method, which will be used to replace <code>x</code>.
 */
public static JMethodCall transformToNullMethodCall(JMethodCall x,JProgram program){
  JExpression instance=x.getInstance();
  List<JExpression> args=x.getArgs();
  if (program.isStaticImpl(x.getTarget())) {
    instance=args.get(0);
    args=args.subList(1,args.size());
  }
 else {
    if (x.getTarget().isStatic() && instance == null) {
      instance=program.getLiteralNull();
    }
  }
  assert(instance != null);
  if (!instance.hasSideEffects()) {
    instance=program.getLiteralNull();
  }
  JMethodCall newCall=new JMethodCall(x.getSourceInfo(),instance,program.getNullMethod(),primitiveTypeOrNullTypeOrArray(program,x.getType()));
  for (  JExpression arg : args) {
    if (arg.hasSideEffects()) {
      newCall.addArg(arg);
    }
  }
  return newCall;
}
Program: 53511
Project: 53511
Buggy source:
private void assumeAllClassesCanObserveUninitializedSubclassFields(JProgram program){
  canObserveSubclassFields.addAll(program.getModuleDeclaredTypes());
}

Fixed version (ground truth):
private void assumeAllClassesCanObserveUninitializedSubclassFields(JProgram program){
  canObserveSubclassFields.addAll(program.getDeclaredTypes());
}
Program: 53512
Project: 53512
Buggy source:
private void checkPerFileRecompile_noop(JsOutputOption output) throws UnableToCompleteException, IOException, InterruptedException {
  MinimalRebuildCache relinkMinimalRebuildCache=new MinimalRebuildCache();
  File relinkApplicationDir=Files.createTempDir();
  String originalJs=compileToJs(relinkApplicationDir,"String_Node_Str",Lists.newArrayList(simpleModuleResource,simpleModelEntryPointResource,simpleModelResource),relinkMinimalRebuildCache,emptySet,output);
  String relinkedJs=compileToJs(relinkApplicationDir,"String_Node_Str",Lists.<MockResource>newArrayList(),relinkMinimalRebuildCache,emptySet,output);
  assertTrue(originalJs.equals(relinkedJs));
}

Fixed version (ground truth):
private void checkPerFileRecompile_noop(JsOutputOption output) throws UnableToCompleteException, IOException, InterruptedException {
  MinimalRebuildCache relinkMinimalRebuildCache=new MinimalRebuildCache();
  File relinkApplicationDir=Files.createTempDir();
  String originalJs=compileToJs(relinkApplicationDir,"String_Node_Str",Lists.newArrayList(simpleModuleResource,simpleModelEntryPointResource,simpleModelResource,constantsModelResource),relinkMinimalRebuildCache,emptySet,output);
  String relinkedJs=compileToJs(relinkApplicationDir,"String_Node_Str",Lists.<MockResource>newArrayList(),relinkMinimalRebuildCache,emptySet,output);
  assertTrue(originalJs.equals(relinkedJs));
}
Program: 53513
Project: 53513
Buggy source:
private void checkPerFileRecompile_dateStampChange(JsOutputOption output) throws UnableToCompleteException, IOException, InterruptedException {
  MinimalRebuildCache relinkMinimalRebuildCache=new MinimalRebuildCache();
  File relinkApplicationDir=Files.createTempDir();
  String originalJs=compileToJs(relinkApplicationDir,"String_Node_Str",Lists.newArrayList(simpleModuleResource,simpleModelEntryPointResource,simpleModelResource),relinkMinimalRebuildCache,emptySet,output);
  String relinkedJs=compileToJs(relinkApplicationDir,"String_Node_Str",Lists.<MockResource>newArrayList(simpleModelResource),relinkMinimalRebuildCache,stringSet("String_Node_Str","String_Node_Str"),output);
  assertTrue(originalJs.equals(relinkedJs));
}

Fixed version (ground truth):
private void checkPerFileRecompile_dateStampChange(JsOutputOption output) throws UnableToCompleteException, IOException, InterruptedException {
  MinimalRebuildCache relinkMinimalRebuildCache=new MinimalRebuildCache();
  File relinkApplicationDir=Files.createTempDir();
  String originalJs=compileToJs(relinkApplicationDir,"String_Node_Str",Lists.newArrayList(simpleModuleResource,simpleModelEntryPointResource,simpleModelResource,constantsModelResource),relinkMinimalRebuildCache,emptySet,output);
  String relinkedJs=compileToJs(relinkApplicationDir,"String_Node_Str",Lists.<MockResource>newArrayList(simpleModelResource),relinkMinimalRebuildCache,stringSet("String_Node_Str","String_Node_Str"),output);
  assertTrue(originalJs.equals(relinkedJs));
}
Program: 53514
Project: 53514
Buggy source:
private void checkPerFileRecompile_functionSignatureChange(JsOutputOption output) throws UnableToCompleteException, IOException, InterruptedException {
  checkRecompiledModifiedApp("String_Node_Str",Lists.newArrayList(simpleModuleResource,simpleModelEntryPointResource),simpleModelResource,modifiedFunctionSignatureSimpleModelResource,stringSet("String_Node_Str","String_Node_Str"),output);
}

Fixed version (ground truth):
private void checkPerFileRecompile_functionSignatureChange(JsOutputOption output) throws UnableToCompleteException, IOException, InterruptedException {
  checkRecompiledModifiedApp("String_Node_Str",Lists.newArrayList(simpleModuleResource,simpleModelEntryPointResource,constantsModelResource),simpleModelResource,modifiedFunctionSignatureSimpleModelResource,stringSet("String_Node_Str","String_Node_Str"),output);
}
Program: 53515
Project: 53515
Buggy source:
@Override public String get(String key){
  return null;
}

Fixed version (ground truth):
Object get(){
  if (counter >= 0) {
    counter++;
  }
  return "String_Node_Str";
}
Program: 53516
Project: 53516
Buggy source:
/** 
 * Called once for every inner class of this class.
 * @param internalName internal name of inner class (ie, com/google/Foo$1)
 * @param enclosingInternalName internal name of enclosing class (null if not a memberclass or anonymous)
 * @param innerName simple name of the inner class (null if anonymous)
 * @param access access flags (bitwise or of Opcodes.ACC_*) as declared in theenclosing class
 */
@Override public void visitInnerClass(String internalName,String enclosingInternalName,String innerName,int access){
  buildNestedSourceName(internalName,enclosingInternalName,innerName);
  if (this.internalName.equals(internalName)) {
    if (enclosingInternalName != null) {
      this.enclosingInternalName=enclosingInternalName;
    }
    int copyFlags=access & (Opcodes.ACC_STATIC | Opcodes.ACC_PRIVATE);
    this.access|=copyFlags;
    boolean isStatic=(access & Opcodes.ACC_STATIC) != 0;
switch (classType) {
case TopLevel:
      classType=isStatic ? ClassType.Nested : ClassType.Inner;
    break;
case Anonymous:
  if (innerName != null) {
    classType=ClassType.Local;
  }
break;
case Inner:
break;
default :
throw new IllegalStateException("String_Node_Str" + classType);
}
}
}

Fixed version (ground truth):
/** 
 * Called once for every inner class of this class.
 * @param internalName internal name of inner class (ie, com/google/Foo$1)
 * @param enclosingInternalName internal name of enclosing class (null if not a memberclass or anonymous)
 * @param innerName simple name of the inner class (null if anonymous)
 * @param access access flags (bitwise or of Opcodes.ACC_*) as declared in theenclosing class
 */
@Override public void visitInnerClass(String internalName,String enclosingInternalName,String innerName,int access){
  buildNestedSourceName(internalName,enclosingInternalName,innerName);
  if (this.internalName.equals(internalName)) {
    if (enclosingInternalName != null) {
      this.enclosingInternalName=enclosingInternalName;
    }
    this.access=access;
    boolean isStatic=(access & Opcodes.ACC_STATIC) != 0;
switch (classType) {
case TopLevel:
      classType=isStatic ? ClassType.Nested : ClassType.Inner;
    break;
case Anonymous:
  if (innerName != null) {
    classType=ClassType.Local;
  }
break;
case Inner:
break;
default :
throw new IllegalStateException("String_Node_Str" + classType);
}
}
}
Program: 53518
Project: 53518
Buggy source:
@Override protected void postNormalizationOptimizeJava(){
  RemoveSpecializations.exec(jprogram);
  Pruner.exec(jprogram,false);
  ReplaceGetClassOverrides.exec(jprogram);
}

Fixed version (ground truth):
@Override protected void postNormalizationOptimizeJava(){
  if (options.getOptimizationLevel() > OptionOptimize.OPTIMIZE_LEVEL_DRAFT) {
    RemoveSpecializations.exec(jprogram);
    Pruner.exec(jprogram,false);
  }
  ReplaceGetClassOverrides.exec(jprogram);
}
Program: 53519
Project: 53519
Buggy source:
private JField createSyntheticField(SyntheticArgumentBinding arg,JDeclaredType enclosingType,Disposition disposition){
  JType type=typeMap.get(arg.type);
  SourceInfo info=enclosingType.getSourceInfo();
  JField field=new JField(info,intern(arg.name),enclosingType,type,false,disposition);
  enclosingType.addField(field);
  curClass.syntheticFields.put(arg,field);
  if (arg.matchingField != null) {
    typeMap.setField(arg.matchingField,field);
  }
  return field;
}

Fixed version (ground truth):
private JField createSyntheticField(SyntheticArgumentBinding arg,JDeclaredType enclosingType,Disposition disposition){
  JType type=typeMap.get(arg.type);
  SourceInfo info=enclosingType.getSourceInfo();
  String fieldName=intern(intern(arg.name) + arg.resolvedPosition);
  JField field=new JField(info,fieldName,enclosingType,type,false,disposition);
  enclosingType.addField(field);
  curClass.syntheticFields.put(arg,field);
  if (arg.matchingField != null) {
    typeMap.setField(arg.matchingField,field);
  }
  return field;
}
Program: 53520
Project: 53520
Buggy source:
private void pruneDeadFieldsAndMethods(){
  for (  JDeclaredType type : program.getDeclaredTypes()) {
    boolean isInstantiated=instantiatedTypes.contains(type);
    for (int fieldIndex=0; fieldIndex < type.getFields().size(); ++fieldIndex) {
      JField field=type.getFields().get(fieldIndex);
      if (!liveFieldsAndMethods.contains(field) || (!field.isStatic() && !isInstantiated)) {
        type.removeField(fieldIndex);
        --fieldIndex;
      }
    }
    JMethod clinit=type.getClinitMethod();
    if (!liveFieldsAndMethods.contains(clinit)) {
      clinit.setBody(new JMethodBody(SourceOrigin.UNKNOWN));
    }
    for (int methodIndex=1; methodIndex < type.getMethods().size(); ++methodIndex) {
      JMethod method=type.getMethods().get(methodIndex);
      if (!liveFieldsAndMethods.contains(method) || (!method.isStatic() && !isInstantiated)) {
        type.removeMethod(methodIndex);
        --methodIndex;
      }
    }
  }
}

Fixed version (ground truth):
private void pruneDeadFieldsAndMethods(){
  for (  JDeclaredType type : program.getDeclaredTypes()) {
    for (int fieldIndex=0; fieldIndex < type.getFields().size(); ++fieldIndex) {
      JField field=type.getFields().get(fieldIndex);
      if (!liveFieldsAndMethods.contains(field)) {
        type.removeField(fieldIndex);
        --fieldIndex;
      }
    }
    JMethod clinit=type.getClinitMethod();
    if (!liveFieldsAndMethods.contains(clinit)) {
      clinit.setBody(new JMethodBody(SourceOrigin.UNKNOWN));
    }
    for (int methodIndex=1; methodIndex < type.getMethods().size(); ++methodIndex) {
      JMethod method=type.getMethods().get(methodIndex);
      if (!liveFieldsAndMethods.contains(method)) {
        type.removeMethod(methodIndex);
        --methodIndex;
      }
    }
  }
}
Program: 53521
Project: 53521
Buggy source:
/** 
 * getElementById, getElementsByTagName.
 */
public void testGetElements(){
  Document doc=Document.get();
  DivElement div=doc.createDivElement();
  doc.getBody().appendChild(div);
  div.setInnerHTML("String_Node_Str");
  NodeList<Element> nodes=doc.getElementsByTagName("String_Node_Str");
  assertEquals(2,nodes.getLength());
  assertEquals("String_Node_Str",nodes.getItem(0).getInnerText());
  assertEquals("String_Node_Str",nodes.getItem(1).getInnerText());
  Element foo=doc.getElementById("String_Node_Str");
  assertEquals("String_Node_Str",foo.getId());
}

Fixed version (ground truth):
/** 
 * getElementById, getElementsByTagName.
 */
public void testGetElements(){
  Document doc=Document.get();
  DivElement div=doc.createDivElement();
  doc.getBody().removeAllChildren();
  doc.getBody().appendChild(div);
  div.setInnerHTML("String_Node_Str");
  NodeList<Element> nodes=doc.getElementsByTagName("String_Node_Str");
  assertEquals(2,nodes.getLength());
  assertEquals("String_Node_Str",nodes.getItem(0).getInnerText());
  assertEquals("String_Node_Str",nodes.getItem(1).getInnerText());
  Element foo=doc.getElementById("String_Node_Str");
  assertEquals("String_Node_Str",foo.getId());
}
Program: 53522
Project: 53522
Buggy source:
/** 
 * A method needs a JsInterop bridge if any of the following are true: 1) the method name conflicts with a method name of a non-JsType/JsExport method in a superclass 2) the method returns or accepts Single-Abstract-Method types 3) the method returns or accepts JsAware/JsConvert types.
 */
public boolean needsJsInteropBridgeMethod(JMethod x){
  if (!isInteropEnabled()) {
    return false;
  }
  if (x.needsVtable() && isJsTypeMethod(x)) {
    for (    JMethod override : getAllOverriddenMethods(x)) {
      if (!isJsTypeMethod(override)) {
        return true;
      }
    }
  }
  if (isJsTypeMethod(x) || isExportedMethod(x)) {
    if (x.getOriginalReturnType() == JPrimitiveType.LONG) {
      return true;
    }
    for (    JParameter p : x.getParams()) {
      if (p.getType() == JPrimitiveType.LONG) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * A method needs a JsInterop bridge if any of the following are true: 1) the method name conflicts with a method name of a non-JsType/JsExport method in a superclass 2) the method returns or accepts Single-Abstract-Method types 3) the method returns or accepts JsAware/JsConvert types.
 */
public boolean needsJsInteropBridgeMethod(JMethod x){
  if (!isInteropEnabled()) {
    return false;
  }
  List<JParameter> xParams=x.getParams();
  if (isJsTypeMethod(x)) {
    for (    JMethod other : x.getEnclosingType().getMethods()) {
      if (other == x) {
        continue;
      }
      if (isJsTypeMethod(other) && x.getName().equals(other.getName())) {
        List<JParameter> otherParams=other.getParams();
        if (otherParams.size() == xParams.size()) {
          for (int i=0; i < otherParams.size(); i++) {
            if (otherParams.get(i).getType() != xParams.get(i).getType()) {
              break;
            }
          }
          return true;
        }
 else {
          break;
        }
      }
    }
  }
  if (x.needsVtable() && isJsTypeMethod(x)) {
    for (    JMethod override : getAllOverriddenMethods(x)) {
      if (!isJsTypeMethod(override)) {
        return true;
      }
    }
  }
  if (isJsTypeMethod(x) || isExportedMethod(x)) {
    if (x.getOriginalReturnType() == JPrimitiveType.LONG) {
      return true;
    }
    for (    JParameter p : xParams) {
      if (p.getType() == JPrimitiveType.LONG) {
        return true;
      }
    }
  }
  return false;
}
Program: 53523
Project: 53523
Buggy source:
private void maybeDispatchViaTrampolineToBridgeMethod(JMethodCall x,JMethod method,JsInvocation jsInvocation,JsExpression unnecessaryQualifier,JsExpression result,JsName polyName){
  JsName tempLocal=createTmpLocal();
  JsExpression tmp=createAssignment(tempLocal.makeRef(x.getSourceInfo()),((JsExpression)pop()));
  JsName trampMethName=indexedFunctions.get("String_Node_Str").getName();
  JsName bridgejsName=polyName.getEnclosing().findExistingName(method.getName());
  JsNameRef bridgeRef=bridgejsName != null ? bridgejsName.makeRef(x.getSourceInfo()) : new JsNameRef(x.getSourceInfo(),method.getName());
  bridgeRef.setQualifier(tempLocal.makeRef(x.getSourceInfo()));
  JsNameRef javaMethRef=polyName.makeRef(x.getSourceInfo());
  javaMethRef.setQualifier(tempLocal.makeRef(x.getSourceInfo()));
  JsInvocation callTramp=new JsInvocation(x.getSourceInfo(),trampMethName.makeRef(x.getSourceInfo()),tempLocal.makeRef(x.getSourceInfo()),bridgeRef,javaMethRef);
  JsNameRef bind=new JsNameRef(x.getSourceInfo(),"String_Node_Str");
  JsInvocation callBind=new JsInvocation(x.getSourceInfo());
  callBind.setQualifier(bind);
  callBind.getArguments().add(tempLocal.makeRef(x.getSourceInfo()));
  bind.setQualifier(createCommaExpression(tmp,callTramp));
  jsInvocation.setQualifier(callBind);
  push(createCommaExpression(unnecessaryQualifier,result));
}

Fixed version (ground truth):
private void maybeDispatchViaTrampolineToBridgeMethod(JMethodCall x,JMethod method,JsInvocation jsInvocation,JsExpression unnecessaryQualifier,JsExpression result,JsName polyName){
  JsName tempLocal=createTmpLocal();
  JsExpression tmp=createAssignment(tempLocal.makeRef(x.getSourceInfo()),((JsExpression)pop()));
  JsName trampMethName=indexedFunctions.get("String_Node_Str").getName();
  JsName bridgejsName=polyName.getEnclosing().findExistingName(method.getName());
  JsNameRef bridgeRef=bridgejsName != null ? bridgejsName.makeRef(x.getSourceInfo()) : new JsNameRef(x.getSourceInfo(),method.getName());
  bridgeRef.setQualifier(tempLocal.makeRef(x.getSourceInfo()));
  JsNameRef javaMethRef=polyName.makeRef(x.getSourceInfo());
  javaMethRef.setQualifier(tempLocal.makeRef(x.getSourceInfo()));
  JsInvocation callTramp=new JsInvocation(x.getSourceInfo(),trampMethName.makeRef(x.getSourceInfo()),tempLocal.makeRef(x.getSourceInfo()),bridgeRef,javaMethRef);
  JsNameRef bind=new JsNameRef(x.getSourceInfo(),"String_Node_Str");
  JsInvocation callBind=new JsInvocation(x.getSourceInfo());
  callBind.setQualifier(bind);
  callBind.getArguments().add(tempLocal.makeRef(x.getSourceInfo()));
  bind.setQualifier(callTramp);
  jsInvocation.setQualifier(callBind);
  result=createCommaExpression(tmp,jsInvocation);
  push(createCommaExpression(unnecessaryQualifier,result));
}
Program: 53524
Project: 53524
Buggy source:
private JDeclaredType internalFindType(String typeName,NameBasedTypeLocator nameBasedTypeLocator,boolean reportErrors){
  if (nameBasedTypeLocator.resolvedTypeIsAvailable(typeName)) {
    return nameBasedTypeLocator.getResolvedType(typeName);
  }
  if (nameBasedTypeLocator.sourceCompilationUnitIsAvailable(typeName)) {
    assimilateSourceUnit(nameBasedTypeLocator.getCompilationUnitFromSource(typeName),reportErrors);
    return nameBasedTypeLocator.getResolvedType(typeName);
  }
  if (compilerContext.shouldCompileMonolithic()) {
    if (reportErrors) {
      if (nameBasedTypeLocator.hasCompileErrors(typeName)) {
        TreeLogger branch=logger.branch(TreeLogger.ERROR,String.format("String_Node_Str" + "String_Node_Str",typeName));
        nameBasedTypeLocator.logErrorTrace(branch,TreeLogger.ERROR,typeName);
      }
 else {
        logger.log(TreeLogger.ERROR,String.format("String_Node_Str",typeName));
      }
      errorsFound=true;
    }
    return null;
  }
  if (nameBasedTypeLocator.libraryCompilationUnitIsAvailable(typeName)) {
    assimilateLibraryUnit(nameBasedTypeLocator.getCompilationUnitFromLibrary(typeName),reportErrors);
    return nameBasedTypeLocator.getResolvedType(typeName);
  }
  if (nameBasedTypeLocator.hasCompileErrors(typeName)) {
    if (reportErrors) {
      TreeLogger branch=logger.branch(TreeLogger.ERROR,String.format("String_Node_Str",typeName));
      nameBasedTypeLocator.logErrorTrace(branch,TreeLogger.ERROR,typeName);
    }
 else {
      logger.log(TreeLogger.ERROR,String.format("String_Node_Str" + "String_Node_Str",typeName));
    }
    errorsFound=true;
  }
  return null;
}

Fixed version (ground truth):
private JDeclaredType internalFindType(String typeName,NameBasedTypeLocator nameBasedTypeLocator,boolean reportErrors){
  if (nameBasedTypeLocator.resolvedTypeIsAvailable(typeName)) {
    return nameBasedTypeLocator.getResolvedType(typeName);
  }
  if (nameBasedTypeLocator.sourceCompilationUnitIsAvailable(typeName)) {
    assimilateSourceUnit(nameBasedTypeLocator.getCompilationUnitFromSource(typeName),reportErrors);
    return nameBasedTypeLocator.getResolvedType(typeName);
  }
  if (!compilerContext.shouldCompileMonolithic() && nameBasedTypeLocator.libraryCompilationUnitIsAvailable(typeName)) {
    assimilateLibraryUnit(nameBasedTypeLocator.getCompilationUnitFromLibrary(typeName),reportErrors);
    return nameBasedTypeLocator.getResolvedType(typeName);
  }
  if (reportErrors) {
    if (nameBasedTypeLocator.hasCompileErrors(typeName)) {
      TreeLogger branch=logger.branch(TreeLogger.ERROR,String.format("String_Node_Str" + "String_Node_Str",typeName));
      nameBasedTypeLocator.logErrorTrace(branch,TreeLogger.ERROR,typeName);
    }
 else     if (compilerContext.shouldCompileMonolithic()) {
      logger.log(TreeLogger.ERROR,String.format("String_Node_Str",typeName));
    }
 else {
      logger.log(TreeLogger.ERROR,String.format("String_Node_Str" + "String_Node_Str",typeName));
    }
    errorsFound=true;
  }
  return null;
}
Program: 53525
Project: 53525
Buggy source:
/** 
 * Determine whether a type is instantiated.
 */
public boolean isInstantiatedType(JReferenceType type){
  type=type.getUnderlyingType();
  if (instantiatedTypes == null || instantiatedTypes.contains(type)) {
    return true;
  }
  if (type.isExternal()) {
    return true;
  }
  if (type instanceof JNullType) {
    return true;
  }
 else   if (type instanceof JArrayType) {
    JArrayType arrayType=(JArrayType)type;
    if (arrayType.getLeafType() instanceof JNullType) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Determine whether a type is instantiated.
 */
public boolean isInstantiatedType(JReferenceType type){
  type=type.getUnderlyingType();
  if (isJsType(type) || hasAnyExports(type)) {
    return true;
  }
  if (instantiatedTypes == null || instantiatedTypes.contains(type)) {
    return true;
  }
  if (type.isExternal()) {
    return true;
  }
  if (type instanceof JNullType) {
    return true;
  }
 else   if (type instanceof JArrayType) {
    JArrayType arrayType=(JArrayType)type;
    if (arrayType.getLeafType() instanceof JNullType) {
      return true;
    }
  }
  return false;
}
Program: 53526
Project: 53526
Buggy source:
/** 
 * A method needs a JsInterop bridge if any of the following are true: 1) the method name conflicts with a method name of a non-JsType/JsExport method in a superclass 2) the method returns or accepts Single-Abstract-Method types 3) the method returns or accepts JsAware/JsConvert types.
 */
public boolean needsJsInteropBridgeMethod(JMethod x){
  if (isInteropEnabled() && x.needsVtable() && isJsTypeMethod(x)) {
    for (    JMethod override : getAllOverriddenMethods(x)) {
      if (!isJsTypeMethod(override)) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * A method needs a JsInterop bridge if any of the following are true: 1) the method name conflicts with a method name of a non-JsType/JsExport method in a superclass 2) the method returns or accepts Single-Abstract-Method types 3) the method returns or accepts JsAware/JsConvert types.
 */
public boolean needsJsInteropBridgeMethod(JMethod x){
  if (isInteropEnabled() && x.needsVtable() && isJsTypeMethod(x)) {
    for (    JMethod override : getAllOverriddenMethods(x)) {
      if (!isJsTypeMethod(override)) {
        return true;
      }
    }
  }
  if (isInteropEnabled() && isJsTypeMethod(x) || isExportedMethod(x)) {
    if (x.getOriginalReturnType() == JPrimitiveType.LONG) {
      return true;
    }
    for (    JParameter p : x.getParams()) {
      if (p.getType() == JPrimitiveType.LONG) {
        return true;
      }
    }
  }
  return false;
}
Program: 53527
Project: 53527
Buggy source:
public boolean isExportedMethod(JMethod method){
  return isInteropEnabled() && method.getExportName() != null;
}

Fixed version (ground truth):
public boolean isExportedMethod(JMethod method){
  return isInteropEnabled() && method.getExportName() != null && !method.isNoExport();
}
Program: 53528
Project: 53528
Buggy source:
private JsExpression createJsInteropBridgeMethod(JMethod m,JsNameRef methodRef){
  if (m.isStatic() || m instanceof JConstructor) {
    return methodRef;
  }
 else {
    JsFunction makeBridgeMethod=indexedFunctions.get("String_Node_Str");
    JsNameRef makeBridgeMethodRef=makeBridgeMethod.getName().makeRef(methodRef.getSourceInfo());
    JsInvocation invokeBridge=new JsInvocation(methodRef.getSourceInfo());
    invokeBridge.setQualifier(makeBridgeMethodRef);
    invokeBridge.getArguments().add(methodRef);
    return invokeBridge;
  }
}

Fixed version (ground truth):
private JsExpression createJsInteropBridgeMethod(JMethod m,JsNameRef methodRef){
  if (m.isStatic() || m instanceof JConstructor) {
    return methodRef;
  }
 else {
    JsFunction makeBridgeMethod=indexedFunctions.get("String_Node_Str");
    JsNameRef makeBridgeMethodRef=makeBridgeMethod.getName().makeRef(methodRef.getSourceInfo());
    JsInvocation invokeBridge=new JsInvocation(methodRef.getSourceInfo());
    invokeBridge.setQualifier(makeBridgeMethodRef);
    invokeBridge.getArguments().add(methodRef);
    invokeBridge.getArguments().add(m.getType() == JPrimitiveType.LONG ? JsBooleanLiteral.TRUE : JsBooleanLiteral.FALSE);
    JsArrayLiteral arrayLiteral=new JsArrayLiteral(m.getSourceInfo());
    for (    JParameter p : m.getParams()) {
      if (p.getType() == JPrimitiveType.LONG) {
        arrayLiteral.getExpressions().add(JsBooleanLiteral.TRUE);
      }
 else {
        arrayLiteral.getExpressions().add(JsBooleanLiteral.FALSE);
      }
    }
    invokeBridge.getArguments().add(arrayLiteral);
    return invokeBridge;
  }
}
Program: 53529
Project: 53529
Buggy source:
private void generateExports(JDeclaredType x,List<JsStatement> globalStmts){
  String lastProvidedNamespace="String_Node_Str";
  boolean createdClinit=false;
  for (  JMethod m : x.getMethods()) {
    if (m.isNoExport()) {
      continue;
    }
    if ((m.isStatic() || m instanceof JConstructor && !((JConstructor)m).isDefaultConstructor()) && program.typeOracle.isExportedMethod(m)) {
      createdClinit=maybeHoistClinit(exportStmts,createdClinit,maybeCreateClinitCall(m));
      JsExpression exportRhs=createJsInteropBridgeMethod(m,names.get(m).makeRef(m.getSourceInfo()));
      String exportName=m.getQualifiedExportName();
      lastProvidedNamespace=exportMember(x,globalStmts,lastProvidedNamespace,exportRhs,exportName);
    }
  }
  for (  JField f : x.getFields()) {
    if (f.isStatic() && f.getExportName() != null) {
      createdClinit=maybeHoistClinit(exportStmts,createdClinit,maybeCreateClinitCall(f,true));
      JsNameRef exportRhs=names.get(f).makeRef(f.getSourceInfo());
      String exportName=f.getQualifiedExportName();
      lastProvidedNamespace=exportMember(x,globalStmts,lastProvidedNamespace,exportRhs,exportName);
    }
  }
}

Fixed version (ground truth):
private void generateExports(JDeclaredType x,List<JsStatement> globalStmts){
  String lastProvidedNamespace="String_Node_Str";
  boolean createdClinit=false;
  JConstructor ctor=null;
  for (  JMethod m : x.getMethods()) {
    if (m instanceof JConstructor) {
      if (!((JConstructor)m).isDefaultConstructor() && program.typeOracle.isExportedMethod(m)) {
        ctor=(JConstructor)m;
        break;
      }
    }
  }
  for (  JMethod m : x.getMethods()) {
    if (m instanceof JConstructor && m != ctor) {
      continue;
    }
    if (m == ctor && !m.isPrivate() || (m.isStatic()) && program.typeOracle.isExportedMethod(m)) {
      createdClinit=maybeHoistClinit(exportStmts,createdClinit,maybeCreateClinitCall(m));
      JsExpression exportRhs=createJsInteropBridgeMethod(m,names.get(m).makeRef(m.getSourceInfo()));
      String exportName=m.getQualifiedExportName();
      lastProvidedNamespace=exportMember(x,globalStmts,lastProvidedNamespace,exportRhs,exportName);
    }
  }
  for (  JField f : x.getFields()) {
    if (f.isStatic() && f.getExportName() != null) {
      createdClinit=maybeHoistClinit(exportStmts,createdClinit,maybeCreateClinitCall(f,true));
      JsNameRef exportRhs=names.get(f).makeRef(f.getSourceInfo());
      String exportName=f.getQualifiedExportName();
      lastProvidedNamespace=exportMember(x,globalStmts,lastProvidedNamespace,exportRhs,exportName);
    }
  }
}
Program: 53531
Project: 53531
Buggy source:
@Override public boolean visit(JMethod x,Context ctx){
  Set<JMethod> overrides=program.typeOracle.getAllOverriddenMethods(x);
  if (!overrides.isEmpty()) {
    for (    JMethod m : overrides) {
      rescuedMethods.add(m);
    }
    rescuedMethods.add(x);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean visit(JMethod x,Context ctx){
  Set<JMethod> overrides=program.typeOracle.getAllOverriddenMethods(x);
  if (!overrides.isEmpty() || program.typeOracle.isJsTypeMethod(x) || program.typeOracle.isExportedMethod(x)) {
    for (    JMethod m : overrides) {
      rescuedMethods.add(m);
    }
    rescuedMethods.add(x);
  }
  return true;
}
Program: 53532
Project: 53532
Buggy source:
@Override public boolean visit(JMethod x,Context ctx){
  return !x.isNative();
}

Fixed version (ground truth):
@Override public boolean visit(JMethod x,Context ctx){
  return !x.isNative() || program.typeOracle.isJsTypeMethod(x) || program.typeOracle.isExportedMethod(x);
}
Program: 53534
Project: 53534
Buggy source:
/** 
 * Create a function that invokes the specified method reference.
 */
public static native JavaScriptObject makeBridgeMethod(JavaScriptObject methodRef);

Fixed version (ground truth):
/** 
 * Create a function that invokes the specified method reference.
 */
public static native JavaScriptObject makeBridgeMethod(JavaScriptObject methodRef,boolean returnsLong,boolean[] longParams);
Program: 53535
Project: 53535
Buggy source:
public ControlFlowAnalyzer(JProgram program){
  this.program=program;
  asyncFragmentOnLoad=program.getIndexedMethod("String_Node_Str");
  runAsyncOnsuccess=program.getIndexedMethod("String_Node_Str");
  baseArrayType=program.getIndexedType("String_Node_Str");
  getClassField=program.getIndexedField("String_Node_Str");
  getClassMethod=program.getIndexedMethod("String_Node_Str");
  rescuedViaCast.addAll(program.typeOracle.getInstantiatedJsoTypesViaCast());
  buildMethodsOverriding();
}

Fixed version (ground truth):
public ControlFlowAnalyzer(JProgram program){
  this.program=program;
  asyncFragmentOnLoad=program.getIndexedMethod("String_Node_Str");
  runAsyncOnsuccess=program.getIndexedMethod("String_Node_Str");
  baseArrayType=program.getIndexedType("String_Node_Str");
  getClassField=program.getIndexedField("String_Node_Str");
  getClassMethod=program.getIndexedMethod("String_Node_Str");
  rescuedViaCast.addAll(program.typeOracle.getInstantiatedJsoTypesViaCast());
  buildMethodsOverriding();
  rescuer=new RescueVisitor();
}
Program: 53536
Project: 53536
Buggy source:
private boolean hasAnyExports(JDeclaredType t){
  for (  JMethod method : t.getMethods()) {
    if (program.typeOracle.isExportedMethod(method)) {
      return true;
    }
  }
  for (  JField field : t.getFields()) {
    if (program.typeOracle.isExportedField(field)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean hasAnyExports(JDeclaredType t){
  if (!program.typeOracle.isInteropEnabled()) {
    return false;
  }
  for (  JMethod method : t.getMethods()) {
    if (program.typeOracle.isExportedMethod(method)) {
      return true;
    }
  }
  for (  JField field : t.getFields()) {
    if (program.typeOracle.isExportedField(field)) {
      return true;
    }
  }
  return false;
}
Program: 53537
Project: 53537
Buggy source:
private boolean isJsType(JInterfaceType intf){
  if (intf.isJsType()) {
    return true;
  }
  for (  JInterfaceType subIntf : intf.getImplements()) {
    if (isJsType(subIntf)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean isJsType(JDeclaredType intf){
  if (!program.typeOracle.isInteropEnabled()) {
    return false;
  }
  if (intf.isJsType()) {
    return true;
  }
  for (  JInterfaceType subIntf : intf.getImplements()) {
    if (isJsType(subIntf)) {
      return true;
    }
  }
  return false;
}
Program: 53539
Project: 53539
Buggy source:
private void assertTrace(final String[] expected,StackTraceElement[] trace,int offset){
  for (int i=0; i < expected.length; i++) {
    assertEquals("String_Node_Str" + i,expected[i],trace[i + offset].getMethodName());
  }
}

Fixed version (ground truth):
private void assertTrace(final String[] expected,StackTraceElement[] actual,int offset){
  for (int i=0; i < expected.length; i++) {
    StackTraceElement actualElement=actual[i + offset];
    String methodName=actualElement == null ? "String_Node_Str" : actualElement.getMethodName();
    assertEquals("String_Node_Str" + i,expected[i],methodName);
  }
}
Program: 53540
Project: 53540
Buggy source:
@DoNotRunWith(Platform.Devel) public void testTraceNative(){
  if (!StackTraceCreator.supportsErrorStack()) {
    return;
  }
  Throwable t=null;
  try {
    throwException1(true);
    fail("String_Node_Str");
  }
 catch (  Throwable e) {
    t=e;
  }
  String[] nativeMethodNames=throwNative(false);
  final String[] expected={nativeMethodNames[0],nativeMethodNames[1],Impl.getNameOf("String_Node_Str"),Impl.getNameOf("String_Node_Str"),Impl.getNameOf("String_Node_Str"),Impl.getNameOf("String_Node_Str"),Impl.getNameOf("String_Node_Str")};
  StackTraceElement[] trace=t.getStackTrace();
  int offset=getTraceOffset(trace,expected[0]);
  assertTrace(expected,trace,offset);
}

Fixed version (ground truth):
@DoNotRunWith(Platform.Devel) public void testTraceNative(){
  Throwable t=null;
  try {
    throwException1(true);
    fail("String_Node_Str");
  }
 catch (  Throwable e) {
    t=e;
  }
  String[] nativeMethodNames=throwNative(false);
  final String[] expectedModern={nativeMethodNames[0],nativeMethodNames[1],Impl.getNameOf("String_Node_Str"),Impl.getNameOf("String_Node_Str"),Impl.getNameOf("String_Node_Str"),Impl.getNameOf("String_Node_Str"),Impl.getNameOf("String_Node_Str")};
  final String[] expectedLegacy={Impl.getNameOf("String_Node_Str")};
  final String[] expected=supportsErrorStack() ? expectedModern : expectedLegacy;
  StackTraceElement[] trace=t.getStackTrace();
  int offset=getTraceOffset(trace,expected[0]);
  assertTrace(expected,trace,offset);
}