nus-yam/ex-repair huggingface dataset:
Program: 28106
Project: 28106
Buggy source:
private void validateName(Name name,boolean isDefined){
  Ref declaration=name.getDeclaration();
  Name parent=name.parent;
  boolean singleGlobalParentDecl=parent != null && parent.getDeclaration() != null && parent.localSets == 0;
  JSModuleGraph moduleGraph=compiler.getModuleGraph();
  for (  Ref ref : name.getRefs()) {
    if (!isDefined && !isTypedef(ref)) {
      reportRefToUndefinedName(name,ref);
    }
 else     if (declaration != null && ref.getModule() != declaration.getModule() && !moduleGraph.dependsOn(ref.getModule(),declaration.getModule())) {
      reportBadModuleReference(name,ref);
    }
 else     if (ref.scope.isGlobal() && singleGlobalParentDecl && parent.getDeclaration().preOrderIndex > ref.preOrderIndex) {
      compiler.report(JSError.make(ref.source.getName(),ref.node,NAME_DEFINED_LATE_WARNING,name.fullName(),parent.fullName(),parent.getDeclaration().source.getName(),String.valueOf(parent.getDeclaration().node.getLineno())));
    }
  }
}

Fixed version (ground truth):
private void validateName(Name name,boolean isDefined){
  Ref declaration=name.getDeclaration();
  Name parent=name.parent;
  boolean singleGlobalParentDecl=parent != null && parent.getDeclaration() != null && parent.localSets == 0;
  JSModuleGraph moduleGraph=compiler.getModuleGraph();
  for (  Ref ref : name.getRefs()) {
    if (!isDefined && !isTypedef(ref)) {
      reportRefToUndefinedName(name,ref);
    }
 else     if (declaration != null && ref.getModule() != declaration.getModule() && !moduleGraph.dependsOn(ref.getModule(),declaration.getModule())) {
      reportBadModuleReference(name,ref);
    }
 else     if (ref.scope.isGlobal() && singleGlobalParentDecl && parent.getDeclaration().preOrderIndex > ref.preOrderIndex) {
      compiler.report(JSError.make(ref.source.getName(),ref.node,NAME_DEFINED_LATE_WARNING,name.getFullName(),parent.getFullName(),parent.getDeclaration().source.getName(),String.valueOf(parent.getDeclaration().node.getLineno())));
    }
  }
}
Program: 28107
Project: 28107
Buggy source:
/** 
 * Reports a warning because a namespace was redefined.
 * @param nameObj A namespace that is being redefined
 * @param ref The reference that set the namespace
 */
private void warnAboutNamespaceRedefinition(Name nameObj,Ref ref){
  compiler.report(JSError.make(ref.getSourceName(),ref.node,NAMESPACE_REDEFINED_WARNING,nameObj.fullName()));
}

Fixed version (ground truth):
/** 
 * Reports a warning because a namespace was redefined.
 * @param nameObj A namespace that is being redefined
 * @param ref The reference that set the namespace
 */
private void warnAboutNamespaceRedefinition(Name nameObj,Ref ref){
  compiler.report(JSError.make(ref.getSourceName(),ref.node,NAMESPACE_REDEFINED_WARNING,nameObj.getFullName()));
}
Program: 28108
Project: 28108
Buggy source:
/** 
 * Warns about any references to "this" in the given FUNCTION. The function is getting collapsed, so the references will change.
 */
private void checkForHosedThisReferences(Node function,JSDocInfo docInfo,final Name name){
  if (docInfo == null || (!docInfo.isConstructor() && !docInfo.hasThisType())) {
    NodeTraversal.traverse(compiler,function.getLastChild(),new NodeTraversal.AbstractShallowCallback(){
      @Override public void visit(      NodeTraversal t,      Node n,      Node parent){
        if (n.getType() == Token.THIS) {
          compiler.report(JSError.make(name.getDeclaration().getSourceName(),n,UNSAFE_THIS,name.fullName()));
        }
      }
    }
);
  }
}

Fixed version (ground truth):
/** 
 * Warns about any references to "this" in the given FUNCTION. The function is getting collapsed, so the references will change.
 */
private void checkForHosedThisReferences(Node function,JSDocInfo docInfo,final Name name){
  if (docInfo == null || (!docInfo.isConstructor() && !docInfo.hasThisType())) {
    NodeTraversal.traverse(compiler,function.getLastChild(),new NodeTraversal.AbstractShallowCallback(){
      @Override public void visit(      NodeTraversal t,      Node n,      Node parent){
        if (n.getType() == Token.THIS) {
          compiler.report(JSError.make(name.getDeclaration().getSourceName(),n,UNSAFE_THIS,name.getFullName()));
        }
      }
    }
);
  }
}
Program: 28109
Project: 28109
Buggy source:
@Override public void process(Node externs,Node root){
  GlobalNamespace namespace;
  if (collapsePropertiesOnExternTypes) {
    namespace=new GlobalNamespace(compiler,externs,root);
  }
 else {
    namespace=new GlobalNamespace(compiler,root);
  }
  if (inlineAliases) {
    inlineAliases(namespace);
  }
  nameMap=namespace.getNameIndex();
  globalNames=namespace.getNameForest();
  checkNamespaces();
  for (  Name n : globalNames) {
    flattenReferencesToCollapsibleDescendantNames(n,n.getName());
  }
  for (  Name n : globalNames) {
    collapseDeclarationOfNameAndDescendants(n,n.getName());
  }
}

Fixed version (ground truth):
@Override public void process(Node externs,Node root){
  GlobalNamespace namespace;
  if (collapsePropertiesOnExternTypes) {
    namespace=new GlobalNamespace(compiler,externs,root);
  }
 else {
    namespace=new GlobalNamespace(compiler,root);
  }
  if (inlineAliases) {
    inlineAliases(namespace);
  }
  nameMap=namespace.getNameIndex();
  globalNames=namespace.getNameForest();
  checkNamespaces();
  for (  Name n : globalNames) {
    flattenReferencesToCollapsibleDescendantNames(n,n.getBaseName());
  }
  for (  Name n : globalNames) {
    collapseDeclarationOfNameAndDescendants(n,n.getBaseName());
  }
}
Program: 28110
Project: 28110
Buggy source:
/** 
 * Flattens all references to collapsible properties of a global name except their initial definitions. Recurses on subnames.
 * @param n An object representing a global name
 * @param alias The flattened name for {@code n}
 */
private void flattenReferencesToCollapsibleDescendantNames(Name n,String alias){
  if (n.props == null)   return;
  for (  Name p : n.props) {
    String propAlias=appendPropForAlias(alias,p.getName());
    if (p.canCollapse()) {
      flattenReferencesTo(p,propAlias);
    }
 else     if (p.isSimpleStubDeclaration()) {
      flattenSimpleStubDeclaration(p,propAlias);
    }
    flattenReferencesToCollapsibleDescendantNames(p,propAlias);
  }
}

Fixed version (ground truth):
/** 
 * Flattens all references to collapsible properties of a global name except their initial definitions. Recurses on subnames.
 * @param n An object representing a global name
 * @param alias The flattened name for {@code n}
 */
private void flattenReferencesToCollapsibleDescendantNames(Name n,String alias){
  if (n.props == null)   return;
  for (  Name p : n.props) {
    String propAlias=appendPropForAlias(alias,p.getBaseName());
    if (p.canCollapse()) {
      flattenReferencesTo(p,propAlias);
    }
 else     if (p.isSimpleStubDeclaration()) {
      flattenSimpleStubDeclaration(p,propAlias);
    }
    flattenReferencesToCollapsibleDescendantNames(p,propAlias);
  }
}
Program: 28113
Project: 28113
Buggy source:
/** 
 * Adds global variable "stubs" for any properties of a global name that are only set in a local scope or read but never set.
 * @param n An object representing a global name (e.g. "a", "a.b.c")
 * @param alias The flattened name of the object whose properties we areadding stubs for (e.g. "a$b$c")
 * @param parent The node to which new global variables should be addedas children
 * @param addAfter The child of after which newvariables should be added (may be null)
 * @return The number of variables added
 */
private int addStubsForUndeclaredProperties(Name n,String alias,Node parent,Node addAfter){
  Preconditions.checkState(n.canCollapseUnannotatedChildNames());
  Preconditions.checkArgument(NodeUtil.isStatementBlock(parent));
  Preconditions.checkNotNull(addAfter);
  int numStubs=0;
  if (n.props != null) {
    for (    Name p : n.props) {
      if (p.needsToBeStubbed()) {
        String propAlias=appendPropForAlias(alias,p.getName());
        Node nameNode=Node.newString(Token.NAME,propAlias);
        Node newVar=new Node(Token.VAR,nameNode).copyInformationFromForTree(addAfter);
        parent.addChildAfter(newVar,addAfter);
        addAfter=newVar;
        numStubs++;
        compiler.reportCodeChange();
        if (p.getRefs().get(0).node.getLastChild().getBooleanProp(Node.IS_CONSTANT_NAME)) {
          nameNode.putBooleanProp(Node.IS_CONSTANT_NAME,true);
        }
      }
    }
  }
  return numStubs;
}

Fixed version (ground truth):
/** 
 * Adds global variable "stubs" for any properties of a global name that are only set in a local scope or read but never set.
 * @param n An object representing a global name (e.g. "a", "a.b.c")
 * @param alias The flattened name of the object whose properties we areadding stubs for (e.g. "a$b$c")
 * @param parent The node to which new global variables should be addedas children
 * @param addAfter The child of after which newvariables should be added (may be null)
 * @return The number of variables added
 */
private int addStubsForUndeclaredProperties(Name n,String alias,Node parent,Node addAfter){
  Preconditions.checkState(n.canCollapseUnannotatedChildNames());
  Preconditions.checkArgument(NodeUtil.isStatementBlock(parent));
  Preconditions.checkNotNull(addAfter);
  int numStubs=0;
  if (n.props != null) {
    for (    Name p : n.props) {
      if (p.needsToBeStubbed()) {
        String propAlias=appendPropForAlias(alias,p.getBaseName());
        Node nameNode=Node.newString(Token.NAME,propAlias);
        Node newVar=new Node(Token.VAR,nameNode).copyInformationFromForTree(addAfter);
        parent.addChildAfter(newVar,addAfter);
        addAfter=newVar;
        numStubs++;
        compiler.reportCodeChange();
        if (p.getRefs().get(0).node.getLastChild().getBooleanProp(Node.IS_CONSTANT_NAME)) {
          nameNode.putBooleanProp(Node.IS_CONSTANT_NAME,true);
        }
      }
    }
  }
  return numStubs;
}
Program: 28114
Project: 28114
Buggy source:
/** 
 * Flattens all references to a collapsible property of a global name except its initial definition.
 * @param n A global property name (e.g. "a.b" or "a.b.c.d")
 * @param alias The flattened name (e.g. "a$b" or "a$b$c$d")
 */
private void flattenReferencesTo(Name n,String alias){
  String originalName=n.fullName();
  for (  Ref r : n.getRefs()) {
    if (r == n.getDeclaration()) {
      continue;
    }
    Node rParent=r.node.getParent();
    if (!NodeUtil.isObjectLitKey(r.node,rParent) && (r.getTwin() == null || r.isSet())) {
      flattenNameRef(alias,r.node,rParent,originalName);
    }
  }
  if (n.props != null) {
    for (    Name p : n.props) {
      flattenPrefixes(alias,p,1);
    }
  }
}

Fixed version (ground truth):
/** 
 * Flattens all references to a collapsible property of a global name except its initial definition.
 * @param n A global property name (e.g. "a.b" or "a.b.c.d")
 * @param alias The flattened name (e.g. "a$b" or "a$b$c$d")
 */
private void flattenReferencesTo(Name n,String alias){
  String originalName=n.getFullName();
  for (  Ref r : n.getRefs()) {
    if (r == n.getDeclaration()) {
      continue;
    }
    Node rParent=r.node.getParent();
    if (!NodeUtil.isObjectLitKey(r.node,rParent) && (r.getTwin() == null || r.isSet())) {
      flattenNameRef(alias,r.node,rParent,originalName);
    }
  }
  if (n.props != null) {
    for (    Name p : n.props) {
      flattenPrefixes(alias,p,1);
    }
  }
}
Program: 28115
Project: 28115
Buggy source:
/** 
 * Flattens all occurrences of a name as a prefix of subnames beginning with a particular subname.
 * @param n A global property name (e.g. "a.b.c.d")
 * @param alias A flattened prefix name (e.g. "a$b")
 * @param depth The difference in depth between the property name andthe prefix name (e.g. 2)
 */
private void flattenPrefixes(String alias,Name n,int depth){
  String originalName=n.fullName();
  Ref decl=n.getDeclaration();
  if (decl != null && decl.node != null && decl.node.getType() == Token.GETPROP) {
    flattenNameRefAtDepth(alias,decl.node,depth,originalName);
  }
  for (  Ref r : n.getRefs()) {
    if (r == decl) {
      continue;
    }
    if (r.getTwin() == null || r.isSet()) {
      flattenNameRefAtDepth(alias,r.node,depth,originalName);
    }
  }
  if (n.props != null) {
    for (    Name p : n.props) {
      flattenPrefixes(alias,p,depth + 1);
    }
  }
}

Fixed version (ground truth):
/** 
 * Flattens all occurrences of a name as a prefix of subnames beginning with a particular subname.
 * @param n A global property name (e.g. "a.b.c.d")
 * @param alias A flattened prefix name (e.g. "a$b")
 * @param depth The difference in depth between the property name andthe prefix name (e.g. 2)
 */
private void flattenPrefixes(String alias,Name n,int depth){
  String originalName=n.getFullName();
  Ref decl=n.getDeclaration();
  if (decl != null && decl.node != null && decl.node.getType() == Token.GETPROP) {
    flattenNameRefAtDepth(alias,decl.node,depth,originalName);
  }
  for (  Ref r : n.getRefs()) {
    if (r == decl) {
      continue;
    }
    if (r.getTwin() == null || r.isSet()) {
      flattenNameRefAtDepth(alias,r.node,depth,originalName);
    }
  }
  if (n.props != null) {
    for (    Name p : n.props) {
      flattenPrefixes(alias,p,depth + 1);
    }
  }
}
Program: 28117
Project: 28117
Buggy source:
@Override public void visit(NodeTraversal t,Node n,Node parent){
  if (n.getType() == Token.THIS) {
    compiler.report(JSError.make(name.getDeclaration().getSourceName(),n,UNSAFE_THIS,name.fullName()));
  }
}

Fixed version (ground truth):
@Override public void visit(NodeTraversal t,Node n,Node parent){
  if (n.getType() == Token.THIS) {
    compiler.report(JSError.make(name.getDeclaration().getSourceName(),n,UNSAFE_THIS,name.getFullName()));
  }
}
Program: 28118
Project: 28118
Buggy source:
/** 
 * Reports a warning because a namespace was aliased.
 * @param nameObj A namespace that is being aliased
 * @param ref The reference that forced the alias
 */
private void warnAboutNamespaceAliasing(Name nameObj,Ref ref){
  compiler.report(JSError.make(ref.getSourceName(),ref.node,UNSAFE_NAMESPACE_WARNING,nameObj.fullName()));
}

Fixed version (ground truth):
/** 
 * Reports a warning because a namespace was aliased.
 * @param nameObj A namespace that is being aliased
 * @param ref The reference that forced the alias
 */
private void warnAboutNamespaceAliasing(Name nameObj,Ref ref){
  compiler.report(JSError.make(ref.getSourceName(),ref.node,UNSAFE_NAMESPACE_WARNING,nameObj.getFullName()));
}
Program: 28119
Project: 28119
Buggy source:
/** 
 * Flattens a stub declaration. This is mostly a hack to support legacy users.
 */
private void flattenSimpleStubDeclaration(Name name,String alias){
  Ref ref=Iterables.getOnlyElement(name.getRefs());
  Node nameNode=NodeUtil.newName(compiler.getCodingConvention(),alias,ref.node,name.fullName());
  Node varNode=new Node(Token.VAR,nameNode).copyInformationFrom(nameNode);
  Preconditions.checkState(ref.node.getParent().getType() == Token.EXPR_RESULT);
  Node parent=ref.node.getParent();
  Node gramps=parent.getParent();
  gramps.replaceChild(parent,varNode);
  compiler.reportCodeChange();
}

Fixed version (ground truth):
/** 
 * Flattens a stub declaration. This is mostly a hack to support legacy users.
 */
private void flattenSimpleStubDeclaration(Name name,String alias){
  Ref ref=Iterables.getOnlyElement(name.getRefs());
  Node nameNode=NodeUtil.newName(compiler.getCodingConvention(),alias,ref.node,name.getFullName());
  Node varNode=new Node(Token.VAR,nameNode).copyInformationFrom(nameNode);
  Preconditions.checkState(ref.node.getParent().getType() == Token.EXPR_RESULT);
  Node parent=ref.node.getParent();
  Node gramps=parent.getParent();
  gramps.replaceChild(parent,varNode);
  compiler.reportCodeChange();
}
Program: 28120
Project: 28120
Buggy source:
/** 
 * Collapses definitions of the collapsible properties of a global name. Recurses on subnames that also represent JavaScript objects with collapsible properties.
 * @param n A node representing a global name
 * @param alias The flattened name for {@code n}
 */
private void collapseDeclarationOfNameAndDescendants(Name n,String alias){
  boolean canCollapseChildNames=n.canCollapseUnannotatedChildNames();
  if (n.canCollapse()) {
    updateObjLitOrFunctionDeclaration(n,alias,canCollapseChildNames);
  }
  if (n.props != null) {
    for (    Name p : n.props) {
      collapseDeclarationOfNameAndDescendants(p,appendPropForAlias(alias,p.getName()));
      if (!p.inExterns && canCollapseChildNames && p.getDeclaration() != null && p.canCollapse() && p.getDeclaration().node != null && p.getDeclaration().node.getParent() != null && p.getDeclaration().node.getParent().getType() == Token.ASSIGN) {
        updateSimpleDeclaration(appendPropForAlias(alias,p.getName()),p,p.getDeclaration());
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Collapses definitions of the collapsible properties of a global name. Recurses on subnames that also represent JavaScript objects with collapsible properties.
 * @param n A node representing a global name
 * @param alias The flattened name for {@code n}
 */
private void collapseDeclarationOfNameAndDescendants(Name n,String alias){
  boolean canCollapseChildNames=n.canCollapseUnannotatedChildNames();
  if (n.canCollapse()) {
    updateObjLitOrFunctionDeclaration(n,alias,canCollapseChildNames);
  }
  if (n.props != null) {
    for (    Name p : n.props) {
      collapseDeclarationOfNameAndDescendants(p,appendPropForAlias(alias,p.getBaseName()));
      if (!p.inExterns && canCollapseChildNames && p.getDeclaration() != null && p.canCollapse() && p.getDeclaration().node != null && p.getDeclaration().node.getParent() != null && p.getDeclaration().node.getParent().getType() == Token.ASSIGN) {
        updateSimpleDeclaration(appendPropForAlias(alias,p.getBaseName()),p,p.getDeclaration());
      }
    }
  }
}
Program: 28121
Project: 28121
Buggy source:
@Override public String getName(){
  return name;
}

Fixed version (ground truth):
@Override public String getName(){
  return getFullName();
}
Program: 28122
Project: 28122
Buggy source:
Name(String name,Name parent,boolean inExterns){
  this.name=name;
  this.parent=parent;
  this.type=Type.OTHER;
  this.inExterns=inExterns;
}

Fixed version (ground truth):
Name(String name,Name parent,boolean inExterns){
  this.baseName=name;
  this.parent=parent;
  this.type=Type.OTHER;
  this.inExterns=inExterns;
}
Program: 28123
Project: 28123
Buggy source:
@Override public String toString(){
  return fullName() + "String_Node_Str" + type+ "String_Node_Str"+ globalSets+ "String_Node_Str"+ localSets+ "String_Node_Str"+ totalGets+ "String_Node_Str"+ aliasingGets+ "String_Node_Str"+ callGets;
}

Fixed version (ground truth):
@Override public String toString(){
  return getFullName() + "String_Node_Str" + type+ "String_Node_Str"+ globalSets+ "String_Node_Str"+ localSets+ "String_Node_Str"+ totalGets+ "String_Node_Str"+ aliasingGets+ "String_Node_Str"+ callGets;
}
Program: 28125
Project: 28125
Buggy source:
/** 
 * A   {@link UnionType} contains a given type (alternate) iff the membervector contains it.
 * @param alternate The alternate which might be in this union.
 * @return {@code true} if the alternate is in the union
 */
public boolean contains(JSType type){
  for (  JSType alt : alternates) {
    if (alt.isEquivalentTo(type)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * A   {@link UnionType} contains a given type (alternate) iff the membervector contains it.
 * @param type The alternate which might be in this union.
 * @return {@code true} if the alternate is in the union
 */
public boolean contains(JSType type){
  for (  JSType alt : alternates) {
    if (alt.isEquivalentTo(type)) {
      return true;
    }
  }
  return false;
}
Program: 28126
Project: 28126
Buggy source:
/** 
 * @param item The item to inspect
 * @param propType The property to look for
 * @return The replacement list if the property was removed, or'item' otherwise.
 */
private PropListItem removeProp(PropListItem item,int propType){
  if (item == null) {
    return null;
  }
 else   if (item.getType() == propType) {
    return item.getNext();
  }
 else {
    PropListItem result=removeProp(item.getNext(),propType);
    if (result != item.getNext()) {
      item.setNext(result);
      return item;
    }
 else {
      return item;
    }
  }
}

Fixed version (ground truth):
/** 
 * @param item The item to inspect
 * @param propType The property to look for
 * @return The replacement list if the property was removed, or'item' otherwise.
 */
private PropListItem removeProp(PropListItem item,int propType){
  if (item == null) {
    return null;
  }
 else   if (item.getType() == propType) {
    return item.getNext();
  }
 else {
    PropListItem result=removeProp(item.getNext(),propType);
    if (result != item.getNext()) {
      return item.chain(result);
    }
 else {
      return item;
    }
  }
}
Program: 28127
Project: 28127
Buggy source:
/** 
 * BasicTypeExpression := '*' | 'null' | 'undefined' | TypeName | FunctionType | UnionType | RecordType | ArrayType
 */
private Node parseBasicTypeExpression(JsDocToken token){
  if (token == JsDocToken.STAR) {
    return newNode(Token.STAR);
  }
 else   if (token == JsDocToken.LB) {
    skipEOLs();
    return parseArrayType(next());
  }
 else   if (token == JsDocToken.LC) {
    skipEOLs();
    return parseRecordType(next());
  }
 else   if (token == JsDocToken.LP) {
    skipEOLs();
    return parseUnionType(next());
  }
 else   if (token == JsDocToken.STRING) {
    String string=stream.getString();
    if ("String_Node_Str".equals(string)) {
      skipEOLs();
      return parseFunctionType(next());
    }
 else     if ("String_Node_Str".equals(string) || "String_Node_Str".equals(string)) {
      return newStringNode(string);
    }
 else {
      return parseTypeName(token);
    }
  }
  return reportGenericTypeSyntaxWarning();
}

Fixed version (ground truth):
/** 
 * BasicTypeExpression := '*' | 'null' | 'undefined' | TypeName | FunctionType | UnionType | RecordType | ArrayType
 */
private Node parseBasicTypeExpression(JsDocToken token){
  if (token == JsDocToken.STAR) {
    return newNode(Token.STAR);
  }
 else   if (token == JsDocToken.LB) {
    skipEOLs();
    return parseArrayType(next());
  }
 else   if (token == JsDocToken.LC) {
    skipEOLs();
    return parseRecordType(next());
  }
 else   if (token == JsDocToken.LP) {
    skipEOLs();
    return parseUnionType(next());
  }
 else   if (token == JsDocToken.STRING) {
    String string=stream.getString();
    if ("String_Node_Str".equals(string)) {
      skipEOLs();
      return parseFunctionType(next());
    }
 else     if ("String_Node_Str".equals(string) || "String_Node_Str".equals(string)) {
      return newStringNode(string);
    }
 else {
      return parseTypeName(token);
    }
  }
  restoreLookAhead(token);
  return reportGenericTypeSyntaxWarning();
}
Program: 28132
Project: 28132
Buggy source:
@Override public void hotSwapScript(Node scriptRoot,Scope globalScope){
  NodeTraversal.traverse(compiler,scriptRoot,this);
}

Fixed version (ground truth):
@Override public void hotSwapScript(Node scriptRoot){
  NodeTraversal.traverse(compiler,scriptRoot,this);
}
Program: 28133
Project: 28133
Buggy source:
/** 
 * Returns the root node of the AST, which includes both externs and source.
 */
public Node getRoot(){
  return externAndJsRoot;
}

Fixed version (ground truth):
@Override public Node getRoot(){
  return externAndJsRoot;
}
Program: 28134
Project: 28134
Buggy source:
@Override public void hotSwapScript(Node scriptRoot,Scope globalScope){
  makeTypeCheck(compiler).check(scriptRoot,false);
}

Fixed version (ground truth):
@Override public void hotSwapScript(Node scriptRoot){
  regenerateGlobalTypedScope(compiler,compiler.getRoot());
}
Program: 28135
Project: 28135
Buggy source:
/** 
 * Process the JS with root node root. This is supposed to be significantly faster compared to corresponding full-compiler passes.
 * @param scriptRoot Root node corresponding to the file that is modified,should be of type  {@code Token.SCRIPT}.
 * @param globalScope The global scope which is not necessarily types.
 */
void hotSwapScript(Node scriptRoot,Scope globalScope);

Fixed version (ground truth):
/** 
 * Process the JS with root node root. This is supposed to be significantly faster compared to corresponding full-compiler passes.
 * @param scriptRoot Root node corresponding to the file that is modified,should be of type  {@code Token.SCRIPT}.
 */
void hotSwapScript(Node scriptRoot);
Program: 28136
Project: 28136
Buggy source:
@Override public void hotSwapScript(Node scriptRoot,Scope globalScope){
  this.compiler.process(this);
}

Fixed version (ground truth):
@Override public void hotSwapScript(Node scriptRoot){
  this.compiler.process(this);
}
Program: 28137
Project: 28137
Buggy source:
@Override public void hotSwapScript(Node scriptRoot,Scope globalScope){
  Preconditions.checkState(scriptRoot.getType() == Token.SCRIPT);
  NodeTraversal t=new NodeTraversal(compiler,this);
  t.traverseWithScope(scriptRoot,globalScope);
}

Fixed version (ground truth):
@Override public void hotSwapScript(Node scriptRoot){
  Preconditions.checkState(scriptRoot.getType() == Token.SCRIPT);
  NodeTraversal t=new NodeTraversal(compiler,this);
  Scope scope=new SyntacticScopeCreator(compiler).createScope(compiler.getRoot(),null);
  t.traverseWithScope(scriptRoot,scope);
}
Program: 28138
Project: 28138
Buggy source:
@Override public boolean acceptEcmaScript5(){
  return options.getLanguageIn() == LanguageMode.ECMASCRIPT5;
}

Fixed version (ground truth):
@Override public boolean acceptEcmaScript5(){
switch (options.getLanguageIn()) {
case ECMASCRIPT5:
case ECMASCRIPT5_STRICT:
    return true;
}
return false;
}
Program: 28139
Project: 28139
Buggy source:
/** 
 * Creates a RecordType from the nodes representing said record type.
 * @param n The node with type info.
 * @param sourceName The source file name.
 * @param scope A scope for doing type name lookups.
 */
private JSType createRecordTypeFromNodes(Node n,String sourceName,StaticScope<JSType> scope){
  RecordTypeBuilder builder=new RecordTypeBuilder(this);
  for (Node fieldTypeNode=n.getFirstChild(); fieldTypeNode != null; fieldTypeNode=fieldTypeNode.getNext()) {
    Node fieldNameNode=fieldTypeNode;
    boolean hasType=false;
    if (fieldTypeNode.getType() == Token.COLON) {
      fieldNameNode=fieldTypeNode.getFirstChild();
      hasType=true;
    }
    String fieldName=fieldNameNode.getString();
    if (fieldName.startsWith("String_Node_Str") || fieldName.startsWith("String_Node_Str")) {
      fieldName=fieldName.substring(1,fieldName.length() - 1);
    }
    JSType fieldType=null;
    if (hasType) {
      fieldType=createFromTypeNodesInternal(fieldTypeNode.getLastChild(),sourceName,scope);
    }
 else {
      fieldType=getNativeType(JSTypeNative.UNKNOWN_TYPE);
    }
    if (builder.addProperty(fieldName,fieldType,fieldNameNode) == null) {
      reporter.warning("String_Node_Str" + fieldName,sourceName,n.getLineno(),"String_Node_Str",n.getCharno());
    }
  }
  return builder.build();
}

Fixed version (ground truth):
/** 
 * Creates a RecordType from the nodes representing said record type.
 * @param n The node with type info.
 * @param sourceName The source file name.
 * @param scope A scope for doing type name lookups.
 */
private JSType createRecordTypeFromNodes(Node n,String sourceName,StaticScope<JSType> scope){
  RecordTypeBuilder builder=new RecordTypeBuilder(this);
  for (Node fieldTypeNode=n.getFirstChild(); fieldTypeNode != null; fieldTypeNode=fieldTypeNode.getNext()) {
    Node fieldNameNode=fieldTypeNode;
    boolean hasType=false;
    if (fieldTypeNode.getType() == Token.COLON) {
      fieldNameNode=fieldTypeNode.getFirstChild();
      hasType=true;
    }
    String fieldName=fieldNameNode.getString();
    if (fieldName.startsWith("String_Node_Str") || fieldName.startsWith("String_Node_Str")) {
      fieldName=fieldName.substring(1,fieldName.length() - 1);
    }
    JSType fieldType=null;
    if (hasType) {
      fieldType=createFromTypeNodesInternal(fieldTypeNode.getLastChild(),sourceName,scope);
    }
 else {
      fieldType=getNativeType(JSTypeNative.UNKNOWN_TYPE);
    }
    if (builder.addProperty(fieldName,fieldType,fieldNameNode) == null) {
      reporter.warning("String_Node_Str" + fieldName,sourceName,n.getLineno(),"String_Node_Str",fieldNameNode.getCharno());
    }
  }
  return builder.build();
}
Program: 28140
Project: 28140
Buggy source:
/** 
 * Creates a RecordType from the nodes representing said record type.
 * @param n The node with type info.
 * @param sourceName The source file name.
 * @param scope A scope for doing type name lookups.
 */
private JSType createRecordTypeFromNodes(Node n,String sourceName,StaticScope<JSType> scope){
  RecordTypeBuilder builder=new RecordTypeBuilder(this);
  for (Node fieldTypeNode=n.getFirstChild(); fieldTypeNode != null; fieldTypeNode=fieldTypeNode.getNext()) {
    Node fieldNameNode=fieldTypeNode;
    boolean hasType=false;
    if (fieldTypeNode.getType() == Token.COLON) {
      fieldNameNode=fieldTypeNode.getFirstChild();
      hasType=true;
    }
    String fieldName=fieldNameNode.getString();
    if (fieldName.startsWith("String_Node_Str") || fieldName.startsWith("String_Node_Str")) {
      fieldName=fieldName.substring(1,fieldName.length() - 1);
    }
    JSType fieldType=null;
    if (hasType) {
      fieldType=createFromTypeNodesInternal(fieldTypeNode.getLastChild(),sourceName,scope);
    }
 else {
      fieldType=getNativeType(JSTypeNative.UNKNOWN_TYPE);
    }
    builder.addProperty(fieldName,fieldType,fieldNameNode);
  }
  return builder.build();
}

Fixed version (ground truth):
/** 
 * Creates a RecordType from the nodes representing said record type.
 * @param n The node with type info.
 * @param sourceName The source file name.
 * @param scope A scope for doing type name lookups.
 */
private JSType createRecordTypeFromNodes(Node n,String sourceName,StaticScope<JSType> scope){
  RecordTypeBuilder builder=new RecordTypeBuilder(this);
  for (Node fieldTypeNode=n.getFirstChild(); fieldTypeNode != null; fieldTypeNode=fieldTypeNode.getNext()) {
    Node fieldNameNode=fieldTypeNode;
    boolean hasType=false;
    if (fieldTypeNode.getType() == Token.COLON) {
      fieldNameNode=fieldTypeNode.getFirstChild();
      hasType=true;
    }
    String fieldName=fieldNameNode.getString();
    if (fieldName.startsWith("String_Node_Str") || fieldName.startsWith("String_Node_Str")) {
      fieldName=fieldName.substring(1,fieldName.length() - 1);
    }
    JSType fieldType=null;
    if (hasType) {
      fieldType=createFromTypeNodesInternal(fieldTypeNode.getLastChild(),sourceName,scope);
    }
 else {
      fieldType=getNativeType(JSTypeNative.UNKNOWN_TYPE);
    }
    if (builder.addProperty(fieldName,fieldType,fieldNameNode) == null) {
      reporter.warning("String_Node_Str" + fieldName,sourceName,n.getLineno(),"String_Node_Str",n.getCharno());
    }
  }
  return builder.build();
}
Program: 28141
Project: 28141
Buggy source:
/** 
 * Creates a record.
 * @return The record type.
 */
public JSType build(){
  if (isEmpty) {
    return registry.getNativeObjectType(JSTypeNative.OBJECT_TYPE);
  }
  return registry.createRecordType(properties.build());
}

Fixed version (ground truth):
/** 
 * Creates a record.
 * @return The record type.
 */
public JSType build(){
  if (isEmpty) {
    return registry.getNativeObjectType(JSTypeNative.OBJECT_TYPE);
  }
  return registry.createRecordType(Collections.unmodifiableMap(properties));
}
Program: 28142
Project: 28142
Buggy source:
/** 
 * Adds a property with the given name and type to the record type.
 * @param name the name of the new property
 * @param type the JSType of the new property
 * @param propertyNode the node that holds this property definition
 * @return The builder itself for chaining purposes.
 */
public RecordTypeBuilder addProperty(String name,JSType type,Node propertyNode){
  isEmpty=false;
  properties.put(name,new RecordProperty(type,propertyNode));
  return this;
}

Fixed version (ground truth):
/** 
 * Adds a property with the given name and type to the record type.
 * @param name the name of the new property
 * @param type the JSType of the new property
 * @param propertyNode the node that holds this property definition
 * @return The builder itself for chaining purposes, or null if there'sa duplicate.
 */
public RecordTypeBuilder addProperty(String name,JSType type,Node propertyNode){
  isEmpty=false;
  if (properties.containsKey(name)) {
    return null;
  }
  properties.put(name,new RecordProperty(type,propertyNode));
  return this;
}
Program: 28143
Project: 28143
Buggy source:
/** 
 * Updates the first initialization (a.k.a "declaration") of a global name. This involves flattening the global name (if it's not just a global variable name already), collapsing object literal keys into global variables, declaring stub global variables for properties added later in a local scope, and eliminating the global name entirely (if possible).
 * @param n An object representing a global name (e.g. "a", "a.b.c")
 * @param alias The flattened name for {@code n} (e.g. "a", "a$b$c")
 */
private void updateObjLitOrFunctionDeclaration(Name n,String alias){
switch (n.declaration.node.getParent().getType()) {
case Token.ASSIGN:
    updateObjLitOrFunctionDeclarationAtAssignNode(n,alias);
  break;
case Token.VAR:
updateObjLitOrFunctionDeclarationAtVarNode(n);
break;
case Token.FUNCTION:
updateFunctionDeclarationAtFunctionNode(n);
break;
}
}

Fixed version (ground truth):
/** 
 * Updates the first initialization (a.k.a "declaration") of a global name. This involves flattening the global name (if it's not just a global variable name already), collapsing object literal keys into global variables, declaring stub global variables for properties added later in a local scope. It may seem odd that this function also takes care of declaring stubs for direct children. The ultimate goal of this function is to eliminate the global name entirely (when possible), so that "middlemen" namespaces disappear, and to do that we need to make sure that all the direct children will be collapsed as well.
 * @param n An object representing a global name (e.g. "a", "a.b.c")
 * @param alias The flattened name for {@code n} (e.g. "a", "a$b$c")
 * @param canCollapseChildNames Whether it's possible to collapse children ofthis name. (This is mostly passed for convenience; it's equivalent to n.canCollapseChildNames()).
 */
private void updateObjLitOrFunctionDeclaration(Name n,String alias,boolean canCollapseChildNames){
  if (n.declaration == null) {
    return;
  }
  if (n.declaration.getTwin() != null) {
    return;
  }
switch (n.declaration.node.getParent().getType()) {
case Token.ASSIGN:
    updateObjLitOrFunctionDeclarationAtAssignNode(n,alias,canCollapseChildNames);
  break;
case Token.VAR:
updateObjLitOrFunctionDeclarationAtVarNode(n,canCollapseChildNames);
break;
case Token.FUNCTION:
updateFunctionDeclarationAtFunctionNode(n,canCollapseChildNames);
break;
}
}
Program: 28144
Project: 28144
Buggy source:
/** 
 * Adds global variable "stubs" for any properties of a global name that are only set in a local scope or read but never set.
 * @param n An object representing a global name (e.g. "a", "a.b.c")
 * @param alias The flattened name of the object whose properties we areadding stubs for (e.g. "a$b$c")
 * @param parent The node to which new global variables should be addedas children
 * @param addAfter The child of after which newvariables should be added (may be null)
 * @return The number of variables added
 */
private int addStubsForUndeclaredProperties(Name n,String alias,Node parent,Node addAfter){
  Preconditions.checkArgument(NodeUtil.isStatementBlock(parent));
  Preconditions.checkNotNull(addAfter);
  int numStubs=0;
  if (n.props != null) {
    for (    Name p : n.props) {
      if (p.needsToBeStubbed()) {
        String propAlias=appendPropForAlias(alias,p.name);
        Node nameNode=Node.newString(Token.NAME,propAlias);
        Node newVar=new Node(Token.VAR,nameNode).copyInformationFromForTree(addAfter);
        parent.addChildAfter(newVar,addAfter);
        addAfter=newVar;
        numStubs++;
        compiler.reportCodeChange();
        if (p.refs.get(0).node.getLastChild().getBooleanProp(Node.IS_CONSTANT_NAME)) {
          nameNode.putBooleanProp(Node.IS_CONSTANT_NAME,true);
        }
      }
    }
  }
  return numStubs;
}

Fixed version (ground truth):
/** 
 * Adds global variable "stubs" for any properties of a global name that are only set in a local scope or read but never set.
 * @param n An object representing a global name (e.g. "a", "a.b.c")
 * @param alias The flattened name of the object whose properties we areadding stubs for (e.g. "a$b$c")
 * @param parent The node to which new global variables should be addedas children
 * @param addAfter The child of after which newvariables should be added (may be null)
 * @return The number of variables added
 */
private int addStubsForUndeclaredProperties(Name n,String alias,Node parent,Node addAfter){
  Preconditions.checkState(n.canCollapseUnannotatedChildNames());
  Preconditions.checkArgument(NodeUtil.isStatementBlock(parent));
  Preconditions.checkNotNull(addAfter);
  int numStubs=0;
  if (n.props != null) {
    for (    Name p : n.props) {
      if (p.needsToBeStubbed()) {
        String propAlias=appendPropForAlias(alias,p.name);
        Node nameNode=Node.newString(Token.NAME,propAlias);
        Node newVar=new Node(Token.VAR,nameNode).copyInformationFromForTree(addAfter);
        parent.addChildAfter(newVar,addAfter);
        addAfter=newVar;
        numStubs++;
        compiler.reportCodeChange();
        if (p.refs.get(0).node.getLastChild().getBooleanProp(Node.IS_CONSTANT_NAME)) {
          nameNode.putBooleanProp(Node.IS_CONSTANT_NAME,true);
        }
      }
    }
  }
  return numStubs;
}
Program: 28145
Project: 28145
Buggy source:
/** 
 * Updates the first initialization (a.k.a "declaration") of a global name that occurs at a VAR node. See comment for  {@link #updateObjLitOrFunctionDeclaration}.
 * @param n An object representing a global name (e.g. "a")
 */
private void updateObjLitOrFunctionDeclarationAtVarNode(Name n){
  Ref ref=n.declaration;
  String name=ref.node.getString();
  Node rvalue=ref.node.getFirstChild();
  Node varNode=ref.node.getParent();
  Node gramps=varNode.getParent();
  boolean isObjLit=rvalue.getType() == Token.OBJECTLIT;
  int numChanges=0;
  if (isObjLit) {
    numChanges+=declareVarsForObjLitValues(n,name,rvalue,varNode,gramps.getChildBefore(varNode),gramps);
  }
  numChanges+=addStubsForUndeclaredProperties(n,name,gramps,varNode);
  if (isObjLit && n.canEliminate()) {
    varNode.removeChild(ref.node);
    if (!varNode.hasChildren()) {
      gramps.removeChild(varNode);
    }
    numChanges++;
    ref.node=null;
  }
  if (numChanges > 0) {
    compiler.reportCodeChange();
  }
}

Fixed version (ground truth):
/** 
 * Updates the first initialization (a.k.a "declaration") of a global name that occurs at a VAR node. See comment for  {@link #updateObjLitOrFunctionDeclaration}.
 * @param n An object representing a global name (e.g. "a")
 */
private void updateObjLitOrFunctionDeclarationAtVarNode(Name n,boolean canCollapseChildNames){
  if (!canCollapseChildNames) {
    return;
  }
  Ref ref=n.declaration;
  String name=ref.node.getString();
  Node rvalue=ref.node.getFirstChild();
  Node varNode=ref.node.getParent();
  Node gramps=varNode.getParent();
  boolean isObjLit=rvalue.getType() == Token.OBJECTLIT;
  int numChanges=0;
  if (isObjLit) {
    numChanges+=declareVarsForObjLitValues(n,name,rvalue,varNode,gramps.getChildBefore(varNode),gramps);
  }
  numChanges+=addStubsForUndeclaredProperties(n,name,gramps,varNode);
  if (isObjLit && n.canEliminate()) {
    varNode.removeChild(ref.node);
    if (!varNode.hasChildren()) {
      gramps.removeChild(varNode);
    }
    numChanges++;
    ref.node=null;
  }
  if (numChanges > 0) {
    compiler.reportCodeChange();
  }
}
Program: 28146
Project: 28146
Buggy source:
/** 
 * Updates the first initialization (a.k.a "declaration") of a global name that occurs at a FUNCTION node. See comment for  {@link #updateObjLitOrFunctionDeclaration}.
 * @param n An object representing a global name (e.g. "a")
 */
private void updateFunctionDeclarationAtFunctionNode(Name n){
  Ref ref=n.declaration;
  String fnName=ref.node.getString();
  addStubsForUndeclaredProperties(n,fnName,ref.node.getAncestor(2),ref.node.getParent());
}

Fixed version (ground truth):
/** 
 * Updates the first initialization (a.k.a "declaration") of a global name that occurs at a FUNCTION node. See comment for  {@link #updateObjLitOrFunctionDeclaration}.
 * @param n An object representing a global name (e.g. "a")
 */
private void updateFunctionDeclarationAtFunctionNode(Name n,boolean canCollapseChildNames){
  if (!canCollapseChildNames) {
    return;
  }
  Ref ref=n.declaration;
  String fnName=ref.node.getString();
  addStubsForUndeclaredProperties(n,fnName,ref.node.getAncestor(2),ref.node.getParent());
}
Program: 28148
Project: 28148
Buggy source:
/** 
 * Collapses definitions of the collapsible properties of a global name. Recurses on subnames that also represent JavaScript objects with collapsible properties.
 * @param n A node representing a global name
 * @param alias The flattened name for {@code n}
 */
private void collapseDeclarationOfNameAndDescendants(Name n,String alias){
  boolean canCollapseChildNames=n.canCollapseUnannotatedChildNames();
  if (n.canCollapse() && canCollapseChildNames) {
    updateObjLitOrFunctionDeclaration(n,alias);
  }
  if (n.props != null) {
    for (    Name p : n.props) {
      collapseDeclarationOfNameAndDescendants(p,appendPropForAlias(alias,p.name));
      if (!p.inExterns && canCollapseChildNames && p.declaration != null && p.declaration.node != null && p.declaration.node.getParent() != null && p.declaration.node.getParent().getType() == Token.ASSIGN) {
        updateSimpleDeclaration(appendPropForAlias(alias,p.name),p,p.declaration);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Collapses definitions of the collapsible properties of a global name. Recurses on subnames that also represent JavaScript objects with collapsible properties.
 * @param n A node representing a global name
 * @param alias The flattened name for {@code n}
 */
private void collapseDeclarationOfNameAndDescendants(Name n,String alias){
  boolean canCollapseChildNames=n.canCollapseUnannotatedChildNames();
  if (n.canCollapse()) {
    updateObjLitOrFunctionDeclaration(n,alias,canCollapseChildNames);
  }
  if (n.props != null) {
    for (    Name p : n.props) {
      collapseDeclarationOfNameAndDescendants(p,appendPropForAlias(alias,p.name));
      if (!p.inExterns && canCollapseChildNames && p.declaration != null && p.declaration.node != null && p.declaration.node.getParent() != null && p.declaration.node.getParent().getType() == Token.ASSIGN) {
        updateSimpleDeclaration(appendPropForAlias(alias,p.name),p,p.declaration);
      }
    }
  }
}
Program: 28149
Project: 28149
Buggy source:
void addGuard(WarningsGuard guard){
  if (guard instanceof ComposeWarningsGuard) {
    addGuards(Lists.reverse(((ComposeWarningsGuard)guard).guards));
  }
 else {
    int index=Collections.binarySearch(this.guards,guard,guardComparator);
    if (index < 0) {
      index=-index - 1;
    }
    this.guards.add(index,guard);
  }
}

Fixed version (ground truth):
void addGuard(WarningsGuard guard){
  if (guard instanceof ComposeWarningsGuard) {
    addGuards(((ComposeWarningsGuard)guard).guards.descendingSet());
  }
 else {
    numberOfAdds++;
    orderOfAddition.put(guard,numberOfAdds);
    guards.remove(guard);
    guards.add(guard);
  }
}
Program: 28150
Project: 28150
Buggy source:
@Override public int compare(WarningsGuard a,WarningsGuard b){
  return a.getPriority() - b.getPriority();
}

Fixed version (ground truth):
@Override public int compare(WarningsGuard a,WarningsGuard b){
  int priorityDiff=a.getPriority() - b.getPriority();
  if (priorityDiff != 0) {
    return priorityDiff;
  }
  return orderOfAddition.get(b).intValue() - orderOfAddition.get(a).intValue();
}
Program: 28151
Project: 28151
Buggy source:
List<WarningsGuard> getGuards(){
  return Collections.unmodifiableList(guards);
}

Fixed version (ground truth):
List<WarningsGuard> getGuards(){
  return Collections.unmodifiableList(Lists.newArrayList(guards));
}
Program: 28152
Project: 28152
Buggy source:
private CompilerOptions createCompilerOptions(){
  CompilerOptions options=new CompilerOptions();
  this.compilationLevel.setOptionsForCompilationLevel(options);
  if (this.debugOptions) {
    this.compilationLevel.setDebugOptionsForCompilationLevel(options);
  }
  options.prettyPrint=this.prettyPrint;
  options.printInputDelimiter=this.printInputDelimiter;
  this.warningLevel.setOptionsForWarningLevel(options);
  options.setManageClosureDependencies(manageDependencies);
  return options;
}

Fixed version (ground truth):
private CompilerOptions createCompilerOptions(){
  CompilerOptions options=new CompilerOptions();
  this.compilationLevel.setOptionsForCompilationLevel(options);
  if (this.debugOptions) {
    this.compilationLevel.setDebugOptionsForCompilationLevel(options);
  }
  options.prettyPrint=this.prettyPrint;
  options.printInputDelimiter=this.printInputDelimiter;
  options.generateExports=this.generateExports;
  this.warningLevel.setOptionsForWarningLevel(options);
  options.setManageClosureDependencies(manageDependencies);
  return options;
}
Program: 28153
Project: 28153
Buggy source:
public CompileTask(){
  this.warningLevel=WarningLevel.DEFAULT;
  this.debugOptions=false;
  this.compilationLevel=CompilationLevel.SIMPLE_OPTIMIZATIONS;
  this.customExternsOnly=false;
  this.manageDependencies=false;
  this.prettyPrint=false;
  this.printInputDelimiter=false;
  this.externFileLists=Lists.newLinkedList();
  this.sourceFileLists=Lists.newLinkedList();
}

Fixed version (ground truth):
public CompileTask(){
  this.warningLevel=WarningLevel.DEFAULT;
  this.debugOptions=false;
  this.compilationLevel=CompilationLevel.SIMPLE_OPTIMIZATIONS;
  this.customExternsOnly=false;
  this.manageDependencies=false;
  this.prettyPrint=false;
  this.printInputDelimiter=false;
  this.generateExports=false;
  this.externFileLists=Lists.newLinkedList();
  this.sourceFileLists=Lists.newLinkedList();
}
Program: 28156
Project: 28156
Buggy source:
CheckAccessControls(AbstractCompiler compiler){
  this.compiler=compiler;
  this.validator=compiler.getTypeValidator();
}

Fixed version (ground truth):
CheckAccessControls(AbstractCompiler compiler){
  this.compiler=compiler;
  this.validator=compiler.getTypeValidator();
  this.initializedConstantProperties=HashMultimap.create();
}
Program: 28157
Project: 28157
Buggy source:
public void visit(NodeTraversal t,Node n,Node parent){
switch (n.getType()) {
case Token.NAME:
    checkNameDeprecation(t,n,parent);
  checkNameVisibility(t,n,parent);
break;
case Token.GETPROP:
checkPropertyDeprecation(t,n,parent);
checkPropertyVisibility(t,n,parent);
break;
case Token.NEW:
checkConstructorDeprecation(t,n,parent);
break;
}
}

Fixed version (ground truth):
public void visit(NodeTraversal t,Node n,Node parent){
switch (n.getType()) {
case Token.NAME:
    checkNameDeprecation(t,n,parent);
  checkNameVisibility(t,n,parent);
break;
case Token.GETPROP:
checkPropertyDeprecation(t,n,parent);
checkPropertyVisibility(t,n,parent);
checkConstantProperty(t,n);
break;
case Token.NEW:
checkConstructorDeprecation(t,n,parent);
break;
}
}
Program: 28158
Project: 28158
Buggy source:
@Override protected CompilerOptions getOptions(){
  CompilerOptions options=super.getOptions();
  options.setWarningLevel(DiagnosticGroups.ACCESS_CONTROLS,CheckLevel.ERROR);
  return options;
}

Fixed version (ground truth):
@Override protected CompilerOptions getOptions(){
  CompilerOptions options=super.getOptions();
  options.setWarningLevel(DiagnosticGroups.ACCESS_CONTROLS,CheckLevel.ERROR);
  options.setWarningLevel(DiagnosticGroups.CONSTANT_PROPERTY,CheckLevel.ERROR);
  return options;
}
Program: 28159
Project: 28159
Buggy source:
public void testWarningForSuperClassWithDeprecatedSubclassMethod(){
  testSame("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}

Fixed version (ground truth):
public void testWarningForSuperClassWithDeprecatedSubclassMethod(){
  testSame("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}