nus-yam/ex-repair huggingface dataset:
Program: 18683
Project: 18683
Buggy source:
private void traverse(Node node){
  if (!shouldVisit(node)) {
    return;
  }
  int visits=0;
  do {
    for (Node c=node.getFirstChild(); c != null; c=c.getNext()) {
      traverse(c);
    }
    visit(node);
    visits++;
    Preconditions.checkState(visits < 10000,"String_Node_Str");
  }
 while (shouldRetraverse(node));
  exitNode(node);
}

Fixed version (ground truth):
private void traverse(Node node){
  if (!shouldVisit(node)) {
    return;
  }
  int visits=0;
  do {
    Node c=node.getFirstChild();
    while (c != null) {
      Node next=c.getNext();
      traverse(c);
      c=next;
    }
    visit(node);
    visits++;
    Preconditions.checkState(visits < 10000,"String_Node_Str");
  }
 while (shouldRetraverse(node));
  exitNode(node);
}
Program: 18684
Project: 18684
Buggy source:
public void testSuppressEs5StrictWarning(){
  CompilerOptions options=createCompilerOptions();
  options.setWarningLevel(DiagnosticGroups.ES5_STRICT,CheckLevel.WARNING);
  testSame(options,"String_Node_Str" + "String_Node_Str");
}

Fixed version (ground truth):
public void testSuppressEs5StrictWarning(){
  CompilerOptions options=createCompilerOptions();
  options.setWarningLevel(DiagnosticGroups.ES5_STRICT,CheckLevel.WARNING);
  test(options,"String_Node_Str" + "String_Node_Str","String_Node_Str");
}
Program: 18685
Project: 18685
Buggy source:
public void testVarDeclarationsIntoFor(){
  CompilerOptions options=createCompilerOptions();
  options.collapseVariableDeclarations=false;
  String code="String_Node_Str";
  testSame(options,code);
  options.collapseVariableDeclarations=false;
  test(options,code,"String_Node_Str");
}

Fixed version (ground truth):
public void testVarDeclarationsIntoFor(){
  CompilerOptions options=createCompilerOptions();
  options.collapseVariableDeclarations=false;
  String code="String_Node_Str";
  testSame(options,code);
  options.collapseVariableDeclarations=true;
  test(options,code,"String_Node_Str");
}
Program: 18686
Project: 18686
Buggy source:
protected Node parse(String[] original,CompilerOptions options){
  Compiler compiler=new Compiler();
  List<SourceFile> inputs=Lists.newArrayList();
  for (int i=0; i < original.length; i++) {
    inputs.add(SourceFile.fromCode("String_Node_Str" + i,original[i]));
  }
  compiler.init(externs,inputs,options);
  checkUnexpectedErrorsOrWarnings(compiler,0);
  Node all=compiler.parseInputs();
  checkUnexpectedErrorsOrWarnings(compiler,0);
  Node n=all.getLastChild();
  Node externs=all.getFirstChild();
  (new CreateSyntheticBlocks(compiler,"String_Node_Str","String_Node_Str")).process(externs,n);
  (new Normalize(compiler,false)).process(externs,n);
  (MakeDeclaredNamesUnique.getContextualRenameInverter(compiler)).process(externs,n);
  (new Denormalize(compiler)).process(externs,n);
  return n;
}

Fixed version (ground truth):
protected Node parse(String[] original,CompilerOptions options){
  Compiler compiler=new Compiler();
  List<SourceFile> inputs=Lists.newArrayList();
  for (int i=0; i < original.length; i++) {
    inputs.add(SourceFile.fromCode("String_Node_Str" + i,original[i]));
  }
  compiler.init(externs,inputs,options);
  checkUnexpectedErrorsOrWarnings(compiler,0);
  Node all=compiler.parseInputs();
  checkUnexpectedErrorsOrWarnings(compiler,0);
  Node n=all.getLastChild();
  Node externs=all.getFirstChild();
  (new CreateSyntheticBlocks(compiler,"String_Node_Str","String_Node_Str")).process(externs,n);
  return n;
}
Program: 18687
Project: 18687
Buggy source:
Candidate(String varName,Node defCfgNode,Node use,Node useCfgNode){
  Preconditions.checkArgument(use.isName());
  this.varName=varName;
  this.defCfgNode=defCfgNode;
  this.use=use;
  this.useCfgNode=useCfgNode;
}

Fixed version (ground truth):
Candidate(String varName,Definition defMetadata,Node use,Node useCfgNode){
  Preconditions.checkArgument(use.isName());
  this.varName=varName;
  this.defMetadata=defMetadata;
  this.use=use;
  this.useCfgNode=useCfgNode;
}
Program: 18689
Project: 18689
Buggy source:
@Override public void enterScope(NodeTraversal t){
  if (t.inGlobalScope()) {
    return;
  }
  if (LiveVariablesAnalysis.MAX_VARIABLES_TO_ANALYZE < t.getScope().getVarCount()) {
    return;
  }
  ControlFlowAnalysis cfa=new ControlFlowAnalysis(compiler,false,true);
  Preconditions.checkState(t.getScopeRoot().isFunction());
  cfa.process(null,t.getScopeRoot().getLastChild());
  cfg=cfa.getCfg();
  reachingDef=new MustBeReachingVariableDef(cfg,t.getScope(),compiler);
  reachingDef.analyze();
  candidates=Lists.newLinkedList();
  new NodeTraversal(compiler,new GatherCandiates()).traverse(t.getScopeRoot().getLastChild());
  reachingUses=new MaybeReachingVariableUse(cfg,t.getScope(),compiler);
  reachingUses.analyze();
  for (  Candidate c : candidates) {
    if (c.canInline()) {
      c.inlineVariable();
    }
  }
}

Fixed version (ground truth):
@Override public void enterScope(NodeTraversal t){
  if (t.inGlobalScope()) {
    return;
  }
  if (LiveVariablesAnalysis.MAX_VARIABLES_TO_ANALYZE < t.getScope().getVarCount()) {
    return;
  }
  ControlFlowAnalysis cfa=new ControlFlowAnalysis(compiler,false,true);
  Preconditions.checkState(t.getScopeRoot().isFunction());
  cfa.process(null,t.getScopeRoot().getLastChild());
  cfg=cfa.getCfg();
  reachingDef=new MustBeReachingVariableDef(cfg,t.getScope(),compiler);
  reachingDef.analyze();
  candidates=Lists.newLinkedList();
  new NodeTraversal(compiler,new GatherCandiates()).traverse(t.getScopeRoot().getLastChild());
  reachingUses=new MaybeReachingVariableUse(cfg,t.getScope(),compiler);
  reachingUses.analyze();
  for (  Candidate c : candidates) {
    if (c.canInline()) {
      c.inlineVariable();
      if (!c.defMetadata.depends.isEmpty()) {
        inlinedNewDependencies.add(t.getScope().getVar(c.varName));
      }
    }
  }
}
Program: 18690
Project: 18690
Buggy source:
/** 
 * Gets the must reaching definition of a given node. The node must be one of the control flow graph nodes.
 * @param name name of the variable. It can only be names of local variablethat are not function parameters, escaped variables or variables declared in catch.
 * @param useNode the location of the use where the definition reaches.
 */
Node getDef(String name,Node useNode){
  Preconditions.checkArgument(getCfg().hasNode(useNode));
  GraphNode<Node,Branch> n=getCfg().getNode(useNode);
  FlowState<MustDef> state=n.getAnnotation();
  Definition def=state.getIn().reachingDef.get(jsScope.getVar(name));
  if (def == null) {
    return null;
  }
 else {
    return def.node;
  }
}

Fixed version (ground truth):
/** 
 * Gets the must reaching definition of a given node.
 * @param name name of the variable. It can only be names of local variablethat are not function parameters, escaped variables or variables declared in catch.
 * @param useNode the location of the use where the definition reaches.
 */
Definition getDef(String name,Node useNode){
  Preconditions.checkArgument(getCfg().hasNode(useNode));
  GraphNode<Node,Branch> n=getCfg().getNode(useNode);
  FlowState<MustDef> state=n.getAnnotation();
  return state.getIn().reachingDef.get(jsScope.getVar(name));
}
Program: 18691
Project: 18691
Buggy source:
boolean dependsOnOuterScopeVars(String name,Node useNode){
  Preconditions.checkArgument(getCfg().hasNode(useNode));
  GraphNode<Node,Branch> n=getCfg().getNode(useNode);
  FlowState<MustDef> state=n.getAnnotation();
  Definition def=state.getIn().reachingDef.get(jsScope.getVar(name));
  if (def.unknownDependencies) {
    return true;
  }
  for (  Var s : def.depends) {
    if (s.scope != jsScope) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
boolean dependsOnOuterScopeVars(Definition def){
  if (def.unknownDependencies) {
    return true;
  }
  for (  Var s : def.depends) {
    if (s.scope != jsScope) {
      return true;
    }
  }
  return false;
}
Program: 18692
Project: 18692
Buggy source:
public void testFunctionParams1(){
  computeDefUse("String_Node_Str");
  assertSame(def,defUse.getDef("String_Node_Str",use));
}

Fixed version (ground truth):
public void testFunctionParams1(){
  computeDefUse("String_Node_Str");
  assertSame(def,defUse.getDefNode("String_Node_Str",use));
}
Program: 18693
Project: 18693
Buggy source:
public void testFunctionParams2(){
  computeDefUse("String_Node_Str");
  assertNotSame(def,defUse.getDef("String_Node_Str",use));
}

Fixed version (ground truth):
public void testFunctionParams2(){
  computeDefUse("String_Node_Str");
  assertNotSame(def,defUse.getDefNode("String_Node_Str",use));
}
Program: 18694
Project: 18694
Buggy source:
/** 
 * The use of x at U: is the definition of x at D:.
 */
private void assertMatch(String src){
  computeDefUse(src);
  assertSame(def,defUse.getDef("String_Node_Str",use));
}

Fixed version (ground truth):
/** 
 * The use of x at U: is the definition of x at D:.
 */
private void assertMatch(String src){
  computeDefUse(src);
  assertSame(def,defUse.getDefNode("String_Node_Str",use));
}
Program: 18695
Project: 18695
Buggy source:
public void testArgumentsObjectEscaped(){
  computeDefUse("String_Node_Str");
  assertNotSame(def,defUse.getDef("String_Node_Str",use));
}

Fixed version (ground truth):
public void testArgumentsObjectEscaped(){
  computeDefUse("String_Node_Str");
  assertNotSame(def,defUse.getDefNode("String_Node_Str",use));
}
Program: 18696
Project: 18696
Buggy source:
/** 
 * The use of x at U: is not the definition of x at D:.
 */
private void assertNotMatch(String src){
  computeDefUse(src);
  assertNotSame(def,defUse.getDef("String_Node_Str",use));
}

Fixed version (ground truth):
/** 
 * The use of x at U: is not the definition of x at D:.
 */
private void assertNotMatch(String src){
  computeDefUse(src);
  assertNotSame(def,defUse.getDefNode("String_Node_Str",use));
}
Program: 18697
Project: 18697
Buggy source:
public void testArgumentsObjectModifications(){
  computeDefUse("String_Node_Str");
  assertNotSame(def,defUse.getDef("String_Node_Str",use));
}

Fixed version (ground truth):
public void testArgumentsObjectModifications(){
  computeDefUse("String_Node_Str");
  assertNotSame(def,defUse.getDefNode("String_Node_Str",use));
}
Program: 18698
Project: 18698
Buggy source:
@Override public void addDeclaredName(String name){
  Preconditions.checkState(!name.equals(ARGUMENTS));
  if (!declarations.containsKey(name)) {
    declarations.put(name,getUniqueName(name));
  }
}

Fixed version (ground truth):
@Override public void addDeclaredName(String name){
  if (whitelist.contains(name)) {
    delegate.addDeclaredName(name);
  }
}
Program: 18699
Project: 18699
Buggy source:
@Override public String getReplacementName(String oldName){
  return declarations.get(oldName);
}

Fixed version (ground truth):
@Override public String getReplacementName(String oldName){
  return whitelist.contains(oldName) ? delegate.getReplacementName(oldName) : null;
}
Program: 18700
Project: 18700
Buggy source:
@Override public boolean stripConstIfReplaced(){
  return removeConstness;
}

Fixed version (ground truth):
@Override public boolean stripConstIfReplaced(){
  return delegate.stripConstIfReplaced();
}
Program: 18701
Project: 18701
Buggy source:
@Override public Renamer forChildScope(){
  return new InlineRenamer(uniqueIdSupplier,idPrefix,false);
}

Fixed version (ground truth):
@Override public Renamer forChildScope(){
  return new WhitelistedRenamer(delegate.forChildScope(),whitelist);
}
Program: 18702
Project: 18702
Buggy source:
private void findAliases(NodeTraversal t){
  Scope scope=t.getScope();
  for (  Var v : scope.getVarIterable()) {
    Node n=v.getNode();
    int type=n.getType();
    Node parent=n.getParent();
    if (parent.isVar() && n.hasChildren() && n.getFirstChild().isQualifiedName()) {
      String name=n.getString();
      Var aliasVar=scope.getVar(name);
      aliases.put(name,aliasVar);
      String qualifiedName=aliasVar.getInitialValue().getQualifiedName();
      transformation.addAlias(name,qualifiedName);
    }
 else     if (v.isBleedingFunction()) {
    }
 else     if (parent.getType() == Token.LP) {
    }
 else {
      report(t,n,GOOG_SCOPE_NON_ALIAS_LOCAL,n.getString());
    }
  }
}

Fixed version (ground truth):
private void findAliases(NodeTraversal t){
  Scope scope=t.getScope();
  for (  Var v : scope.getVarIterable()) {
    Node n=v.getNode();
    int type=n.getType();
    Node parent=n.getParent();
    if (parent.isVar() && n.hasChildren() && n.getFirstChild().isQualifiedName()) {
      String name=n.getString();
      Var aliasVar=scope.getVar(name);
      aliases.put(name,aliasVar);
      String qualifiedName=aliasVar.getInitialValue().getQualifiedName();
      transformation.addAlias(name,qualifiedName);
      int rootIndex=qualifiedName.indexOf("String_Node_Str");
      if (rootIndex != -1) {
        String qNameRoot=qualifiedName.substring(0,rootIndex);
        if (!aliases.containsKey(qNameRoot)) {
          forbiddenLocals.add(qNameRoot);
        }
      }
    }
 else     if (v.isBleedingFunction()) {
    }
 else     if (parent.getType() == Token.LP) {
    }
 else {
      report(t,n,GOOG_SCOPE_NON_ALIAS_LOCAL,n.getString());
    }
  }
}
Program: 18703
Project: 18703
Buggy source:
@Override public void exitScope(NodeTraversal t){
  if (t.getScopeDepth() == 2) {
    aliases.clear();
    transformation=null;
  }
}

Fixed version (ground truth):
@Override public void exitScope(NodeTraversal t){
  if (t.getScopeDepth() > 2) {
    findNamespaceShadows(t);
  }
  if (t.getScopeDepth() == 2) {
    renameNamespaceShadows(t);
    aliases.clear();
    forbiddenLocals.clear();
    transformation=null;
    hasNamespaceShadows=false;
  }
}
Program: 18704
Project: 18704
Buggy source:
/** 
 * @param iterator The to use while inspecting the nodebeginning with the deepest ancestor.
 */
private LocalVarMotion(Node nameNode,FunctionlessLocalScope iterator){
  Preconditions.checkArgument(nameNode.isName());
  Node valueNode=NodeUtil.getAssignedValue(nameNode);
  this.varName=nameNode.getString();
  this.valueHasSideEffects=valueNode != null && NodeUtil.mayHaveSideEffects(valueNode);
  this.iterator=iterator;
  advanceLookAhead(true);
}

Fixed version (ground truth):
/** 
 * @param iterator The iterator to use while inspecting the nodebeginning with the deepest ancestor.
 */
private LocalVarMotion(Node nameNode,FunctionlessLocalScope iterator){
  Preconditions.checkArgument(nameNode.isName());
  Node valueNode=NodeUtil.getAssignedValue(nameNode);
  this.varName=nameNode.getString();
  this.valueHasSideEffects=valueNode != null && NodeUtil.mayHaveSideEffects(valueNode);
  this.iterator=iterator;
  advanceLookAhead(true);
}
Program: 18705
Project: 18705
Buggy source:
private void advanceLookAhead(boolean atStart){
  if (!atStart) {
    if (lookAhead == null) {
      return;
    }
    Node curNode=iterator.current();
    if (curNode.isName() && varName.equals(curNode.getString())) {
      lookAhead=null;
      return;
    }
  }
  if (!iterator.hasNext()) {
    lookAhead=null;
    return;
  }
  Node nextNode=iterator.next();
  Node nextParent=iterator.currentParent();
  int type=nextNode.getType();
  if (valueHasSideEffects) {
    if (type == Token.NAME && !varName.equals(nextNode.getString())) {
      boolean blocked=false;
      if (nextParent == null) {
        blocked=true;
      }
 else {
        boolean assignsName=(nextParent.isAssign() && nextNode == nextParent.getFirstChild());
        boolean isVarDeclaration=(nextParent.isVar());
        if (!assignsName && !isVarDeclaration) {
          blocked=true;
        }
      }
      if (blocked) {
        lookAhead=null;
        return;
      }
    }
  }
  if (NodeUtil.nodeTypeMayHaveSideEffects(nextNode) && type != Token.NAME || type == Token.NAME && nextParent.isCatch()) {
    lookAhead=null;
    return;
  }
  lookAhead=nextNode;
}

Fixed version (ground truth):
private void advanceLookAhead(boolean atStart){
  if (!atStart) {
    if (lookAhead == null) {
      return;
    }
    Node curNode=iterator.current();
    if (curNode.isName() && varName.equals(curNode.getString())) {
      lookAhead=null;
      return;
    }
  }
  if (!iterator.hasNext()) {
    lookAhead=null;
    return;
  }
  Node nextNode=iterator.next();
  Node nextParent=iterator.currentParent();
  int type=nextNode.getType();
  if (valueHasSideEffects) {
    boolean readsState=false;
    if ((nextNode.isName() && !varName.equals(nextNode.getString())) || (nextNode.isGetProp() || nextNode.isGetElem())) {
      if (nextParent == null || !NodeUtil.isVarOrSimpleAssignLhs(nextNode,nextParent)) {
        readsState=true;
      }
    }
 else     if (nextNode.isCall() || nextNode.isNew()) {
      readsState=true;
    }
    if (readsState) {
      lookAhead=null;
      return;
    }
  }
  if (NodeUtil.nodeTypeMayHaveSideEffects(nextNode) && type != Token.NAME || type == Token.NAME && nextParent.isCatch()) {
    lookAhead=null;
    return;
  }
  lookAhead=nextNode;
}
Program: 18706
Project: 18706
Buggy source:
/** 
 * Returns a   {@code CompilerEnvirons} suitable for using Rhinoin an IDE environment.  Most features are enabled by default. The  {@link ErrorReporter} is set to an {@link ErrorCollector}.
 */
public static CompilerEnvirons ideEnvirons(){
  CompilerEnvirons env=new CompilerEnvirons();
  env.setRecoverFromErrors(true);
  env.setRecordingComments(true);
  env.setStrictMode(true);
  env.setWarnTrailingComma(true);
  env.setLanguageVersion(170);
  env.setReservedKeywordAsIdentifier(true);
  env.setAllowKeywordAsObjectPropertyName(true);
  env.setIdeMode(true);
  env.setErrorReporter(new ErrorCollector());
  return env;
}

Fixed version (ground truth):
/** 
 * Returns a   {@code CompilerEnvirons} suitable for using Rhinoin an IDE environment.  Most features are enabled by default. The  {@link ErrorReporter} is set to an {@link ErrorCollector}.
 */
public static CompilerEnvirons ideEnvirons(){
  CompilerEnvirons env=new CompilerEnvirons();
  env.setRecoverFromErrors(true);
  env.setRecordingComments(true);
  env.setStrictMode(true);
  env.setWarnTrailingComma(true);
  env.setLanguageVersion(170);
  env.setReservedKeywordAsIdentifier(true);
  env.setIdeMode(true);
  env.setErrorReporter(new ErrorCollector());
  return env;
}
Program: 18707
Project: 18707
Buggy source:
public CompilerEnvirons(){
  errorReporter=DefaultErrorReporter.instance;
  languageVersion=Context.VERSION_DEFAULT;
  generateDebugInfo=true;
  reservedKeywordAsIdentifier=true;
  allowKeywordAsObjectPropertyName=false;
  allowMemberExprAsFunctionName=false;
  xmlAvailable=true;
  optimizationLevel=0;
  generatingSource=true;
  strictMode=false;
  warningAsError=false;
  generateObserverCount=false;
  allowSharpComments=false;
}

Fixed version (ground truth):
public CompilerEnvirons(){
  errorReporter=DefaultErrorReporter.instance;
  languageVersion=Context.VERSION_DEFAULT;
  generateDebugInfo=true;
  reservedKeywordAsIdentifier=true;
  allowMemberExprAsFunctionName=false;
  xmlAvailable=true;
  optimizationLevel=0;
  generatingSource=true;
  strictMode=false;
  warningAsError=false;
  generateObserverCount=false;
  allowSharpComments=false;
}
Program: 18708
Project: 18708
Buggy source:
public void initFromContext(Context cx){
  setErrorReporter(cx.getErrorReporter());
  languageVersion=cx.getLanguageVersion();
  generateDebugInfo=(!cx.isGeneratingDebugChanged() || cx.isGeneratingDebug());
  reservedKeywordAsIdentifier=cx.hasFeature(Context.FEATURE_RESERVED_KEYWORD_AS_IDENTIFIER);
  allowKeywordAsObjectPropertyName=(languageVersion >= Context.VERSION_1_8);
  allowMemberExprAsFunctionName=cx.hasFeature(Context.FEATURE_MEMBER_EXPR_AS_FUNCTION_NAME);
  strictMode=cx.hasFeature(Context.FEATURE_STRICT_MODE);
  warningAsError=cx.hasFeature(Context.FEATURE_WARNING_AS_ERROR);
  xmlAvailable=cx.hasFeature(Context.FEATURE_E4X);
  optimizationLevel=cx.getOptimizationLevel();
  generatingSource=cx.isGeneratingSource();
  activationNames=cx.activationNames;
  generateObserverCount=cx.generateObserverCount;
}

Fixed version (ground truth):
public void initFromContext(Context cx){
  setErrorReporter(cx.getErrorReporter());
  languageVersion=cx.getLanguageVersion();
  generateDebugInfo=(!cx.isGeneratingDebugChanged() || cx.isGeneratingDebug());
  reservedKeywordAsIdentifier=cx.hasFeature(Context.FEATURE_RESERVED_KEYWORD_AS_IDENTIFIER);
  allowMemberExprAsFunctionName=cx.hasFeature(Context.FEATURE_MEMBER_EXPR_AS_FUNCTION_NAME);
  strictMode=cx.hasFeature(Context.FEATURE_STRICT_MODE);
  warningAsError=cx.hasFeature(Context.FEATURE_WARNING_AS_ERROR);
  xmlAvailable=cx.hasFeature(Context.FEATURE_E4X);
  optimizationLevel=cx.getOptimizationLevel();
  generatingSource=cx.isGeneratingSource();
  activationNames=cx.activationNames;
  generateObserverCount=cx.generateObserverCount;
}
Program: 18711
Project: 18711
Buggy source:
@Override protected void setUp() throws Exception {
  super.setUp();
  allowKeywordsAsObjectLiteralsKeys=false;
}

Fixed version (ground truth):
@Override protected void setUp() throws Exception {
  super.setUp();
  environment=new CompilerEnvirons();
}
Program: 18712
Project: 18712
Buggy source:
public void testParseObjectLiteral2(){
  expectParseErrors("String_Node_Str",new String[]{"String_Node_Str"});
  allowKeywordsAsObjectLiteralsKeys=true;
  parse("String_Node_Str");
}

Fixed version (ground truth):
public void testParseObjectLiteral2(){
  environment.setReservedKeywordAsIdentifier(false);
  expectParseErrors("String_Node_Str",new String[]{"String_Node_Str"});
  environment.setReservedKeywordAsIdentifier(true);
  parse("String_Node_Str");
}
Program: 18713
Project: 18713
Buggy source:
public void testParseObjectLiteral1(){
  allowKeywordsAsObjectLiteralsKeys=true;
  parse("String_Node_Str");
  parse("String_Node_Str");
  parse("String_Node_Str");
  parse("String_Node_Str");
  parse("String_Node_Str");
  parse("String_Node_Str");
  parse("String_Node_Str");
  parse("String_Node_Str");
  parse("String_Node_Str");
  parse("String_Node_Str");
  parse("String_Node_Str");
}

Fixed version (ground truth):
public void testParseObjectLiteral1(){
  environment.setReservedKeywordAsIdentifier(true);
  parse("String_Node_Str");
  parse("String_Node_Str");
  parse("String_Node_Str");
  parse("String_Node_Str");
  parse("String_Node_Str");
  parse("String_Node_Str");
  parse("String_Node_Str");
  parse("String_Node_Str");
  parse("String_Node_Str");
  parse("String_Node_Str");
  parse("String_Node_Str");
}
Program: 18714
Project: 18714
Buggy source:
private AstRoot parseAsReader(String string) throws IOException {
  CompilerEnvirons environment=new CompilerEnvirons();
  TestErrorReporter testErrorReporter=new TestErrorReporter(null,null);
  environment.setErrorReporter(testErrorReporter);
  environment.setRecordingComments(true);
  environment.setRecordingLocalJsDocComments(true);
  Parser p=new Parser(environment,testErrorReporter);
  AstRoot script=p.parse(new StringReader(string),null,0);
  assertTrue(testErrorReporter.hasEncounteredAllErrors());
  assertTrue(testErrorReporter.hasEncounteredAllWarnings());
  return script;
}

Fixed version (ground truth):
private AstRoot parseAsReader(String string) throws IOException {
  TestErrorReporter testErrorReporter=new TestErrorReporter(null,null);
  environment.setErrorReporter(testErrorReporter);
  environment.setRecordingComments(true);
  environment.setRecordingLocalJsDocComments(true);
  Parser p=new Parser(environment,testErrorReporter);
  AstRoot script=p.parse(new StringReader(string),null,0);
  assertTrue(testErrorReporter.hasEncounteredAllErrors());
  assertTrue(testErrorReporter.hasEncounteredAllWarnings());
  return script;
}
Program: 18715
Project: 18715
Buggy source:
public void testParseKeywordPropertyAccess(){
  allowKeywordsAsObjectLiteralsKeys=true;
  parse("String_Node_Str");
  parse("String_Node_Str");
}

Fixed version (ground truth):
public void testParseKeywordPropertyAccess(){
  environment.setReservedKeywordAsIdentifier(true);
  parse("String_Node_Str");
  parse("String_Node_Str");
}
Program: 18716
Project: 18716
Buggy source:
private AstRoot parse(String string,final String[] errors,final String[] warnings,boolean jsdoc){
  CompilerEnvirons environment=new CompilerEnvirons();
  environment.setReservedKeywordAsIdentifier(allowKeywordsAsObjectLiteralsKeys);
  TestErrorReporter testErrorReporter=new TestErrorReporter(errors,warnings){
    @Override public EvaluatorException runtimeError(    String message,    String sourceName,    int line,    String lineSource,    int lineOffset){
      if (errors == null) {
        throw new UnsupportedOperationException();
      }
      return new EvaluatorException(message,sourceName,line,lineSource,lineOffset);
    }
  }
;
  environment.setErrorReporter(testErrorReporter);
  environment.setRecordingComments(true);
  environment.setRecordingLocalJsDocComments(jsdoc);
  Parser p=new Parser(environment,testErrorReporter);
  AstRoot script=null;
  try {
    script=p.parse(string,null,0);
  }
 catch (  EvaluatorException e) {
    if (errors == null) {
      throw e;
    }
  }
  assertTrue(testErrorReporter.hasEncounteredAllErrors());
  assertTrue(testErrorReporter.hasEncounteredAllWarnings());
  return script;
}

Fixed version (ground truth):
private AstRoot parse(String string,final String[] errors,final String[] warnings,boolean jsdoc){
  TestErrorReporter testErrorReporter=new TestErrorReporter(errors,warnings){
    @Override public EvaluatorException runtimeError(    String message,    String sourceName,    int line,    String lineSource,    int lineOffset){
      if (errors == null) {
        throw new UnsupportedOperationException();
      }
      return new EvaluatorException(message,sourceName,line,lineSource,lineOffset);
    }
  }
;
  environment.setErrorReporter(testErrorReporter);
  environment.setRecordingComments(true);
  environment.setRecordingLocalJsDocComments(jsdoc);
  Parser p=new Parser(environment,testErrorReporter);
  AstRoot script=null;
  try {
    script=p.parse(string,null,0);
  }
 catch (  EvaluatorException e) {
    if (errors == null) {
      throw e;
    }
  }
  assertTrue(testErrorReporter.hasEncounteredAllErrors());
  assertTrue(testErrorReporter.hasEncounteredAllWarnings());
  return script;
}
Program: 18718
Project: 18718
Buggy source:
private FlowScope traverseNew(Node n,FlowScope scope){
  Node constructor=n.getFirstChild();
  scope=traverse(constructor,scope);
  JSType constructorType=constructor.getJSType();
  JSType type=null;
  if (constructorType != null) {
    constructorType=constructorType.restrictByNotNullOrUndefined();
    if (constructorType.isUnknownType()) {
      type=getNativeType(UNKNOWN_TYPE);
    }
 else {
      FunctionType ct=constructorType.toMaybeFunctionType();
      if (ct == null && constructorType instanceof FunctionType) {
        ct=(FunctionType)constructorType;
      }
      if (ct != null && ct.isConstructor()) {
        type=ct.getInstanceType();
      }
    }
  }
  n.setJSType(type);
  for (Node arg=constructor.getNext(); arg != null; arg=arg.getNext()) {
    scope=traverse(arg,scope);
  }
  return scope;
}

Fixed version (ground truth):
private FlowScope traverseNew(Node n,FlowScope scope){
  scope=traverseChildren(n,scope);
  Node constructor=n.getFirstChild();
  JSType constructorType=constructor.getJSType();
  JSType type=null;
  if (constructorType != null) {
    constructorType=constructorType.restrictByNotNullOrUndefined();
    if (constructorType.isUnknownType()) {
      type=getNativeType(UNKNOWN_TYPE);
    }
 else {
      FunctionType ct=constructorType.toMaybeFunctionType();
      if (ct == null && constructorType instanceof FunctionType) {
        ct=(FunctionType)constructorType;
      }
      if (ct != null && ct.isConstructor()) {
        type=ct.getInstanceType();
        backwardsInferenceFromCallSite(n,ct);
      }
    }
  }
  n.setJSType(type);
  return scope;
}
Program: 18719
Project: 18719
Buggy source:
/** 
 * Gets the type of   {@code this} in this function.
 */
@Override public ObjectType getTypeOfThis(){
  return typeOfThis.isNoObjectType() ? registry.getNativeObjectType(JSTypeNative.OBJECT_TYPE) : typeOfThis;
}

Fixed version (ground truth):
/** 
 * Gets the type of   {@code this} in this function.
 */
@Override public ObjectType getTypeOfThis(){
  return typeOfThis.isNoObjectType() ? registry.getNativeObjectType(JSTypeNative.UNKNOWN_TYPE) : typeOfThis;
}
Program: 18720
Project: 18720
Buggy source:
@Override public void process(Node externs,Node root){
  (new NodeTraversal(compiler,this)).traverse(root);
}

Fixed version (ground truth):
@Override public void process(Node externs,Node root){
  (new NodeTraversal(compiler,this)).traverseRoots(externs,root);
}
Program: 18721
Project: 18721
Buggy source:
boolean dependsOnOuterScopeVars(String name,Node useNode){
  Preconditions.checkArgument(getCfg().hasNode(useNode));
  GraphNode<Node,Branch> n=getCfg().getNode(useNode);
  FlowState<MustDef> state=n.getAnnotation();
  Definition def=state.getIn().reachingDef.get(jsScope.getVar(name));
  for (  Var s : def.depends) {
    if (s.scope != jsScope) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
boolean dependsOnOuterScopeVars(String name,Node useNode){
  Preconditions.checkArgument(getCfg().hasNode(useNode));
  GraphNode<Node,Branch> n=getCfg().getNode(useNode);
  FlowState<MustDef> state=n.getAnnotation();
  Definition def=state.getIn().reachingDef.get(jsScope.getVar(name));
  if (def.unknownDependencies) {
    return true;
  }
  for (  Var s : def.depends) {
    if (s.scope != jsScope) {
      return true;
    }
  }
  return false;
}
Program: 18722
Project: 18722
Buggy source:
/** 
 * Computes all the local variables that rValue reads from and store that in the def's depends set.
 */
private void computeDependence(final Definition def,Node rValue){
  NodeTraversal.traverse(compiler,rValue,new AbstractCfgNodeTraversalCallback(){
    @Override public void visit(    NodeTraversal t,    Node n,    Node parent){
      if (n.isName() && jsScope.isDeclared(n.getString(),true)) {
        def.depends.add(jsScope.getVar(n.getString()));
      }
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Computes all the local variables that rValue reads from and store that in the def's depends set.
 */
private void computeDependence(final Definition def,Node rValue){
  NodeTraversal.traverse(compiler,rValue,new AbstractCfgNodeTraversalCallback(){
    @Override public void visit(    NodeTraversal t,    Node n,    Node parent){
      if (n.isName()) {
        Var dep=jsScope.getVar(n.getString());
        if (dep == null) {
          def.unknownDependencies=true;
        }
 else {
          def.depends.add(dep);
        }
      }
    }
  }
);
}
Program: 18723
Project: 18723
Buggy source:
@Override public void visit(NodeTraversal t,Node n,Node parent){
  if (n.isName() && jsScope.isDeclared(n.getString(),true)) {
    def.depends.add(jsScope.getVar(n.getString()));
  }
}

Fixed version (ground truth):
@Override public void visit(NodeTraversal t,Node n,Node parent){
  if (n.isName()) {
    Var dep=jsScope.getVar(n.getString());
    if (dep == null) {
      def.unknownDependencies=true;
    }
 else {
      def.depends.add(dep);
    }
  }
}
Program: 18724
Project: 18724
Buggy source:
public void testInlineAcrossSideEffect1(){
  inline("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
public void testInlineAcrossSideEffect1(){
  noInline("String_Node_Str");
}
Program: 18725
Project: 18725
Buggy source:
public void testInlineExpression9(){
  inline("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
public void testInlineExpression9(){
  inline("String_Node_Str" + "String_Node_Str","String_Node_Str" + "String_Node_Str");
}
Program: 18726
Project: 18726
Buggy source:
public void testInlineExpression8(){
  inline("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
public void testInlineExpression8(){
  inline("String_Node_Str" + "String_Node_Str","String_Node_Str" + "String_Node_Str");
}
Program: 18727
Project: 18727
Buggy source:
public void testCanInlineAcrossNoSideEffect(){
  inline("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
public void testCanInlineAcrossNoSideEffect(){
  noInline("String_Node_Str");
}
Program: 18728
Project: 18728
Buggy source:
@Override public void matchConstraint(ObjectType constraintObj){
  if (constraintObj.isRecordType()) {
    for (    String prop : constraintObj.getOwnPropertyNames()) {
      JSType propType=constraintObj.getPropertyType(prop);
      if (!isPropertyTypeDeclared(prop)) {
        JSType typeToInfer=propType;
        if (!hasProperty(prop)) {
          typeToInfer=getNativeType(JSTypeNative.VOID_TYPE).getLeastSupertype(propType);
        }
        defineInferredProperty(prop,typeToInfer,null);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void matchConstraint(ObjectType constraintObj){
  if (hasReferenceName()) {
    return;
  }
  if (constraintObj.isRecordType()) {
    for (    String prop : constraintObj.getOwnPropertyNames()) {
      JSType propType=constraintObj.getPropertyType(prop);
      if (!isPropertyTypeDeclared(prop)) {
        JSType typeToInfer=propType;
        if (!hasProperty(prop)) {
          typeToInfer=getNativeType(JSTypeNative.VOID_TYPE).getLeastSupertype(propType);
        }
        defineInferredProperty(prop,typeToInfer,null);
      }
    }
  }
}
Program: 18730
Project: 18730
Buggy source:
void setPrototypeBasedOn(ObjectType baseType,Node propertyNode){
  if (baseType.hasReferenceName() || isNativeObjectType() || baseType.isFunctionPrototypeType()|| !(baseType instanceof PrototypeObjectType)) {
    baseType=new PrototypeObjectType(registry,this.getReferenceName() + "String_Node_Str",baseType);
  }
  setPrototype((PrototypeObjectType)baseType,propertyNode);
}

Fixed version (ground truth):
void setPrototypeBasedOn(ObjectType baseType,Node propertyNode){
  if (baseType.hasReferenceName() || isNativeObjectType() || baseType.isFunctionPrototypeType()) {
    baseType=new PrototypeObjectType(registry,this.getReferenceName() + "String_Node_Str",baseType);
  }
  setPrototype(baseType,propertyNode);
}
Program: 18731
Project: 18731
Buggy source:
@Override public void clearCachedValues(){
  super.clearCachedValues();
  if (subTypes != null) {
    for (    FunctionType subType : subTypes) {
      subType.clearCachedValues();
    }
  }
  if (!isNativeObjectType()) {
    if (hasInstanceType()) {
      getInstanceType().clearCachedValues();
    }
    if (prototypeSlot != null) {
      ((PrototypeObjectType)prototypeSlot.getType()).clearCachedValues();
    }
  }
}

Fixed version (ground truth):
@Override public void clearCachedValues(){
  super.clearCachedValues();
  if (subTypes != null) {
    for (    FunctionType subType : subTypes) {
      subType.clearCachedValues();
    }
  }
  if (!isNativeObjectType()) {
    if (hasInstanceType()) {
      getInstanceType().clearCachedValues();
    }
    if (prototypeSlot != null) {
      ((ObjectType)prototypeSlot.getType()).clearCachedValues();
    }
  }
}
Program: 18732
Project: 18732
Buggy source:
/** 
 * Gets the   {@code prototype} property of this function type. This isequivalent to  {@code (ObjectType) getPropertyType("prototype")}.
 */
public ObjectType getPrototype(){
  if (prototypeSlot == null) {
    setPrototype(new PrototypeObjectType(registry,this.getReferenceName() + "String_Node_Str",registry.getNativeObjectType(OBJECT_TYPE),isNativeObjectType()),null);
  }
  return (ObjectType)prototypeSlot.getType();
}

Fixed version (ground truth):
/** 
 * Gets the   {@code prototype} property of this function type. This isequivalent to  {@code (ObjectType) getPropertyType("prototype")}.
 */
public ObjectType getPrototype(){
  if (prototypeSlot == null) {
    String refName=getReferenceName();
    if (refName == null) {
      setPrototype(registry.getNativeObjectType(JSTypeNative.UNKNOWN_TYPE),null);
    }
 else {
      setPrototype(new PrototypeObjectType(registry,this.getReferenceName() + "String_Node_Str",registry.getNativeObjectType(OBJECT_TYPE),isNativeObjectType()),null);
    }
  }
  return (ObjectType)prototypeSlot.getType();
}
Program: 18733
Project: 18733
Buggy source:
/** 
 * Sets the prototype.
 * @param prototype the prototype. If this value is {@code null} it willsilently be discarded.
 */
boolean setPrototype(PrototypeObjectType prototype,Node propertyNode){
  if (prototype == null) {
    return false;
  }
  if (isConstructor() && prototype == getInstanceType()) {
    return false;
  }
  PrototypeObjectType oldPrototype=prototypeSlot == null ? null : (PrototypeObjectType)prototypeSlot.getType();
  boolean replacedPrototype=oldPrototype != null;
  this.prototypeSlot=new Property("String_Node_Str",prototype,true,propertyNode == null ? source : propertyNode);
  prototype.setOwnerFunction(this);
  if (oldPrototype != null) {
    oldPrototype.setOwnerFunction(null);
  }
  if (isConstructor() || isInterface()) {
    FunctionType superClass=getSuperClassConstructor();
    if (superClass != null) {
      superClass.addSubType(this);
    }
    if (isInterface()) {
      for (      ObjectType interfaceType : getExtendedInterfaces()) {
        if (interfaceType.getConstructor() != null) {
          interfaceType.getConstructor().addSubType(this);
        }
      }
    }
  }
  if (replacedPrototype) {
    clearCachedValues();
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Sets the prototype.
 * @param prototype the prototype. If this value is {@code null} it willsilently be discarded.
 */
boolean setPrototype(ObjectType prototype,Node propertyNode){
  if (prototype == null) {
    return false;
  }
  if (isConstructor() && prototype == getInstanceType()) {
    return false;
  }
  ObjectType oldPrototype=prototypeSlot == null ? null : (ObjectType)prototypeSlot.getType();
  boolean replacedPrototype=oldPrototype != null;
  this.prototypeSlot=new Property("String_Node_Str",prototype,true,propertyNode == null ? source : propertyNode);
  prototype.setOwnerFunction(this);
  if (oldPrototype != null) {
    oldPrototype.setOwnerFunction(null);
  }
  if (isConstructor() || isInterface()) {
    FunctionType superClass=getSuperClassConstructor();
    if (superClass != null) {
      superClass.addSubType(this);
    }
    if (isInterface()) {
      for (      ObjectType interfaceType : getExtendedInterfaces()) {
        if (interfaceType.getConstructor() != null) {
          interfaceType.getConstructor().addSubType(this);
        }
      }
    }
  }
  if (replacedPrototype) {
    clearCachedValues();
  }
  return true;
}
Program: 18734
Project: 18734
Buggy source:
/** 
 * Tests that defining a property of a function's   {@code prototype} adds theproperty to it instance type.
 */
public void testFunctionPrototypeAndImplicitPrototype1(){
  FunctionType constructor=registry.createConstructorType(null,null,null,null);
  ObjectType instance=constructor.getInstanceType();
  ObjectType prototype=(ObjectType)constructor.getPropertyType("String_Node_Str");
  prototype.defineDeclaredProperty("String_Node_Str",DATE_TYPE,null);
  assertEquals(NATIVE_PROPERTIES_COUNT + 1,instance.getPropertiesCount());
}

Fixed version (ground truth):
/** 
 * Tests that defining a property of a function's   {@code prototype} adds theproperty to it instance type.
 */
public void testFunctionPrototypeAndImplicitPrototype1(){
  FunctionType constructor=registry.createConstructorType("String_Node_Str",null,null,null);
  ObjectType instance=constructor.getInstanceType();
  ObjectType prototype=(ObjectType)constructor.getPropertyType("String_Node_Str");
  prototype.defineDeclaredProperty("String_Node_Str",DATE_TYPE,null);
  assertEquals(NATIVE_PROPERTIES_COUNT + 1,instance.getPropertiesCount());
}
Program: 18735
Project: 18735
Buggy source:
@Override void endFile(){
  super.endFile();
  if (!preferLineBreakAtEndOfFile) {
    return;
  }
  if (lineLength > lineLengthThreshold / 2) {
    append("String_Node_Str");
    startNewLine();
  }
 else   if (prevCutPosition > 0) {
    for (int i=prevCutPosition; i < code.length() - 1; i++) {
      code.setCharAt(i,code.charAt(i + 1));
    }
    code.setLength(code.length() - 1);
    lineStartPosition=prevLineStartPosition;
    lineLength=code.length() - lineStartPosition;
    reportLineCut(lineIndex,prevCutPosition,false);
    lineIndex--;
    prevCutPosition=0;
    prevLineStartPosition=0;
    append("String_Node_Str");
    startNewLine();
  }
 else {
  }
}

Fixed version (ground truth):
@Override void endFile(){
  super.endFile();
  if (!preferLineBreakAtEndOfFile) {
    return;
  }
  if (lineLength > lineLengthThreshold / 2) {
    append("String_Node_Str");
    startNewLine();
  }
 else   if (prevCutPosition > 0) {
    code.setCharAt(prevCutPosition,' ');
    lineStartPosition=prevLineStartPosition;
    lineLength=code.length() - lineStartPosition;
    reportLineCut(lineIndex,prevCutPosition + 1,false);
    lineIndex--;
    prevCutPosition=0;
    prevLineStartPosition=0;
    append("String_Node_Str");
    startNewLine();
  }
 else {
  }
}
Program: 18736
Project: 18736
Buggy source:
public void testPreferLineBreakAtEndOfFile(){
  assertLineBreakAtEndOfFile("String_Node_Str","String_Node_Str","String_Node_Str");
  assertLineBreakAtEndOfFile("String_Node_Str","String_Node_Str","String_Node_Str");
  assertLineBreakAtEndOfFile("String_Node_Str","String_Node_Str","String_Node_Str");
  assertLineBreakAtEndOfFile("String_Node_Str","String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
public void testPreferLineBreakAtEndOfFile(){
  assertLineBreakAtEndOfFile("String_Node_Str","String_Node_Str","String_Node_Str");
  assertLineBreakAtEndOfFile("String_Node_Str","String_Node_Str","String_Node_Str");
  assertLineBreakAtEndOfFile("String_Node_Str","String_Node_Str","String_Node_Str");
  assertLineBreakAtEndOfFile("String_Node_Str","String_Node_Str","String_Node_Str");
  assertLineBreakAtEndOfFile("String_Node_Str","String_Node_Str","String_Node_Str");
}
Program: 18737
Project: 18737
Buggy source:
private void tryConvertToNumber(Node n){
switch (n.getType()) {
case Token.NUMBER:
    return;
case Token.AND:
case Token.OR:
case Token.COMMA:
  tryConvertToNumber(n.getLastChild());
return;
case Token.HOOK:
tryConvertToNumber(n.getChildAtIndex(1));
tryConvertToNumber(n.getLastChild());
return;
case Token.NAME:
if (!NodeUtil.isUndefined(n)) {
return;
}
break;
}
Double result=NodeUtil.getNumberValue(n);
if (result == null) {
return;
}
double value=result;
Node replacement=NodeUtil.numberNode(value,n);
n.getParent().replaceChild(n,replacement);
reportCodeChange();
}

Fixed version (ground truth):
private void tryConvertToNumber(Node n){
switch (n.getType()) {
case Token.NUMBER:
    return;
case Token.AND:
case Token.OR:
case Token.COMMA:
  tryConvertToNumber(n.getLastChild());
return;
case Token.HOOK:
tryConvertToNumber(n.getChildAtIndex(1));
tryConvertToNumber(n.getLastChild());
return;
case Token.NAME:
if (!NodeUtil.isUndefined(n)) {
return;
}
break;
}
Double result=NodeUtil.getNumberValue(n);
if (result == null) {
return;
}
double value=result;
Node replacement=NodeUtil.numberNode(value,n);
if (replacement.isEquivalentTo(n)) {
return;
}
n.getParent().replaceChild(n,replacement);
reportCodeChange();
}
Program: 18739
Project: 18739
Buggy source:
/** 
 * TypeExpression := BasicTypeExpression | '?' BasicTypeExpression | '!' BasicTypeExpression | BasicTypeExpression '?' | BasicTypeExpression '!' | '?'
 */
private Node parseTypeExpression(JsDocToken token){
  if (token == JsDocToken.QMARK) {
    token=next();
    if (token == JsDocToken.COMMA || token == JsDocToken.EQUALS || token == JsDocToken.RC || token == JsDocToken.RP || token == JsDocToken.PIPE) {
      restoreLookAhead(token);
      return newNode(Token.QMARK);
    }
    return wrapNode(Token.QMARK,parseBasicTypeExpression(token));
  }
 else   if (token == JsDocToken.BANG) {
    return wrapNode(Token.BANG,parseBasicTypeExpression(next()));
  }
 else {
    Node basicTypeExpr=parseBasicTypeExpression(token);
    if (basicTypeExpr != null) {
      if (match(JsDocToken.QMARK)) {
        next();
        return wrapNode(Token.QMARK,basicTypeExpr);
      }
 else       if (match(JsDocToken.BANG)) {
        next();
        return wrapNode(Token.BANG,basicTypeExpr);
      }
    }
    return basicTypeExpr;
  }
}

Fixed version (ground truth):
/** 
 * TypeExpression := BasicTypeExpression | '?' BasicTypeExpression | '!' BasicTypeExpression | BasicTypeExpression '?' | BasicTypeExpression '!' | '?'
 */
private Node parseTypeExpression(JsDocToken token){
  if (token == JsDocToken.QMARK) {
    token=next();
    if (token == JsDocToken.COMMA || token == JsDocToken.EQUALS || token == JsDocToken.RB || token == JsDocToken.RC || token == JsDocToken.RP || token == JsDocToken.PIPE) {
      restoreLookAhead(token);
      return newNode(Token.QMARK);
    }
    return wrapNode(Token.QMARK,parseBasicTypeExpression(token));
  }
 else   if (token == JsDocToken.BANG) {
    return wrapNode(Token.BANG,parseBasicTypeExpression(next()));
  }
 else {
    Node basicTypeExpr=parseBasicTypeExpression(token);
    if (basicTypeExpr != null) {
      if (match(JsDocToken.QMARK)) {
        next();
        return wrapNode(Token.QMARK,basicTypeExpr);
      }
 else       if (match(JsDocToken.BANG)) {
        next();
        return wrapNode(Token.BANG,basicTypeExpr);
      }
    }
    return basicTypeExpr;
  }
}
Program: 18740
Project: 18740
Buggy source:
/** 
 * Activates Common JS module processing.
 */
public void setProcessCommonJSModules(boolean processCommonJSModules){
  this.processCommonJSModules=processCommonJSModules;
}

Fixed version (ground truth):
/** 
 * Rewrites CommonJS modulee so that modules can be concatenated together, by renaming all globals to avoid conflicting with other modules.
 */
public void setProcessCommonJSModules(boolean processCommonJSModules){
  this.processCommonJSModules=processCommonJSModules;
}
Program: 18741
Project: 18741
Buggy source:
/** 
 * Get the return value of calling "bind" on this function with the specified number of arguments. If -1 is passed, then we will return a result that accepts any parameters.
 */
public FunctionType getBindReturnType(int argsToBind){
  FunctionBuilder builder=new FunctionBuilder(registry).withReturnType(getReturnType());
  if (argsToBind >= 0) {
    Node origParams=getParametersNode();
    if (origParams != null) {
      Node params=origParams.cloneTree();
      for (int i=1; i < argsToBind && params.getFirstChild() != null; i++) {
        params.removeFirstChild();
      }
      builder.withParamsNode(params);
    }
  }
  return builder.build();
}

Fixed version (ground truth):
/** 
 * Get the return value of calling "bind" on this function with the specified number of arguments. If -1 is passed, then we will return a result that accepts any parameters.
 */
public FunctionType getBindReturnType(int argsToBind){
  FunctionBuilder builder=new FunctionBuilder(registry).withReturnType(getReturnType());
  if (argsToBind >= 0) {
    Node origParams=getParametersNode();
    if (origParams != null) {
      Node params=origParams.cloneTree();
      for (int i=1; i < argsToBind && params.getFirstChild() != null; i++) {
        if (params.getFirstChild().isVarArgs()) {
          break;
        }
        params.removeFirstChild();
      }
      builder.withParamsNode(params);
    }
  }
  return builder.build();
}
Program: 18742
Project: 18742
Buggy source:
void add(String newcode){
  maybeEndStatement();
  if (newcode.length() == 0) {
    return;
  }
  char c=newcode.charAt(0);
  if ((isWordChar(c) || c == '\\') && isWordChar(getLastChar())) {
    append("String_Node_Str");
  }
  append(newcode);
}

Fixed version (ground truth):
void add(String newcode){
  maybeEndStatement();
  if (newcode.length() == 0) {
    return;
  }
  char c=newcode.charAt(0);
  if ((isWordChar(c) || c == '\\') && isWordChar(getLastChar())) {
    append("String_Node_Str");
  }
 else   if (c == '/' && getLastChar() == '/') {
    append("String_Node_Str");
  }
  append(newcode);
}