nus-yam/ex-repair huggingface dataset:
Program: 53541
Project: 53541
Buggy source:
public void testSubClassWithSuperCalls(){
  MyClassImpl mc=new MyClassImpl();
  assertEquals(150,mc.sum(1));
  ScriptInjector.fromString("String_Node_Str").setWindow(ScriptInjector.TOP_WINDOW).inject();
  assertTrue(MyClassImpl.calledFromJsHostPageWindow);
  ScriptInjector.fromString("String_Node_Str").inject();
  assertTrue(MyClassImpl.calledFromJsModuleWindow);
}

Fixed version (ground truth):
public void testSubClassWithSuperCalls(){
  MyClassImpl mc=new MyClassImpl();
  assertEquals(150,mc.sum(1));
}
Program: 53542
Project: 53542
Buggy source:
public void testJsExports(){
  ScriptInjector.fromString("String_Node_Str").setWindow(ScriptInjector.TOP_WINDOW).inject();
  assertTrue(MyClassImpl.calledFromJsHostPageWindow);
  ScriptInjector.fromString("String_Node_Str").inject();
  assertTrue(MyClassImpl.calledFromJsModuleWindow);
}

Fixed version (ground truth):
public void testJsExports(){
  ScriptInjector.fromString("String_Node_Str").setWindow(ScriptInjector.TOP_WINDOW).inject();
  assertTrue(MyClassImpl2.calledFromJsHostPageWindow);
  ScriptInjector.fromString("String_Node_Str").inject();
  assertTrue(MyClassImpl2.calledFromJsModuleWindow);
  ScriptInjector.fromString("String_Node_Str").inject();
  assertTrue(MyClassImpl3.calledFromJsModuleWindow);
}
Program: 53543
Project: 53543
Buggy source:
public AssertionFailedError(String message){
  super(message);
}

Fixed version (ground truth):
public AssertionFailedError(String message){
  super(message == null ? "String_Node_Str" : message);
}
Program: 53544
Project: 53544
Buggy source:
private void exec(){
  JsSymbolResolver.exec(program);
  List<JDeclaredType> types=ImmutableList.<JDeclaredType>of(comExampleFooClass);
  Map<JsStatement,JClassType> typeForStatement=ImmutableMap.of();
  Map<JsStatement,JMethod> vtableInitForMethod=ImmutableMap.of();
  JavaToJavaScriptMapImpl jjsmap=new JavaToJavaScriptMapImpl(types,javaToName,typeForStatement,vtableInitForMethod);
  JsNamespaceChooser.exec(program,jjsmap);
}

Fixed version (ground truth):
private void exec(){
  JsSymbolResolver.exec(program);
  List<JDeclaredType> types=ImmutableList.<JDeclaredType>of(comExampleFooClass,defaultPackageBarClass);
  Map<JsStatement,JClassType> typeForStatement=ImmutableMap.of();
  Map<JsStatement,JMethod> vtableInitForMethod=ImmutableMap.of();
  JavaToJavaScriptMapImpl jjsmap=new JavaToJavaScriptMapImpl(types,javaToName,typeForStatement,vtableInitForMethod);
  JsNamespaceChooser.exec(program,jjsmap);
}
Program: 53545
Project: 53545
Buggy source:
/** 
 * Detects if the requested time falls into a non-existent time range due to local time advancing into daylight savings time. If so, push the requested time forward out of the non-existent range.
 */
private void fixDaylightSavings(int hours){
  if ((jsdate.getHours() % 24) != (hours % 24)) {
    JsDate copy=JsDate.create(jsdate.getTime());
    copy.setDate(copy.getDate() + 1);
    int timeDiff=jsdate.getTimezoneOffset() - copy.getTimezoneOffset();
    if (timeDiff > 0) {
      int timeDiffHours=timeDiff / 60;
      int timeDiffMinutes=timeDiff % 60;
      int day=jsdate.getDate();
      int badHours=jsdate.getHours();
      if (badHours + timeDiffHours >= 24) {
        day++;
      }
      JsDate newTime=JsDate.create(jsdate.getFullYear(),jsdate.getMonth(),day,hours + timeDiffHours,jsdate.getMinutes() + timeDiffMinutes,jsdate.getSeconds(),jsdate.getMilliseconds());
      jsdate.setTime(newTime.getTime());
    }
  }
}

Fixed version (ground truth):
/** 
 * Detects if the requested time falls into a non-existent time range due to local time advancing into daylight savings time or is ambiguous due to going out of daylight savings. If so, adjust accordingly.
 */
private void fixDaylightSavings(int requestedHours){
  int hours=jsdate.getHours();
  if ((hours % 24) != (requestedHours % 24)) {
    JsDate copy=JsDate.create(jsdate.getTime());
    copy.setDate(copy.getDate() + 1);
    int timeDiff=jsdate.getTimezoneOffset() - copy.getTimezoneOffset();
    if (timeDiff > 0) {
      int timeDiffHours=timeDiff / 60;
      int timeDiffMinutes=timeDiff % 60;
      int day=jsdate.getDate();
      int badHours=jsdate.getHours();
      if (badHours + timeDiffHours >= 24) {
        day++;
      }
      JsDate newTime=JsDate.create(jsdate.getFullYear(),jsdate.getMonth(),day,requestedHours + timeDiffHours,jsdate.getMinutes() + timeDiffMinutes,jsdate.getSeconds(),jsdate.getMilliseconds());
      jsdate.setTime(newTime.getTime());
    }
    return;
  }
  double originalTimeInMillis=jsdate.getTime();
  jsdate.setTime(originalTimeInMillis + ONE_HOUR_IN_MILLISECONDS);
  if (hours != jsdate.getHours()) {
    jsdate.setTime(originalTimeInMillis);
  }
}
Program: 53546
Project: 53546
Buggy source:
private void execImpl(){
  Map<String,JsName> packageToNamespace=Maps.newHashMap();
  JsVars namespaceVars=new JsVars(SourceOrigin.UNKNOWN);
  ImmutableList<JsName> allNames=ImmutableList.copyOf(program.getScope().getAllNames());
  for (  JsName name : allNames) {
    if (name.getNamespace() != null || !name.isObfuscatable()) {
      continue;
    }
    String packageName=findPackage(name);
    if (packageName == null) {
      continue;
    }
    if (name.getStaticRef() instanceof JsFunction) {
      JsFunction func=(JsFunction)name.getStaticRef();
      if (program.isIndexedFunction(func)) {
        continue;
      }
    }
    JsName namespace=packageToNamespace.get(packageName);
    if (namespace == null) {
      namespace=program.getScope().declareName(chooseUnusedName(packageName));
      JsVar init=new JsVar(SourceOrigin.UNKNOWN,namespace);
      init.setInitExpr(new JsObjectLiteral(SourceOrigin.UNKNOWN));
      namespaceVars.add(init);
      packageToNamespace.put(packageName,namespace);
    }
    name.setNamespace(namespace);
  }
  fixGlobalFunctions(program);
  new NameFixer().accept(program);
  if (!namespaceVars.isEmpty()) {
    program.getGlobalBlock().getStatements().add(0,namespaceVars);
  }
}

Fixed version (ground truth):
private void execImpl(){
  List<JsStatement> globalStatements=program.getGlobalBlock().getStatements();
  List<JsStatement> after=Lists.newArrayList();
  for (  JsStatement before : globalStatements) {
    if (before instanceof JsExprStmt) {
      JsExpression exp=((JsExprStmt)before).getExpression();
      if (exp instanceof JsFunction) {
        after.add(visitGlobalFunction((JsFunction)exp));
      }
 else {
        after.add(before);
      }
    }
 else     if (before instanceof JsVars) {
      for (      JsVar var : ((JsVars)before)) {
        JsStatement replacement=visitGlobalVar(var);
        if (replacement != null) {
          after.add(replacement);
        }
      }
    }
 else {
      after.add(before);
    }
  }
  after.addAll(0,createNamespaceInitializers(packageToNamespace.values()));
  globalStatements.clear();
  globalStatements.addAll(after);
  new NameFixer().accept(program);
}
Program: 53547
Project: 53547
Buggy source:
/** 
 * Replace top-level "var name = " with "namespace.name = ".
 */
@Override public void endVisit(JsVars x,JsContext ctx){
  if (!ctx.canInsert()) {
    return;
  }
  for (  JsVar var : x) {
    JsName name=var.getName();
    JsName namespace=var.getName().getNamespace();
    if (namespace == null) {
      JsVars vars=new JsVars(var.getSourceInfo());
      vars.add(var);
      ctx.insertBefore(vars);
    }
 else {
      JsNameRef newName=name.makeRef(x.getSourceInfo());
      JsExpression init=var.getInitExpr();
      if (init == null) {
        init=JsNullLiteral.INSTANCE;
      }
      JsBinaryOperation assign=new JsBinaryOperation(var.getSourceInfo(),JsBinaryOperator.ASG,newName,init);
      ctx.insertBefore(assign.makeStmt());
    }
  }
  ctx.removeMe();
}

Fixed version (ground truth):
@Override public void endVisit(JsNameRef x,JsContext ctx){
  if (!x.isLeaf() || x.getQualifier() != null || x.getName() == null) {
    return;
  }
  JsName namespace=x.getName().getNamespace();
  if (namespace == null) {
    return;
  }
  x.setQualifier(new JsNameRef(x.getSourceInfo(),namespace));
  didChange=true;
}
Program: 53548
Project: 53548
Buggy source:
public JsNamespaceChooser(JsProgram program,JavaToJavaScriptMap jjsmap){
  this.program=program;
  this.jjsmap=jjsmap;
}

Fixed version (ground truth):
private JsNamespaceChooser(JsProgram program,JavaToJavaScriptMap jjsmap){
  this.program=program;
  this.jjsmap=jjsmap;
}
Program: 53549
Project: 53549
Buggy source:
private void mapJavaField(String name){
  JField field=new JField(SourceOrigin.UNKNOWN,name,javaType,JPrimitiveType.INT,true,Disposition.NONE);
  javaType.addField(field);
  javaToName.put(field,program.getScope().findExistingName(name));
}

Fixed version (ground truth):
/** 
 * Adds a mapping from a JavaScript global to a Java field. 
 */
private void mapJavaField(String name){
  JField field=new JField(SourceOrigin.UNKNOWN,name,javaType,JPrimitiveType.INT,true,Disposition.NONE);
  javaType.addField(field);
  javaToName.put(field,program.getScope().findExistingName(name));
}
Program: 53550
Project: 53550
Buggy source:
private void mapJavaMethod(String name){
  JMethod method=new JMethod(SourceOrigin.UNKNOWN,name,javaType,JPrimitiveType.VOID,false,true,false,AccessModifier.DEFAULT);
  javaType.addMethod(method);
  javaToName.put(method,program.getScope().findExistingName(name));
}

Fixed version (ground truth):
/** 
 * Adds a mapping from a JavaScript global to a Java method. 
 */
private void mapJavaMethod(String name){
  JMethod method=new JMethod(SourceOrigin.UNKNOWN,name,javaType,JPrimitiveType.VOID,false,true,false,AccessModifier.DEFAULT);
  javaType.addMethod(method);
  javaToName.put(method,program.getScope().findExistingName(name));
}
Program: 53551
Project: 53551
Buggy source:
@Override public JWildcardType getWildcardType(com.google.gwt.core.ext.typeinfo.JWildcardType.BoundType boundType,com.google.gwt.core.ext.typeinfo.JClassType extTypeBound){
  JClassType typeBound=(JClassType)extTypeBound;
  if (typeBound == getJavaLangObject() && boundType == BoundType.UNBOUND) {
    if (unboundWildCardType == null) {
      unboundWildCardType=new JWildcardType(boundType,typeBound);
    }
    return unboundWildCardType;
  }
  WildCardKey key=new WildCardKey(boundType,typeBound);
  JWildcardType result=wildcardTypes.get(key);
  if (result != null) {
    return result;
  }
  result=new JWildcardType(boundType,typeBound);
  wildcardTypes.put(key,result);
  return result;
}

Fixed version (ground truth):
@Override public JWildcardType getWildcardType(com.google.gwt.core.ext.typeinfo.JWildcardType.BoundType boundType,com.google.gwt.core.ext.typeinfo.JClassType extTypeBound){
  JClassType typeBound=(JClassType)extTypeBound;
  if (typeBound == getJavaLangObject() && (boundType == BoundType.UNBOUND || boundType == BoundType.EXTENDS)) {
    if (unboundWildCardType == null) {
      unboundWildCardType=new JWildcardType(BoundType.UNBOUND,typeBound);
    }
    return unboundWildCardType;
  }
  WildCardKey key=new WildCardKey(boundType,typeBound);
  JWildcardType result=wildcardTypes.get(key);
  if (result != null) {
    return result;
  }
  result=new JWildcardType(boundType,typeBound);
  wildcardTypes.put(key,result);
  return result;
}
Program: 53552
Project: 53552
Buggy source:
@Override public Textifier visitField(final int access,final String name,final String desc,final String signature,final Object value){
  buf.setLength(0);
  buf.append('\n');
  if ((access & Opcodes.ACC_DEPRECATED) != 0) {
    buf.append(tab).append("String_Node_Str");
  }
  buf.append(tab).append("String_Node_Str").append(Integer.toHexString(access).toUpperCase()).append('\n');
  if (signature != null) {
    buf.append(tab);
    appendDescriptor(FIELD_SIGNATURE,signature);
    TraceSignatureVisitor sv=new TraceSignatureVisitor(0);
    SignatureReader r=new SignatureReader(signature);
    r.acceptType(sv);
    buf.append(tab).append("String_Node_Str").append(sv.getDeclaration()).append('\n');
  }
  buf.append(tab);
  appendAccess(access);
  appendDescriptor(FIELD_DESCRIPTOR,desc);
  buf.append(' ').append(name);
  if (value != null) {
    buf.append("String_Node_Str");
    if (value instanceof String) {
      buf.append('\"').append(value).append('\"');
    }
 else {
      buf.append(value);
    }
  }
  buf.append('\n');
  text.add(buf.toString());
  Textifier t=createTextifier();
  text.add(t.getText());
  return t;
}

Fixed version (ground truth):
@Override public Textifier visitField(final int access,final String name,final String desc,final String signature,final Object value){
  buf.setLength(0);
  buf.append('\n');
  if ((access & Opcodes.ACC_DEPRECATED) != 0) {
    buf.append(tab).append("String_Node_Str");
  }
  buf.append(tab).append("String_Node_Str").append(Integer.toHexString(access).toUpperCase(Locale.ENGLISH)).append('\n');
  if (signature != null) {
    buf.append(tab);
    appendDescriptor(FIELD_SIGNATURE,signature);
    TraceSignatureVisitor sv=new TraceSignatureVisitor(0);
    SignatureReader r=new SignatureReader(signature);
    r.acceptType(sv);
    buf.append(tab).append("String_Node_Str").append(sv.getDeclaration()).append('\n');
  }
  buf.append(tab);
  appendAccess(access);
  appendDescriptor(FIELD_DESCRIPTOR,desc);
  buf.append(' ').append(name);
  if (value != null) {
    buf.append("String_Node_Str");
    if (value instanceof String) {
      buf.append('\"').append(value).append('\"');
    }
 else {
      buf.append(value);
    }
  }
  buf.append('\n');
  text.add(buf.toString());
  Textifier t=createTextifier();
  text.add(t.getText());
  return t;
}
Program: 53553
Project: 53553
Buggy source:
@Override public void visitInnerClass(final String name,final String outerName,final String innerName,final int access){
  buf.setLength(0);
  buf.append(tab).append("String_Node_Str");
  buf.append(Integer.toHexString(access & ~Opcodes.ACC_SUPER).toUpperCase()).append('\n');
  buf.append(tab);
  appendAccess(access);
  buf.append("String_Node_Str");
  appendDescriptor(INTERNAL_NAME,name);
  buf.append(' ');
  appendDescriptor(INTERNAL_NAME,outerName);
  buf.append(' ');
  appendDescriptor(INTERNAL_NAME,innerName);
  buf.append('\n');
  text.add(buf.toString());
}

Fixed version (ground truth):
@Override public void visitInnerClass(final String name,final String outerName,final String innerName,final int access){
  buf.setLength(0);
  buf.append(tab).append("String_Node_Str");
  buf.append(Integer.toHexString(access & ~Opcodes.ACC_SUPER).toUpperCase(Locale.ENGLISH)).append('\n');
  buf.append(tab);
  appendAccess(access);
  buf.append("String_Node_Str");
  appendDescriptor(INTERNAL_NAME,name);
  buf.append(' ');
  appendDescriptor(INTERNAL_NAME,outerName);
  buf.append(' ');
  appendDescriptor(INTERNAL_NAME,innerName);
  buf.append('\n');
  text.add(buf.toString());
}
Program: 53555
Project: 53555
Buggy source:
@SuppressWarnings("String_Node_Str") protected Schema __module_begin(NullableName renameTo,String type){
  moduleDef.enterModule(ModuleType.valueOf(type.toUpperCase()),moduleName);
  return bodySchema;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") protected Schema __module_begin(NullableName renameTo,String type){
  moduleDef.enterModule(ModuleType.valueOf(type.toUpperCase(Locale.ENGLISH)),moduleName);
  return bodySchema;
}
Program: 53556
Project: 53556
Buggy source:
final boolean isAvailable(String newIdent){
  if (!JsProtectedNames.isLegalName(newIdent)) {
    return false;
  }
  String lcIdent=newIdent.toLowerCase();
  for (  String suffix : blacklistedSuffixes) {
    if (lcIdent.endsWith(suffix.toLowerCase())) {
      return false;
    }
  }
  return !blacklistedIdents.contains(newIdent);
}

Fixed version (ground truth):
final boolean isAvailable(String newIdent){
  if (!JsProtectedNames.isLegalName(newIdent)) {
    return false;
  }
  String lcIdent=newIdent.toLowerCase(Locale.ENGLISH);
  for (  String suffix : blacklistedSuffixes) {
    if (lcIdent.endsWith(suffix.toLowerCase(Locale.ENGLISH))) {
      return false;
    }
  }
  return !blacklistedIdents.contains(newIdent);
}
Program: 53557
Project: 53557
Buggy source:
private SpeedTracerLogger(){
  fileLoggingEnabled=logFile != null;
  enabled=fileLoggingEnabled || DashboardNotifierFactory.areNotificationsEnabled();
  if (enabled) {
    if (fileLoggingEnabled) {
      Format format=Format.HTML;
      if (defaultFormatString != null) {
        for (        Format value : Format.values()) {
          if (value.name().toLowerCase().equals(defaultFormatString.toLowerCase())) {
            format=value;
            break;
          }
        }
      }
      outputFormat=format;
      eventsToWrite=openDefaultLogWriter();
      shutDownSentinel=new DummyEvent();
      flushSentinel=new DummyEvent();
      shutDownLatch=new CountDownLatch(1);
    }
    if (logGcTime) {
      gcMXBeans=ManagementFactory.getGarbageCollectorMXBeans();
      lastGcTimes=new ConcurrentHashMap<String,Long>();
    }
    pendingEvents=initPendingEvents();
  }
}

Fixed version (ground truth):
private SpeedTracerLogger(){
  fileLoggingEnabled=logFile != null;
  enabled=fileLoggingEnabled || DashboardNotifierFactory.areNotificationsEnabled();
  if (enabled) {
    if (fileLoggingEnabled) {
      Format format=Format.HTML;
      if (defaultFormatString != null) {
        for (        Format value : Format.values()) {
          if (value.name().equalsIgnoreCase(defaultFormatString)) {
            format=value;
            break;
          }
        }
      }
      outputFormat=format;
      eventsToWrite=openDefaultLogWriter();
      shutDownSentinel=new DummyEvent();
      flushSentinel=new DummyEvent();
      shutDownLatch=new CountDownLatch(1);
    }
    if (logGcTime) {
      gcMXBeans=ManagementFactory.getGarbageCollectorMXBeans();
      lastGcTimes=new ConcurrentHashMap<String,Long>();
    }
    pendingEvents=initPendingEvents();
  }
}
Program: 53558
Project: 53558
Buggy source:
private BufferedReader extractJsonFromWriter(Writer writer) throws IOException {
  String jsonString=writer.toString();
  assertTrue(jsonString.substring(0,5).toLowerCase().startsWith("String_Node_Str"));
  BufferedReader jsonReader=new BufferedReader(new StringReader(jsonString));
  while (true) {
    jsonReader.mark(16 * 1024);
    String line=jsonReader.readLine();
    if (line == null) {
      fail("String_Node_Str");
    }
    if (line.startsWith("String_Node_Str")) {
      jsonReader.reset();
      break;
    }
  }
  return jsonReader;
}

Fixed version (ground truth):
private BufferedReader extractJsonFromWriter(Writer writer) throws IOException {
  String jsonString=writer.toString();
  assertTrue(jsonString.substring(0,5).toLowerCase(Locale.ENGLISH).startsWith("String_Node_Str"));
  BufferedReader jsonReader=new BufferedReader(new StringReader(jsonString));
  while (true) {
    jsonReader.mark(16 * 1024);
    String line=jsonReader.readLine();
    if (line == null) {
      fail("String_Node_Str");
    }
    if (line.startsWith("String_Node_Str")) {
      jsonReader.reset();
      break;
    }
  }
  return jsonReader;
}
Program: 53559
Project: 53559
Buggy source:
@Override public void onBrowserEvent(Event event){
  MenuItem item=findItem(DOM.eventGetTarget(event));
switch (DOM.eventGetType(event)) {
case Event.ONCLICK:
{
      FocusPanel.impl.focus(getElement());
      if (item != null) {
        doItemAction(item,true,true);
      }
      break;
    }
case Event.ONMOUSEOVER:
{
    if (item != null) {
      itemOver(item,true);
    }
    break;
  }
case Event.ONMOUSEOUT:
{
  if (item != null) {
    itemOver(null,true);
  }
  break;
}
case Event.ONFOCUS:
{
selectFirstItemIfNoneSelected();
break;
}
case Event.ONKEYDOWN:
{
int keyCode=event.getKeyCode();
boolean isRtl=LocaleInfo.getCurrentLocale().isRTL();
keyCode=KeyCodes.maybeSwapArrowKeysForRtl(keyCode,isRtl);
switch (keyCode) {
case KeyCodes.KEY_LEFT:
moveToPrevItem();
eatEvent(event);
break;
case KeyCodes.KEY_RIGHT:
moveToNextItem();
eatEvent(event);
break;
case KeyCodes.KEY_UP:
moveSelectionUp();
eatEvent(event);
break;
case KeyCodes.KEY_DOWN:
moveSelectionDown();
eatEvent(event);
break;
case KeyCodes.KEY_ESCAPE:
closeAllParentsAndChildren();
eatEvent(event);
break;
case KeyCodes.KEY_TAB:
closeAllParentsAndChildren();
break;
case KeyCodes.KEY_ENTER:
if (!selectFirstItemIfNoneSelected()) {
doItemAction(selectedItem,true,true);
eatEvent(event);
}
break;
}
break;
}
}
super.onBrowserEvent(event);
}

Fixed version (ground truth):
@Override public void onBrowserEvent(Event event){
  MenuItem item=findItem(DOM.eventGetTarget(event));
switch (DOM.eventGetType(event)) {
case Event.ONCLICK:
{
      FocusPanel.impl.focus(getElement());
      if (item != null) {
        doItemAction(item,true,true);
      }
      break;
    }
case Event.ONMOUSEOVER:
{
    if (item != null) {
      itemOver(item,true);
    }
    break;
  }
case Event.ONMOUSEOUT:
{
  if (item != null) {
    itemOver(null,false);
  }
  break;
}
case Event.ONFOCUS:
{
selectFirstItemIfNoneSelected();
break;
}
case Event.ONKEYDOWN:
{
int keyCode=event.getKeyCode();
boolean isRtl=LocaleInfo.getCurrentLocale().isRTL();
keyCode=KeyCodes.maybeSwapArrowKeysForRtl(keyCode,isRtl);
switch (keyCode) {
case KeyCodes.KEY_LEFT:
moveToPrevItem();
eatEvent(event);
break;
case KeyCodes.KEY_RIGHT:
moveToNextItem();
eatEvent(event);
break;
case KeyCodes.KEY_UP:
moveSelectionUp();
eatEvent(event);
break;
case KeyCodes.KEY_DOWN:
moveSelectionDown();
eatEvent(event);
break;
case KeyCodes.KEY_ESCAPE:
closeAllParentsAndChildren();
eatEvent(event);
break;
case KeyCodes.KEY_TAB:
closeAllParentsAndChildren();
break;
case KeyCodes.KEY_ENTER:
if (!selectFirstItemIfNoneSelected()) {
doItemAction(selectedItem,true,true);
eatEvent(event);
}
break;
}
break;
}
}
super.onBrowserEvent(event);
}
Program: 53560
Project: 53560
Buggy source:
void itemOver(MenuItem item,boolean focus){
  if (item == null) {
    if ((selectedItem != null) && (shownChildMenu == selectedItem.getSubMenu())) {
      return;
    }
  }
  if (item != null && !item.isEnabled()) {
    return;
  }
  selectItem(item);
  if (focus && focusOnHover) {
    focus();
  }
  if (item != null) {
    if ((shownChildMenu != null) || (parentMenu != null) || autoOpen) {
      doItemAction(item,false,focusOnHover);
    }
  }
}

Fixed version (ground truth):
void itemOver(MenuItem item,boolean focus){
  if (item == null) {
    if ((selectedItem != null) && shownChildMenu != null && (shownChildMenu == selectedItem.getSubMenu())) {
      return;
    }
  }
  if (item != null && !item.isEnabled()) {
    return;
  }
  selectItem(item);
  if (focus && focusOnHover) {
    focus();
  }
  if (item != null) {
    if ((shownChildMenu != null) || (parentMenu != null) || autoOpen) {
      doItemAction(item,false,focusOnHover);
    }
  }
}
Program: 53561
Project: 53561
Buggy source:
void doItemAction(final MenuItem item,boolean fireCommand,boolean focus){
  if (!item.isEnabled()) {
    return;
  }
  selectItem(item);
  if (fireCommand && item.getScheduledCommand() != null) {
    closeAllParents();
    final ScheduledCommand cmd=item.getScheduledCommand();
    Scheduler.get().scheduleFinally(new Scheduler.ScheduledCommand(){
      @Override public void execute(){
        cmd.execute();
      }
    }
);
    if (shownChildMenu != null) {
      shownChildMenu.onHide(focus);
      popup.hide();
      shownChildMenu=null;
      selectItem(null);
    }
  }
 else   if (item.getSubMenu() != null) {
    if (shownChildMenu == null) {
      openPopup(item);
    }
 else     if (item.getSubMenu() != shownChildMenu) {
      shownChildMenu.onHide(focus);
      popup.hide();
      openPopup(item);
    }
 else     if (fireCommand && !autoOpen) {
      shownChildMenu.onHide(focus);
      popup.hide();
      shownChildMenu=null;
      selectItem(item);
    }
  }
 else   if (autoOpen && shownChildMenu != null) {
    shownChildMenu.onHide(focus);
    popup.hide();
    shownChildMenu=null;
  }
}

Fixed version (ground truth):
void doItemAction(final MenuItem item,boolean fireCommand,boolean focus){
  if (!item.isEnabled()) {
    return;
  }
  selectItem(item);
  if (fireCommand && item.getScheduledCommand() != null) {
    closeAllParents();
    FocusPanel.impl.blur(getElement());
    final ScheduledCommand cmd=item.getScheduledCommand();
    Scheduler.get().scheduleFinally(new Scheduler.ScheduledCommand(){
      @Override public void execute(){
        cmd.execute();
      }
    }
);
    if (shownChildMenu != null) {
      shownChildMenu.onHide(focus);
      popup.hide();
      shownChildMenu=null;
      selectItem(null);
    }
  }
 else   if (item.getSubMenu() != null) {
    if (shownChildMenu == null) {
      openPopup(item);
    }
 else     if (item.getSubMenu() != shownChildMenu) {
      shownChildMenu.onHide(focus);
      popup.hide();
      openPopup(item);
    }
 else     if (fireCommand && !autoOpen) {
      shownChildMenu.onHide(focus);
      popup.hide();
      shownChildMenu=null;
      selectItem(item);
    }
  }
 else   if (autoOpen && shownChildMenu != null) {
    shownChildMenu.onHide(focus);
    popup.hide();
    shownChildMenu=null;
  }
}
Program: 53562
Project: 53562
Buggy source:
/** 
 * This is called to merge two permutations that either have identical rebind answers or were explicitly collapsed using <collapse-property>.
 */
public void mergeFrom(Permutation other,SortedSet<String> liveRebindRequests){
}

Fixed version (ground truth):
/** 
 * This is called to merge two permutations that either have identical rebind answers or were explicitly collapsed using <collapse-property>.
 */
public void mergeFrom(Permutation other,SortedSet<String> liveRebindRequests){
  if (getClass().desiredAssertionStatus()) {
    assertSameAnswers(liveRebindRequests,orderedRebindAnswers,other.orderedRebindAnswers);
  }
  mergeRebindsFromCollapsed(other);
}
Program: 53564
Project: 53564
Buggy source:
/** 
 * Initialize DateExt object with default value. Here we use -1 for most of the field to indicate that field is not set.
 */
public DateRecord(){
  era=-1;
  ambiguousYear=false;
  year=Integer.MIN_VALUE;
  month=-1;
  dayOfMonth=-1;
  ampm=-1;
  hours=-1;
  minutes=-1;
  seconds=-1;
  milliseconds=-1;
  dayOfWeek=-1;
  tzOffset=Integer.MIN_VALUE;
}

Fixed version (ground truth):
/** 
 * Initialize DateExt object with default value. Here we use -1 for most of the field to indicate that field is not set.
 */
public DateRecord(){
  era=-1;
  ambiguousYear=false;
  year=Integer.MIN_VALUE;
  month=-1;
  dayOfMonth=-1;
  ampm=-1;
  midnightIs24=false;
  hours=-1;
  minutes=-1;
  seconds=-1;
  milliseconds=-1;
  dayOfWeek=-1;
  tzOffset=Integer.MIN_VALUE;
}
Program: 53567
Project: 53567
Buggy source:
@Override public boolean equals(Object that){
  if (that == null && this.getClass() != that.getClass()) {
    return false;
  }
  JsArrayLiteral thatLiteral=(JsArrayLiteral)that;
  return internable == thatLiteral.internable && exprs.equals(thatLiteral.exprs);
}

Fixed version (ground truth):
@Override public boolean equals(Object that){
  if (that == null || this.getClass() != that.getClass()) {
    return false;
  }
  JsArrayLiteral thatLiteral=(JsArrayLiteral)that;
  return internable == thatLiteral.internable && exprs.equals(thatLiteral.exprs);
}
Program: 53568
Project: 53568
Buggy source:
@Override public boolean equals(Object that){
  if (that == null && this.getClass() != that.getClass()) {
    return false;
  }
  JsObjectLiteral thatLiteral=(JsObjectLiteral)that;
  return internable == thatLiteral.internable && properties.equals(thatLiteral.properties);
}

Fixed version (ground truth):
@Override public boolean equals(Object that){
  if (that == null || this.getClass() != that.getClass()) {
    return false;
  }
  JsObjectLiteral thatLiteral=(JsObjectLiteral)that;
  return internable == thatLiteral.internable && properties.equals(thatLiteral.properties);
}
Program: 53569
Project: 53569
Buggy source:
@Override public ConfigurationProperty getConfigurationProperty(String propertyName) throws BadPropertyValueException {
  Property property=properties.find(propertyName);
  if (property instanceof ConfigurationProperty) {
    ConfigurationProperty configurationProperty=(ConfigurationProperty)property;
    return new DefaultConfigurationProperty(configurationProperty.getName(),configurationProperty.getValues());
  }
  throw new BadPropertyValueException(propertyName);
}

Fixed version (ground truth):
@Override public ConfigurationProperty getConfigurationProperty(String propertyName) throws BadPropertyValueException {
  Property property=properties.find(propertyName);
  if (property instanceof com.google.gwt.dev.cfg.ConfigurationProperty) {
    com.google.gwt.dev.cfg.ConfigurationProperty configurationProperty=(com.google.gwt.dev.cfg.ConfigurationProperty)property;
    return new DefaultConfigurationProperty(configurationProperty.getName(),configurationProperty.getValues());
  }
  throw new BadPropertyValueException(propertyName);
}
Program: 53570
Project: 53570
Buggy source:
private void clearLocals(){
  tempLocals.clear();
  localIndex=0;
}

Fixed version (ground truth):
private void clearLocals(){
  catchVariableIndex=0;
}
Program: 53571
Project: 53571
Buggy source:
@Override public boolean visit(JTryStatement x,Context ctx){
  if (!x.getCatchClauses().isEmpty()) {
    pushTempLocal(x.getSourceInfo());
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean visit(JMethodBody x,Context ctx){
  currentMethodBody=x;
  clearLocals();
  return true;
}
Program: 53572
Project: 53572
Buggy source:
@Override public boolean visit(JThisRef x,Context ctx){
  return false;
}

Fixed version (ground truth):
@Override public boolean visit(JMethodBody body,Context ctx){
}
Program: 53574
Project: 53574
Buggy source:
/** 
 * Generates HTML for a tree item with an attached icon.
 * @param imageProto the image prototype to use
 * @param title the title of the item
 * @return the resultant HTML
 */
private String imageItemHTML(ImageResource imageProto,String title){
  return AbstractImagePrototype.create(imageProto).getHTML() + "String_Node_Str" + title;
}

Fixed version (ground truth):
/** 
 * Generates HTML for a tree item with an attached icon.
 * @param imageProto the image prototype to use
 * @param title the title of the item
 * @return the resultant HTML
 */
private SafeHtml imageItemHTML(ImageResource imageProto,String title){
  SafeHtmlBuilder builder=new SafeHtmlBuilder();
  builder.append(AbstractImagePrototype.create(imageProto).getSafeHtml());
  builder.appendHtmlConstant("String_Node_Str");
  builder.appendEscaped(title);
  return builder.toSafeHtml();
}
Program: 53575
Project: 53575
Buggy source:
@Source("String_Node_Str") ImageResource treeLeaf();

Fixed version (ground truth):
@Override @Source("String_Node_Str") ImageResource treeLeaf();
Program: 53576
Project: 53576
Buggy source:
/** 
 * Constructs a new mailboxes widget with a bundle of images.
 * @param images a bundle that provides the images for this widget
 */
public Mailboxes(){
  Images images=GWT.create(Images.class);
  tree=new Tree(images);
  TreeItem root=new TreeItem(imageItemHTML(images.home(),"String_Node_Str"));
  tree.addItem(root);
  addImageItem(root,"String_Node_Str",images.inbox());
  addImageItem(root,"String_Node_Str",images.drafts());
  addImageItem(root,"String_Node_Str",images.templates());
  addImageItem(root,"String_Node_Str",images.sent());
  addImageItem(root,"String_Node_Str",images.trash());
  root.setState(true);
  initWidget(tree);
}

Fixed version (ground truth):
/** 
 * Constructs a new mailboxes widget.
 */
public Mailboxes(){
  Images images=GWT.create(Images.class);
  tree=new Tree(images);
  TreeItem root=new TreeItem(imageItemHTML(images.home(),"String_Node_Str"));
  tree.addItem(root);
  addImageItem(root,"String_Node_Str",images.inbox());
  addImageItem(root,"String_Node_Str",images.drafts());
  addImageItem(root,"String_Node_Str",images.templates());
  addImageItem(root,"String_Node_Str",images.sent());
  addImageItem(root,"String_Node_Str",images.trash());
  root.setState(true);
  initWidget(tree);
}
Program: 53577
Project: 53577
Buggy source:
@Override public void onCellPreview(CellPreviewEvent<T> event){
  NativeEvent nativeEvent=event.getNativeEvent();
  String eventType=event.getNativeEvent().getType();
  if (BrowserEvents.KEYDOWN.equals(eventType) && !event.isCellEditing()) {
switch (nativeEvent.getKeyCode()) {
case KeyCodes.KEY_DOWN:
      nextRow();
    handledEvent(event);
  return;
case KeyCodes.KEY_UP:
prevRow();
handledEvent(event);
return;
case KeyCodes.KEY_PAGEDOWN:
nextPage();
handledEvent(event);
return;
case KeyCodes.KEY_PAGEUP:
prevPage();
handledEvent(event);
return;
case KeyCodes.KEY_HOME:
home();
handledEvent(event);
return;
case KeyCodes.KEY_END:
end();
handledEvent(event);
return;
case 32:
handledEvent(event);
return;
}
}
 else if (BrowserEvents.CLICK.equals(eventType)) {
int relRow=event.getIndex() - display.getPageStart();
boolean isFocusable=false;
Element target=Element.as(event.getNativeEvent().getEventTarget());
isFocusable=CellBasedWidgetImpl.get().isFocusable(target);
display.setKeyboardSelectedRow(relRow,!isFocusable);
}
 else if (BrowserEvents.FOCUS.equals(eventType)) {
int relRow=event.getIndex() - display.getPageStart();
if (display.getKeyboardSelectedRow() != relRow) {
display.setKeyboardSelectedRow(event.getIndex(),false);
return;
}
}
}

Fixed version (ground truth):
@Override public void onCellPreview(CellPreviewEvent<T> event){
  NativeEvent nativeEvent=event.getNativeEvent();
  String eventType=event.getNativeEvent().getType();
  if (BrowserEvents.KEYDOWN.equals(eventType) && !event.isCellEditing()) {
switch (nativeEvent.getKeyCode()) {
case KeyCodes.KEY_DOWN:
      nextRow();
    handledEvent(event);
  return;
case KeyCodes.KEY_UP:
prevRow();
handledEvent(event);
return;
case KeyCodes.KEY_PAGEDOWN:
nextPage();
handledEvent(event);
return;
case KeyCodes.KEY_PAGEUP:
prevPage();
handledEvent(event);
return;
case KeyCodes.KEY_HOME:
home();
handledEvent(event);
return;
case KeyCodes.KEY_END:
end();
handledEvent(event);
return;
case 32:
handledEvent(event);
return;
}
}
 else if (BrowserEvents.CLICK.equals(eventType)) {
int relRow=event.getIndex() - display.getPageStart();
boolean isFocusable=false;
Element target=Element.as(event.getNativeEvent().getEventTarget());
isFocusable=CellBasedWidgetImpl.get().isFocusable(target);
display.setKeyboardSelectedRow(relRow,!isFocusable);
}
 else if (BrowserEvents.FOCUS.equals(eventType)) {
int relRow=event.getIndex() - display.getPageStart();
if (display.getKeyboardSelectedRow() != relRow) {
display.setKeyboardSelectedRow(relRow,false);
return;
}
}
}
Program: 53578
Project: 53578
Buggy source:
private void displayJSONObject(JSONValue jsonValue){
  jsonTree.removeItems();
  jsonTree.setVisible(true);
  TreeItem treeItem=jsonTree.addItem("String_Node_Str");
  addChildren(treeItem,jsonValue);
  treeItem.setStyleName("String_Node_Str");
  treeItem.setState(true);
}

Fixed version (ground truth):
private void displayJSONObject(JSONValue jsonValue){
  jsonTree.removeItems();
  jsonTree.setVisible(true);
  TreeItem treeItem=jsonTree.addItem(SafeHtmlUtils.fromString("String_Node_Str"));
  addChildren(treeItem,jsonValue);
  treeItem.setStyleName("String_Node_Str");
  treeItem.setState(true);
}
Program: 53579
Project: 53579
Buggy source:
private void displayError(String errorType,String errorMessage){
  jsonTree.removeItems();
  jsonTree.setVisible(true);
  TreeItem treeItem=jsonTree.addItem(errorType);
  treeItem.addItem(errorMessage);
  treeItem.setStyleName("String_Node_Str");
  treeItem.setState(true);
}

Fixed version (ground truth):
private void displayError(String errorType,String errorMessage){
  jsonTree.removeItems();
  jsonTree.setVisible(true);
  TreeItem treeItem=jsonTree.addItem(SafeHtmlUtils.fromString(errorType));
  treeItem.addItem(SafeHtmlUtils.fromString(errorMessage));
  treeItem.setStyleName("String_Node_Str");
  treeItem.setState(true);
}
Program: 53580
Project: 53580
Buggy source:
private String getChildText(String text){
  return "String_Node_Str" + text + "String_Node_Str";
}

Fixed version (ground truth):
private SafeHtml getChildText(String text){
  return new SafeHtmlBuilder().appendHtmlConstant("String_Node_Str").appendEscaped(text).appendHtmlConstant("String_Node_Str").toSafeHtml();
}
Program: 53581
Project: 53581
Buggy source:
private void addChildren(TreeItem treeItem,JSONValue jsonValue){
  JSONArray jsonArray;
  JSONObject jsonObject;
  JSONString jsonString;
  if ((jsonArray=jsonValue.isArray()) != null) {
    for (int i=0; i < jsonArray.size(); ++i) {
      TreeItem child=treeItem.addItem(getChildText("String_Node_Str" + Integer.toString(i) + "String_Node_Str"));
      addChildren(child,jsonArray.get(i));
    }
  }
 else   if ((jsonObject=jsonValue.isObject()) != null) {
    Set<String> keys=jsonObject.keySet();
    for (    String key : keys) {
      TreeItem child=treeItem.addItem(getChildText(key));
      addChildren(child,jsonObject.get(key));
    }
  }
 else   if ((jsonString=jsonValue.isString()) != null) {
    treeItem.addItem(jsonString.stringValue());
  }
 else {
    treeItem.addItem(getChildText(jsonValue.toString()));
  }
}

Fixed version (ground truth):
private void addChildren(TreeItem treeItem,JSONValue jsonValue){
  JSONArray jsonArray;
  JSONObject jsonObject;
  JSONString jsonString;
  if ((jsonArray=jsonValue.isArray()) != null) {
    for (int i=0; i < jsonArray.size(); ++i) {
      TreeItem child=treeItem.addItem(getChildText("String_Node_Str" + Integer.toString(i) + "String_Node_Str"));
      addChildren(child,jsonArray.get(i));
    }
  }
 else   if ((jsonObject=jsonValue.isObject()) != null) {
    Set<String> keys=jsonObject.keySet();
    for (    String key : keys) {
      TreeItem child=treeItem.addItem(getChildText(key));
      addChildren(child,jsonObject.get(key));
    }
  }
 else   if ((jsonString=jsonValue.isString()) != null) {
    treeItem.addItem(SafeHtmlUtils.fromString(jsonString.stringValue()));
  }
 else {
    treeItem.addItem(getChildText(jsonValue.toString()));
  }
}
Program: 53582
Project: 53582
Buggy source:
/** 
 * Closes the menu bar.
 * @deprecated Use {@link #addCloseHandler(CloseHandler)} instead
 */
@Override @Deprecated public void onPopupClosed(PopupPanel sender,boolean autoClosed){
  if (autoClosed) {
    closeAllParents();
  }
  onHide(!autoClosed);
  CloseEvent.fire(MenuBar.this,sender);
  shownChildMenu=null;
  popup=null;
  if (parentMenu != null && parentMenu.popup != null) {
    parentMenu.popup.setPreviewingAllNativeEvents(true);
  }
}

Fixed version (ground truth):
/** 
 * Closes the menu bar.
 * @deprecated Use {@link #addCloseHandler(CloseHandler)} instead
 */
@Override @Deprecated public void onPopupClosed(PopupPanel sender,boolean autoClosed){
  if (autoClosed) {
    closeAllParents();
  }
  onHide(!autoClosed && focusOnHover);
  CloseEvent.fire(MenuBar.this,sender);
  shownChildMenu=null;
  popup=null;
  if (parentMenu != null && parentMenu.popup != null) {
    parentMenu.popup.setPreviewingAllNativeEvents(true);
  }
}
Program: 53584
Project: 53584
Buggy source:
private boolean execImpl(JsBlock fragment){
  DuplicateFunctionBodyRecorder dfbr=new DuplicateFunctionBodyRecorder();
  dfbr.accept(fragment);
  int count=0;
  Map<JsFunction,JsName> hoistMap=new HashMap<JsFunction,JsName>();
  Map<JsFunction,JsFunction> dupMethodMap=dfbr.getDuplicateMethodMap();
  for (  JsFunction x : dupMethodMap.values()) {
    if (!hoistMap.containsKey(x)) {
      JsName newName=program.getScope().declareName("String_Node_Str" + count++);
      JsFunction newFunc=new JsFunction(x.getSourceInfo(),program.getScope(),newName,x.isFromJava());
      newFunc.setBody(x.getBody());
      newFunc.getParameters().addAll(x.getParameters());
      fragment.getStatements().add(newFunc.makeStmt());
      hoistMap.put(x,newName);
    }
  }
  ReplaceDuplicateInvocationNameRefs rdup=new ReplaceDuplicateInvocationNameRefs(dfbr.getDuplicateMap(),dfbr.getBlacklist(),dupMethodMap,hoistMap);
  rdup.accept(fragment);
  return rdup.didChange();
}

Fixed version (ground truth):
private boolean execImpl(){
  boolean changed=false;
  for (int i=0; i < program.getFragmentCount(); i++) {
    JsBlock fragment=program.getFragmentBlock(i);
    DuplicateFunctionBodyRecorder dfbr=new DuplicateFunctionBodyRecorder();
    dfbr.accept(fragment);
    Map<JsFunction,JsName> newNamesByHoistedFunction=new HashMap<JsFunction,JsName>();
    Map<JsFunction,JsFunction> dupMethodMap=dfbr.getDuplicateMethodMap();
    for (    JsFunction dupMethod : dupMethodMap.values()) {
      if (newNamesByHoistedFunction.containsKey(dupMethod)) {
        continue;
      }
      JsName newName=program.getScope().declareName(freshNameGenerator.getFreshName());
      JsFunction newFunc=new JsFunction(dupMethod.getSourceInfo(),program.getScope(),newName,dupMethod.isFromJava());
      newFunc.setBody(dupMethod.getBody());
      newFunc.getParameters().addAll(dupMethod.getParameters());
      fragment.getStatements().add(newFunc.makeStmt());
      newNamesByHoistedFunction.put(dupMethod,newName);
    }
    ReplaceDuplicateInvocationNameRefs rdup=new ReplaceDuplicateInvocationNameRefs(dfbr.getDuplicateMap(),dfbr.getBlacklist(),dupMethodMap,newNamesByHoistedFunction);
    rdup.accept(fragment);
    changed=changed || rdup.didChange();
  }
  if (changed) {
    JsUnusedFunctionRemover.exec(program);
  }
  return changed;
}
Program: 53585
Project: 53585
Buggy source:
public JsDuplicateFunctionRemover(JsProgram program){
  this.program=program;
}

Fixed version (ground truth):
public JsDuplicateFunctionRemover(JsProgram program,FreshNameGenerator freshNameGenerator){
  this.program=program;
  this.freshNameGenerator=freshNameGenerator;
}
Program: 53586
Project: 53586
Buggy source:
public static boolean exec(JsProgram program,JsBlock fragment){
  return new JsDuplicateFunctionRemover(program).execImpl(fragment);
}

Fixed version (ground truth):
/** 
 * Entry point for the removeDuplicateFunctions optimization. This optimization will collapse functions whose JavaScript (output) code is identical. After collapsing duplicate functions it will remove functions that become unreferenced as a result. This pass is safe only for JavaScript functions generated from Java where references to local function variables can not be extruded by returning a function. E,g. in the next example function f1() {return a;} funcion f2() { var a; return function() {return a;}} f1() and the return of f2() are not duplicates even though the have a syntacticaly identical parameters and body. The reason is that a in f1() refers to some globally scoped variable a, whereas a in the return of f2() refers to the local variable a. It would be not correct to move the return of f2() to the global scope. This situation does NOT arise from functions that where generated from Java sources (non native) IMPORTANT NOTE: It is NOT safe to rename JsNames after this pass is performed. E.g. Consider an output  JavaScript for two unrelated classes: defineSeed(...) //class A _.a _.m1 = function() { return this.a; } defineSeed(...) // class B _.a _.m2 = function() { return this.a; } Here m1() in class A and m2 in class B have identical parameters and bodies; hence the result will be defineSeed(...) //class A _.a _.m1 = g1 defineSeed(...) // class B _.a _.m2 = g1 function g1() { return this.a; } The reference to this.a in g1 will be to either A.a or B.a and as long as those names remain the same the removal was correct. However if A.a gets renamed then A.m1() and B.m2() would no longer have been identical hence the dedup that is already done is incorrect.
 * @param program the program to optimize
 * @param nameGenerator a freshNameGenerator to assign fresh names to deduped functions that arelifted to the global scope
 * @return {@code true} if it made any changes; {@code false} otherwise.
 */
public static boolean exec(JsProgram program,FreshNameGenerator nameGenerator){
  return new JsDuplicateFunctionRemover(program,nameGenerator).execImpl();
}
Program: 53587
Project: 53587
Buggy source:
@Override protected void visit(JsScope scope){
  int mySiblingsMaxId=maxChildId;
  maxChildId=0;
  for (  JsScope child : scope.getChildren()) {
    visit(child);
  }
  int curId=maxChildId;
  for (Iterator<JsName> it=scope.getAllNames(); it.hasNext(); ) {
    JsName name=it.next();
    if (!referenced.contains(name)) {
      continue;
    }
    if (!name.isObfuscatable()) {
      name.setShortIdent(name.getIdent());
      continue;
    }
    String newIdent;
    while (true) {
      newIdent=makeObfuscatedIdent(curId++);
      if (isLegal(scope,newIdent)) {
        break;
      }
    }
    name.setShortIdent(newIdent);
  }
  maxChildId=Math.max(mySiblingsMaxId,curId);
}

Fixed version (ground truth):
@Override protected void visit(JsScope scope){
  int mySiblingsMaxId=maxChildId;
  maxChildId=0;
  for (  JsScope child : scope.getChildren()) {
    visit(child);
  }
  int curId=maxChildId;
  for (Iterator<JsName> it=scope.getAllNames(); it.hasNext(); ) {
    JsName name=it.next();
    if (!referenced.contains(name)) {
      continue;
    }
    if (!name.isObfuscatable()) {
      name.setShortIdent(name.getIdent());
      continue;
    }
    String newIdent;
    while (true) {
      newIdent=makeObfuscatedIdent(curId++);
      if (isLegal(scope,newIdent)) {
        break;
      }
    }
    name.setShortIdent(newIdent);
  }
  maxChildId=Math.max(mySiblingsMaxId,curId);
  maxId=Math.max(maxId,maxChildId);
}
Program: 53588
Project: 53588
Buggy source:
public static void exec(JsProgram program,PropertyOracle[] propertyOracles){
  new JsObfuscateNamer(program,propertyOracles).execImpl();
}

Fixed version (ground truth):
public static FreshNameGenerator exec(JsProgram program,PropertyOracle[] propertyOracles){
  JsObfuscateNamer namer=new JsObfuscateNamer(program,propertyOracles);
  namer.execImpl();
  return namer;
}
Program: 53589
Project: 53589
Buggy source:
public static void exec(TreeLogger logger,JProgram jprogram,JsProgram jsprogram,JavaToJavaScriptMap map,int fragmentsToMerge,MultipleDependencyGraphRecorder dependencyRecorder,int leftOverMergeLimit){
  if (jprogram.getRunAsyncs().size() == 0) {
    return;
  }
  Event codeSplitterEvent=SpeedTracerLogger.start(CompilerEventType.CODE_SPLITTER);
  dependencyRecorder.open();
  new CodeSplitter2(logger,jprogram,jsprogram,map,fragmentsToMerge,dependencyRecorder,leftOverMergeLimit).execImpl();
  codeSplitterEvent.end();
}

Fixed version (ground truth):
public static void exec(TreeLogger logger,JProgram jprogram,JsProgram jsprogram,JavaToJavaScriptMap map,int fragmentsToMerge,MultipleDependencyGraphRecorder dependencyRecorder,int leftOverMergeLimit){
  if (jprogram.getRunAsyncs().size() == 0) {
    return;
  }
  Event codeSplitterEvent=SpeedTracerLogger.start(CompilerEventType.CODE_SPLITTER);
  dependencyRecorder.open();
  new CodeSplitter2(logger,jprogram,jsprogram,map,fragmentsToMerge,dependencyRecorder,leftOverMergeLimit).execImpl();
  dependencyRecorder.close();
  codeSplitterEvent.end();
}