nus-yam/ex-repair huggingface dataset:
Program: 18637
Project: 18637
Buggy source:
/** 
 * Check whether there's any property conflict for for a particular super interface
 * @param t The node traversal object that supplies context
 * @param n The node being visited
 * @param functionName The function name being checked
 * @param properties The property names in the super interfaces that havebeen visited
 * @param currentProperties The property names in the super interfacethat have been visited
 * @param interfaceType The super interface that is being visited
 */
private void checkInterfaceConflictProperties(NodeTraversal t,Node n,String functionName,HashMap<String,ObjectType> properties,HashMap<String,ObjectType> currentProperties,ObjectType interfaceType){
  Set<String> currentPropertyNames=interfaceType.getImplicitPrototype().getOwnPropertyNames();
  for (  String name : currentPropertyNames) {
    ObjectType oType=properties.get(name);
    if (oType != null) {
      if (!interfaceType.getPropertyType(name).isEquivalentTo(oType.getPropertyType(name))) {
        compiler.report(t.makeError(n,INCOMPATIBLE_EXTENDED_PROPERTY_TYPE,functionName,name,oType.toString(),interfaceType.toString()));
      }
    }
    currentProperties.put(name,interfaceType);
  }
  for (  ObjectType iType : interfaceType.getCtorExtendedInterfaces()) {
    checkInterfaceConflictProperties(t,n,functionName,properties,currentProperties,iType);
  }
}

Fixed version (ground truth):
/** 
 * Check whether there's any property conflict for for a particular super interface
 * @param t The node traversal object that supplies context
 * @param n The node being visited
 * @param functionName The function name being checked
 * @param properties The property names in the super interfaces that havebeen visited
 * @param currentProperties The property names in the super interfacethat have been visited
 * @param interfaceType The super interface that is being visited
 */
private void checkInterfaceConflictProperties(NodeTraversal t,Node n,String functionName,HashMap<String,ObjectType> properties,HashMap<String,ObjectType> currentProperties,ObjectType interfaceType){
  ObjectType implicitProto=interfaceType.getImplicitPrototype();
  Set<String> currentPropertyNames;
  if (implicitProto == null) {
    currentPropertyNames=ImmutableSet.of();
  }
 else {
    currentPropertyNames=implicitProto.getOwnPropertyNames();
  }
  for (  String name : currentPropertyNames) {
    ObjectType oType=properties.get(name);
    if (oType != null) {
      if (!interfaceType.getPropertyType(name).isEquivalentTo(oType.getPropertyType(name))) {
        compiler.report(t.makeError(n,INCOMPATIBLE_EXTENDED_PROPERTY_TYPE,functionName,name,oType.toString(),interfaceType.toString()));
      }
    }
    currentProperties.put(name,interfaceType);
  }
  for (  ObjectType iType : interfaceType.getCtorExtendedInterfaces()) {
    checkInterfaceConflictProperties(t,n,functionName,properties,currentProperties,iType);
  }
}
Program: 18638
Project: 18638
Buggy source:
boolean isParameterizeSubtypeOf(JSType thatType){
  if (thatType.isParameterizedType()) {
    JSType thisParameter=this.parameterType;
    JSType thatParameter=thatType.toMaybeParameterizedType().parameterType;
    return this.wrapsSameRawType(thatType) && (thisParameter.isSubtype(thatParameter) || thatParameter.isSubtype(thisParameter));
  }
 else {
    return this.getReferencedTypeInternal().isSubtype(thatType);
  }
}

Fixed version (ground truth):
boolean isParameterizeSubtypeOf(JSType thatType){
  if (thatType.isParameterizedType()) {
    JSType thisParameter=this.parameterType;
    JSType thatParameter=thatType.toMaybeParameterizedType().parameterType;
    if (this.wrapsSameRawType(thatType)) {
      return (thisParameter.isSubtype(thatParameter) || thatParameter.isSubtype(thisParameter));
    }
  }
  return this.getReferencedTypeInternal().isSubtype(thatType);
}
Program: 18639
Project: 18639
Buggy source:
/** 
 * When computing infima, we may get a situation like inf(Type1, Type2) where both types are unresolved, so they're technically subtypes of one another. If this happens, filter them down to NoResolvedType.
 */
static JSType filterNoResolvedType(JSType type){
  if (type.isNoResolvedType()) {
    return type.getNativeType(JSTypeNative.NO_RESOLVED_TYPE);
  }
 else   if (type.isUnionType()) {
    UnionType unionType=type.toMaybeUnionType();
    boolean needsFiltering=false;
    for (    JSType alt : unionType.getAlternates()) {
      if (alt.isNoResolvedType()) {
        needsFiltering=true;
        break;
      }
    }
    if (needsFiltering) {
      UnionTypeBuilder builder=new UnionTypeBuilder(type.registry);
      for (      JSType alt : unionType.getAlternates()) {
        if (!alt.isNoResolvedType()) {
          builder.addAlternate(alt);
        }
      }
      return builder.build();
    }
  }
  return type;
}

Fixed version (ground truth):
/** 
 * When computing infima, we may get a situation like inf(Type1, Type2) where both types are unresolved, so they're technically subtypes of one another. If this happens, filter them down to NoResolvedType.
 */
static JSType filterNoResolvedType(JSType type){
  if (type.isNoResolvedType()) {
    return type.getNativeType(JSTypeNative.NO_RESOLVED_TYPE);
  }
 else   if (type.isUnionType()) {
    UnionType unionType=type.toMaybeUnionType();
    boolean needsFiltering=false;
    for (    JSType alt : unionType.getAlternates()) {
      if (alt.isNoResolvedType()) {
        needsFiltering=true;
        break;
      }
    }
    if (needsFiltering) {
      UnionTypeBuilder builder=new UnionTypeBuilder(type.registry);
      builder.addAlternate(type.getNativeType(JSTypeNative.NO_RESOLVED_TYPE));
      for (      JSType alt : unionType.getAlternates()) {
        if (!alt.isNoResolvedType()) {
          builder.addAlternate(alt);
        }
      }
      return builder.build();
    }
  }
  return type;
}
Program: 18641
Project: 18641
Buggy source:
JSType meet(JSType that){
  UnionTypeBuilder builder=new UnionTypeBuilder(registry);
  for (  JSType alternate : alternates) {
    if (alternate.isSubtype(that)) {
      builder.addAlternate(alternate);
    }
  }
  if (that.isUnionType()) {
    for (    JSType otherAlternate : that.toMaybeUnionType().alternates) {
      if (otherAlternate.isSubtype(this)) {
        builder.addAlternate(otherAlternate);
      }
    }
  }
 else   if (that.isSubtype(this)) {
    builder.addAlternate(that);
  }
  JSType result=builder.build();
  if (!result.isNoType()) {
    return result;
  }
 else   if (this.isObject() && that.isObject()) {
    return getNativeType(JSTypeNative.NO_OBJECT_TYPE);
  }
 else {
    return getNativeType(JSTypeNative.NO_TYPE);
  }
}

Fixed version (ground truth):
JSType meet(JSType that){
  UnionTypeBuilder builder=new UnionTypeBuilder(registry);
  for (  JSType alternate : alternates) {
    if (alternate.isSubtype(that)) {
      builder.addAlternate(alternate);
    }
  }
  if (that.isUnionType()) {
    for (    JSType otherAlternate : that.toMaybeUnionType().alternates) {
      if (otherAlternate.isSubtype(this)) {
        builder.addAlternate(otherAlternate);
      }
    }
  }
 else   if (that.isSubtype(this)) {
    builder.addAlternate(that);
  }
  JSType result=builder.build();
  if (!result.isNoType()) {
    return result;
  }
 else   if (this.isObject() && (that.isObject() && !that.isNoType())) {
    return getNativeType(JSTypeNative.NO_OBJECT_TYPE);
  }
 else {
    return getNativeType(JSTypeNative.NO_TYPE);
  }
}
Program: 18642
Project: 18642
Buggy source:
/** 
 * Returns a more restricted union type than   {@code this} one, in which allsubtypes of  {@code type} have been removed.<p>Examples: <ul> <li> {@code (number,string)} restricted by {@code number} is{@code string}</li> <li>  {@code (null, EvalError, URIError)} restricted by{@code Error} is {@code null}</li> </ul>
 * @param type the supertype of the types to remove from this union type
 */
public JSType getRestrictedUnion(JSType type){
  UnionTypeBuilder restricted=new UnionTypeBuilder(registry);
  for (  JSType t : alternates) {
    if (t.isUnknownType() || !t.isSubtype(type)) {
      restricted.addAlternate(t);
    }
  }
  return restricted.build();
}

Fixed version (ground truth):
/** 
 * Returns a more restricted union type than   {@code this} one, in which allsubtypes of  {@code type} have been removed.<p>Examples: <ul> <li> {@code (number,string)} restricted by {@code number} is{@code string}</li> <li>  {@code (null, EvalError, URIError)} restricted by{@code Error} is {@code null}</li> </ul>
 * @param type the supertype of the types to remove from this union type
 */
public JSType getRestrictedUnion(JSType type){
  UnionTypeBuilder restricted=new UnionTypeBuilder(registry);
  for (  JSType t : alternates) {
    if (t.isUnknownType() || t.isNoResolvedType() || !t.isSubtype(type)) {
      restricted.addAlternate(t);
    }
  }
  return restricted.build();
}
Program: 18643
Project: 18643
Buggy source:
public void testNamedSubtypeChain() throws Exception {
  List<JSType> typeChain=Lists.newArrayList(registry.getNativeType(JSTypeNative.ALL_TYPE),registry.getNativeType(JSTypeNative.OBJECT_PROTOTYPE),registry.getNativeType(JSTypeNative.OBJECT_TYPE),googBar.getPrototype(),googBar.getInstanceType(),googSubBar.getPrototype(),googSubBar.getInstanceType(),googSubSubBar.getPrototype(),googSubSubBar.getInstanceType(),registry.getNativeType(JSTypeNative.NO_OBJECT_TYPE),registry.getNativeType(JSTypeNative.NO_RESOLVED_TYPE),registry.getNativeType(JSTypeNative.NO_TYPE));
  verifySubtypeChain(typeChain);
}

Fixed version (ground truth):
public void testNamedSubtypeChain() throws Exception {
  List<JSType> typeChain=Lists.newArrayList(registry.getNativeType(JSTypeNative.ALL_TYPE),registry.getNativeType(JSTypeNative.OBJECT_PROTOTYPE),registry.getNativeType(JSTypeNative.OBJECT_TYPE),googBar.getPrototype(),googBar.getInstanceType(),googSubBar.getPrototype(),googSubBar.getInstanceType(),googSubSubBar.getPrototype(),googSubSubBar.getInstanceType(),registry.getNativeType(JSTypeNative.NO_OBJECT_TYPE),registry.getNativeType(JSTypeNative.NO_TYPE));
  verifySubtypeChain(typeChain);
}
Program: 18646
Project: 18646
Buggy source:
/** 
 * Resolve the referenced type within the enclosing scope.
 */
@Override JSType resolveInternal(ErrorReporter t,StaticScope<JSType> enclosing){
  boolean resolved=resolveViaRegistry(t,enclosing);
  if (detectImplicitPrototypeCycle()) {
    handleTypeCycle(t);
  }
  if (resolved) {
    super.resolveInternal(t,enclosing);
    finishPropertyContinuations();
    return registry.isLastGeneration() ? getReferencedType() : this;
  }
  resolveViaProperties(t,enclosing);
  if (detectImplicitPrototypeCycle()) {
    handleTypeCycle(t);
  }
  super.resolveInternal(t,enclosing);
  if (isResolved()) {
    finishPropertyContinuations();
  }
  return registry.isLastGeneration() ? getReferencedType() : this;
}

Fixed version (ground truth):
/** 
 * Resolve the referenced type within the enclosing scope.
 */
@Override JSType resolveInternal(ErrorReporter t,StaticScope<JSType> enclosing){
  boolean resolved=resolveViaRegistry(t,enclosing);
  if (detectInheritanceCycle()) {
    handleTypeCycle(t);
  }
  if (resolved) {
    super.resolveInternal(t,enclosing);
    finishPropertyContinuations();
    return registry.isLastGeneration() ? getReferencedType() : this;
  }
  resolveViaProperties(t,enclosing);
  if (detectInheritanceCycle()) {
    handleTypeCycle(t);
  }
  super.resolveInternal(t,enclosing);
  if (isResolved()) {
    finishPropertyContinuations();
  }
  return registry.isLastGeneration() ? getReferencedType() : this;
}
Program: 18647
Project: 18647
Buggy source:
/** 
 * Detects a cycle in the implicit prototype chain. This method accesses the   {@link #getImplicitPrototype()} method and must therefore beinvoked only after the object is sufficiently initialized to respond to calls to this method.<p> The method is not thread safe.<p>
 * @return True iff an implicit prototype cycle was detected.
 */
final boolean detectImplicitPrototypeCycle(){
  this.visited=true;
  ObjectType p=getImplicitPrototype();
  while (p != null) {
    if (p.visited) {
      return true;
    }
 else {
      p.visited=true;
    }
    p=p.getImplicitPrototype();
  }
  p=this;
  do {
    p.visited=false;
    p=p.getImplicitPrototype();
  }
 while (p != null);
  return false;
}

Fixed version (ground truth):
/** 
 * Detects a cycle in the implicit prototype chain. This method accesses the   {@link #getImplicitPrototype()} method and must therefore beinvoked only after the object is sufficiently initialized to respond to calls to this method.<p>
 * @return True iff an implicit prototype cycle was detected.
 */
final boolean detectImplicitPrototypeCycle(){
  this.visited=true;
  ObjectType p=getImplicitPrototype();
  while (p != null) {
    if (p.visited) {
      return true;
    }
 else {
      p.visited=true;
    }
    p=p.getImplicitPrototype();
  }
  p=this;
  do {
    p.visited=false;
    p=p.getImplicitPrototype();
  }
 while (p != null);
  return false;
}
Program: 18648
Project: 18648
Buggy source:
/** 
 * Remove useless switches and cases.
 */
private Node tryOptimizeSwitch(Node n){
  Preconditions.checkState(n.isSwitch());
  Node defaultCase=tryOptimizeDefaultCase(n);
  if (defaultCase == null) {
    Node next=null;
    Node prev=null;
    for (Node c=n.getFirstChild().getNext(); c != null; c=next) {
      next=c.getNext();
      if (!mayHaveSideEffects(c.getFirstChild()) && isUselessCase(c,prev)) {
        removeCase(n,c);
      }
 else {
        prev=c;
      }
    }
  }
  if (n.hasOneChild()) {
    Node condition=n.removeFirstChild();
    Node parent=n.getParent();
    Node replacement=IR.exprResult(condition).srcref(n);
    parent.replaceChild(n,replacement);
    reportCodeChange();
    return replacement;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Remove useless switches and cases.
 */
private Node tryOptimizeSwitch(Node n){
  Preconditions.checkState(n.isSwitch());
  Node defaultCase=tryOptimizeDefaultCase(n);
  if (defaultCase == null) {
    Node cond=n.getFirstChild(), prev=null, next=null, cur;
    for (cur=cond.getNext(); cur != null; cur=next) {
      next=cur.getNext();
      if (!mayHaveSideEffects(cur.getFirstChild()) && isUselessCase(cur,prev)) {
        removeCase(n,cur);
      }
 else {
        prev=cur;
      }
    }
    if (NodeUtil.isLiteralValue(cond,false)) {
      Node caseLabel;
      TernaryValue caseMatches=TernaryValue.TRUE;
      for (cur=cond.getNext(); cur != null; cur=next) {
        next=cur.getNext();
        caseLabel=cur.getFirstChild();
        caseMatches=PeepholeFoldConstants.evaluateComparison(Token.SHEQ,cond,caseLabel);
        if (caseMatches == TernaryValue.TRUE) {
          break;
        }
 else         if (caseMatches == TernaryValue.UNKNOWN) {
          break;
        }
 else {
          n.removeChild(cur);
          reportCodeChange();
        }
      }
      if (caseMatches != TernaryValue.UNKNOWN) {
        Node block, lastStm;
        while (cur != null) {
          block=cur.getLastChild();
          lastStm=block.getLastChild();
          cur=cur.getNext();
          if (lastStm.isBreak()) {
            block.removeChild(lastStm);
            reportCodeChange();
            break;
          }
        }
        for (; cur != null; cur=next) {
          next=cur.getNext();
          n.removeChild(cur);
          reportCodeChange();
        }
        cur=cond.getNext();
        if (cur != null && cur.getNext() == null) {
          block=cur.getLastChild();
          if (!(NodeUtil.containsType(block,Token.BREAK,NodeUtil.MATCH_NOT_FUNCTION))) {
            cur.removeChild(block);
            n.getParent().replaceChild(n,block);
            reportCodeChange();
            return block;
          }
        }
      }
    }
  }
  if (n.hasOneChild()) {
    Node condition=n.removeFirstChild();
    Node replacement=IR.exprResult(condition).srcref(n);
    n.getParent().replaceChild(n,replacement);
    reportCodeChange();
    return replacement;
  }
  return null;
}
Program: 18652
Project: 18652
Buggy source:
/** 
 * Expect that the first type can be assigned to a symbol of the second type.
 * @param t The node traversal.
 * @param n The node to issue warnings on.
 * @param rightType The type on the RHS of the assign.
 * @param leftType The type of the symbol on the LHS of the assign.
 * @param msg An extra message for the mismatch warning, if necessary.
 * @return True if the types matched, false otherwise.
 */
boolean expectCanAssignTo(NodeTraversal t,Node n,JSType rightType,JSType leftType,String msg){
  if (!rightType.canAssignTo(leftType)) {
    if (bothIntrinsics(rightType,leftType)) {
      registerMismatch(rightType,leftType,null);
    }
 else {
      mismatch(t,n,msg,rightType,leftType);
    }
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Expect that the first type can be assigned to a symbol of the second type.
 * @param t The node traversal.
 * @param n The node to issue warnings on.
 * @param rightType The type on the RHS of the assign.
 * @param leftType The type of the symbol on the LHS of the assign.
 * @param msg An extra message for the mismatch warning, if necessary.
 * @return True if the types matched, false otherwise.
 */
boolean expectCanAssignTo(NodeTraversal t,Node n,JSType rightType,JSType leftType,String msg){
  if (!rightType.canAssignTo(leftType)) {
    mismatch(t,n,msg,rightType,leftType);
    return false;
  }
  return true;
}
Program: 18653
Project: 18653
Buggy source:
/** 
 * Expect that the first type can be assigned to a symbol of the second type.
 * @param t The node traversal.
 * @param n The node to issue warnings on.
 * @param rightType The type on the RHS of the assign.
 * @param leftType The type of the symbol on the LHS of the assign.
 * @param owner The owner of the property being assigned to.
 * @param propName The name of the property being assigned to.
 * @return True if the types matched, false otherwise.
 */
boolean expectCanAssignToPropertyOf(NodeTraversal t,Node n,JSType rightType,JSType leftType,Node owner,String propName){
  if (!leftType.isNoType() && !rightType.canAssignTo(leftType)) {
    if (bothIntrinsics(rightType,leftType)) {
      registerMismatch(rightType,leftType,null);
    }
 else {
      JSType ownerType=getJSType(owner);
      if (ownerType.isFunctionPrototypeType()) {
        FunctionType ownerFn=ownerType.toObjectType().getOwnerFunction();
        if (ownerFn.isInterface() && rightType.isFunctionType() && leftType.isFunctionType()) {
          return true;
        }
      }
      mismatch(t,n,"String_Node_Str" + propName + "String_Node_Str"+ getReadableJSTypeName(owner,true),rightType,leftType);
    }
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Expect that the first type can be assigned to a symbol of the second type.
 * @param t The node traversal.
 * @param n The node to issue warnings on.
 * @param rightType The type on the RHS of the assign.
 * @param leftType The type of the symbol on the LHS of the assign.
 * @param owner The owner of the property being assigned to.
 * @param propName The name of the property being assigned to.
 * @return True if the types matched, false otherwise.
 */
boolean expectCanAssignToPropertyOf(NodeTraversal t,Node n,JSType rightType,JSType leftType,Node owner,String propName){
  if (!leftType.isNoType() && !rightType.canAssignTo(leftType)) {
    JSType ownerType=getJSType(owner);
    if (ownerType.isFunctionPrototypeType()) {
      FunctionType ownerFn=ownerType.toObjectType().getOwnerFunction();
      if (ownerFn.isInterface() && rightType.isFunctionType() && leftType.isFunctionType()) {
        return true;
      }
    }
    mismatch(t,n,"String_Node_Str" + propName + "String_Node_Str"+ getReadableJSTypeName(owner,true),rightType,leftType);
    return false;
  }
  return true;
}
Program: 18654
Project: 18654
Buggy source:
/** 
 * A function is a subtype of another if their call methods are related via subtyping and   {@code this} is a subtype of {@code that} with regard tothe prototype chain.
 */
@Override public boolean isSubtype(JSType that){
  if (JSType.isSubtypeHelper(this,that)) {
    return true;
  }
  if (that.isFunctionType()) {
    FunctionType other=that.toMaybeFunctionType();
    if (other.isInterface()) {
      return true;
    }
    if (isInterface()) {
      return false;
    }
    boolean treatThisTypesAsCovariant=isConstructor() || other.isConstructor() || (other.typeOfThis.toObjectType() != null && other.typeOfThis.toObjectType().getConstructor() != null && other.typeOfThis.toObjectType().getConstructor().isInterface())|| other.typeOfThis.isSubtype(this.typeOfThis)|| this.typeOfThis.isSubtype(other.typeOfThis);
    return treatThisTypesAsCovariant && this.call.isSubtype(other.call);
  }
  return getNativeType(JSTypeNative.FUNCTION_PROTOTYPE).isSubtype(that);
}

Fixed version (ground truth):
/** 
 * A function is a subtype of another if their call methods are related via subtyping and   {@code this} is a subtype of {@code that} with regard tothe prototype chain.
 */
@Override public boolean isSubtype(JSType that){
  if (JSType.isSubtypeHelper(this,that)) {
    return true;
  }
  if (that.isFunctionType()) {
    FunctionType other=that.toMaybeFunctionType();
    if (other.isInterface()) {
      return true;
    }
    if (isInterface()) {
      return false;
    }
    boolean treatThisTypesAsCovariant=(other.typeOfThis.toObjectType() != null && other.typeOfThis.toObjectType().getConstructor() != null && other.typeOfThis.toObjectType().getConstructor().isInterface()) || other.typeOfThis.isSubtype(this.typeOfThis) || this.typeOfThis.isSubtype(other.typeOfThis);
    return treatThisTypesAsCovariant && this.call.isSubtype(other.call);
  }
  return getNativeType(JSTypeNative.FUNCTION_PROTOTYPE).isSubtype(that);
}
Program: 18655
Project: 18655
Buggy source:
public void testTypeRedefinition() throws Exception {
  testTypes("String_Node_Str" + "String_Node_Str","String_Node_Str" + "String_Node_Str");
}

Fixed version (ground truth):
public void testTypeRedefinition() throws Exception {
  testClosureTypesMultipleWarnings("String_Node_Str" + "String_Node_Str",Lists.newArrayList("String_Node_Str" + "String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"));
}
Program: 18656
Project: 18656
Buggy source:
private void testClosureTypesMultipleWarnings(String js,List<String> descriptions) throws Exception {
  Node n=compiler.parseTestCode(js);
  Node externs=new Node(Token.BLOCK);
  Node externAndJsRoot=new Node(Token.BLOCK,externs,n);
  externAndJsRoot.setIsSyntheticBlock(true);
  assertEquals("String_Node_Str" + Joiner.on("String_Node_Str").join(compiler.getErrors()),0,compiler.getErrorCount());
  new ProcessClosurePrimitives(compiler,null,CheckLevel.ERROR).process(null,n);
  CodingConvention convention=compiler.getCodingConvention();
  new TypeCheck(compiler,new ClosureReverseAbstractInterpreter(convention,registry).append(new SemanticReverseAbstractInterpreter(convention,registry)).getFirst(),registry).processForTesting(null,n);
  assertEquals(0,compiler.getErrorCount());
  if (descriptions == null) {
    assertEquals("String_Node_Str" + Joiner.on("String_Node_Str").join(compiler.getWarnings()),0,compiler.getWarningCount());
  }
 else {
    assertEquals(descriptions.size(),compiler.getWarningCount());
    for (int i=0; i < descriptions.size(); i++) {
      assertEquals(descriptions.get(i),compiler.getWarnings()[i].description);
    }
  }
}

Fixed version (ground truth):
private void testClosureTypesMultipleWarnings(String js,List<String> descriptions) throws Exception {
  Node n=compiler.parseTestCode(js);
  Node externs=new Node(Token.BLOCK);
  Node externAndJsRoot=new Node(Token.BLOCK,externs,n);
  externAndJsRoot.setIsSyntheticBlock(true);
  assertEquals("String_Node_Str" + Joiner.on("String_Node_Str").join(compiler.getErrors()),0,compiler.getErrorCount());
  new ProcessClosurePrimitives(compiler,null,CheckLevel.ERROR).process(null,n);
  CodingConvention convention=compiler.getCodingConvention();
  new TypeCheck(compiler,new ClosureReverseAbstractInterpreter(convention,registry).append(new SemanticReverseAbstractInterpreter(convention,registry)).getFirst(),registry).processForTesting(null,n);
  assertEquals(0,compiler.getErrorCount());
  if (descriptions == null) {
    assertEquals("String_Node_Str" + Joiner.on("String_Node_Str").join(compiler.getWarnings()),0,compiler.getWarningCount());
  }
 else {
    assertEquals(descriptions.size(),compiler.getWarningCount());
    Set<String> actualWarningDescriptions=Sets.newHashSet();
    for (int i=0; i < descriptions.size(); i++) {
      actualWarningDescriptions.add(compiler.getWarnings()[i].description);
    }
    assertEquals(Sets.newHashSet(descriptions),actualWarningDescriptions);
  }
}
Program: 18657
Project: 18657
Buggy source:
public void testTypeRedefinition() throws Exception {
  testTypes("String_Node_Str" + "String_Node_Str","String_Node_Str" + "String_Node_Str");
}

Fixed version (ground truth):
public void testTypeRedefinition() throws Exception {
  testClosureTypesMultipleWarnings("String_Node_Str" + "String_Node_Str",Lists.newArrayList("String_Node_Str" + "String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"));
}
Program: 18658
Project: 18658
Buggy source:
private void testClosureTypesMultipleWarnings(String js,List<String> descriptions) throws Exception {
  Node n=compiler.parseTestCode(js);
  Node externs=new Node(Token.BLOCK);
  Node externAndJsRoot=new Node(Token.BLOCK,externs,n);
  externAndJsRoot.setIsSyntheticBlock(true);
  assertEquals("String_Node_Str" + Joiner.on("String_Node_Str").join(compiler.getErrors()),0,compiler.getErrorCount());
  new ProcessClosurePrimitives(compiler,null,CheckLevel.ERROR).process(null,n);
  CodingConvention convention=compiler.getCodingConvention();
  new TypeCheck(compiler,new ClosureReverseAbstractInterpreter(convention,registry).append(new SemanticReverseAbstractInterpreter(convention,registry)).getFirst(),registry).processForTesting(null,n);
  assertEquals("String_Node_Str" + Joiner.on("String_Node_Str").join(compiler.getErrors()),0,compiler.getErrorCount());
  if (descriptions == null) {
    assertEquals("String_Node_Str" + Joiner.on("String_Node_Str").join(compiler.getWarnings()),0,compiler.getWarningCount());
  }
 else {
    assertEquals("String_Node_Str" + Joiner.on("String_Node_Str").join(compiler.getWarnings()),descriptions.size(),compiler.getWarningCount());
    for (int i=0; i < descriptions.size(); i++) {
      assertEquals(descriptions.get(i),compiler.getWarnings()[i].description);
    }
  }
}

Fixed version (ground truth):
private void testClosureTypesMultipleWarnings(String js,List<String> descriptions) throws Exception {
  Node n=compiler.parseTestCode(js);
  Node externs=new Node(Token.BLOCK);
  Node externAndJsRoot=new Node(Token.BLOCK,externs,n);
  externAndJsRoot.setIsSyntheticBlock(true);
  assertEquals("String_Node_Str" + Joiner.on("String_Node_Str").join(compiler.getErrors()),0,compiler.getErrorCount());
  new ProcessClosurePrimitives(compiler,null,CheckLevel.ERROR).process(null,n);
  CodingConvention convention=compiler.getCodingConvention();
  new TypeCheck(compiler,new ClosureReverseAbstractInterpreter(convention,registry).append(new SemanticReverseAbstractInterpreter(convention,registry)).getFirst(),registry).processForTesting(null,n);
  assertEquals("String_Node_Str" + Joiner.on("String_Node_Str").join(compiler.getErrors()),0,compiler.getErrorCount());
  if (descriptions == null) {
    assertEquals("String_Node_Str" + Joiner.on("String_Node_Str").join(compiler.getWarnings()),0,compiler.getWarningCount());
  }
 else {
    assertEquals("String_Node_Str" + Joiner.on("String_Node_Str").join(compiler.getWarnings()),descriptions.size(),compiler.getWarningCount());
    Set<String> actualWarningDescriptions=Sets.newHashSet();
    for (int i=0; i < descriptions.size(); i++) {
      actualWarningDescriptions.add(compiler.getWarnings()[i].description);
    }
    assertEquals(Sets.newHashSet(descriptions),actualWarningDescriptions);
  }
}
Program: 18659
Project: 18659
Buggy source:
/** 
 * @return True if our parameter spec is equal to {@code that}'s parameter spec.
 */
boolean hasEqualParameters(ArrowType that,EquivalenceMethod eqMethod){
  Node thisParam=parameters.getFirstChild();
  Node otherParam=that.parameters.getFirstChild();
  while (thisParam != null && otherParam != null) {
    JSType thisParamType=thisParam.getJSType();
    JSType otherParamType=otherParam.getJSType();
    if (thisParamType != null) {
      if (otherParamType != null && !thisParamType.checkEquivalenceHelper(otherParamType,eqMethod)) {
        return false;
      }
    }
 else {
      if (otherParamType != null) {
        return false;
      }
    }
    thisParam=thisParam.getNext();
    otherParam=otherParam.getNext();
  }
  return thisParam == otherParam;
}

Fixed version (ground truth):
/** 
 * @return True if our parameter spec is equal to {@code that}'s parameter spec.
 */
boolean hasEqualParameters(ArrowType that,EquivalenceMethod eqMethod){
  Node thisParam=parameters.getFirstChild();
  Node otherParam=that.parameters.getFirstChild();
  while (thisParam != null && otherParam != null) {
    JSType thisParamType=thisParam.getJSType();
    JSType otherParamType=otherParam.getJSType();
    if (thisParamType != null) {
      if (otherParamType != null && !thisParamType.checkEquivalenceHelper(otherParamType,eqMethod)) {
        return false;
      }
    }
 else {
      if (otherParamType != null) {
        return false;
      }
    }
    if (thisParam.isOptionalArg() != otherParam.isOptionalArg()) {
      return false;
    }
    if (thisParam.isVarArgs() != otherParam.isVarArgs()) {
      return false;
    }
    thisParam=thisParam.getNext();
    otherParam=otherParam.getNext();
  }
  return thisParam == otherParam;
}
Program: 18661
Project: 18661
Buggy source:
public void testGetElem(){
  testSame("String_Node_Str" + "String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",null);
  assertType("String_Node_Str",getType("String_Node_Str"));
  assertType("String_Node_Str",getType("String_Node_Str"));
  assertType("String_Node_Str",getType("String_Node_Str"));
  testSame("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  assertType("String_Node_Str",getType("String_Node_Str"));
}

Fixed version (ground truth):
public void testGetElem(){
  testSame("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",null);
  assertType("String_Node_Str",getType("String_Node_Str"));
  assertType("String_Node_Str",getType("String_Node_Str"));
  assertType("String_Node_Str",getType("String_Node_Str"));
  testSame("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  assertType("String_Node_Str",getType("String_Node_Str"));
}
Program: 18662
Project: 18662
Buggy source:
public void testParseOptionalModifier() throws Exception {
  JSDocInfo info=parse("String_Node_Str");
  assertTypeEquals(registry.createFunctionType(UNKNOWN_TYPE,createUnionType(VOID_TYPE,NUMBER_TYPE)),info.getType());
}

Fixed version (ground truth):
public void testParseOptionalModifier() throws Exception {
  JSDocInfo info=parse("String_Node_Str");
  assertTypeEquals(registry.createFunctionType(UNKNOWN_TYPE,registry.createOptionalParameters(NUMBER_TYPE)),info.getType());
}
Program: 18663
Project: 18663
Buggy source:
/** 
 * Computes the subset of   {@code this} and {@code that} types if equalityis observed. If a value  {@code v1} of type {@code null} is equal to a value{@code v2} of type {@code (undefined,number)}, we can infer that the type of   {@code v1} is {@code null} and the type of {@code v2} is{@code undefined}.
 * @return a pair containing the restricted type of {@code this} as the firstcomponent and the restricted type of  {@code that} as the secondelement. The returned pair is never  {@code null} even though itscomponents may be  {@code null}
 */
public TypePair getTypesUnderEquality(JSType that){
  if (that.isUnionType()) {
    TypePair p=that.toMaybeUnionType().getTypesUnderEquality(this);
    return new TypePair(p.typeB,p.typeA);
  }
switch (this.testForEquality(that)) {
case FALSE:
    return new TypePair(null,null);
case TRUE:
case UNKNOWN:
  return new TypePair(this,that);
}
throw new IllegalStateException();
}

Fixed version (ground truth):
/** 
 * Computes the subset of   {@code this} and {@code that} types if equalityis observed. If a value  {@code v1} of type {@code null} is equal to a value{@code v2} of type {@code (undefined,number)}, we can infer that the type of   {@code v1} is {@code null} and the type of {@code v2} is{@code undefined}.
 * @return a pair containing the restricted type of {@code this} as the firstcomponent and the restricted type of  {@code that} as the secondelement. The returned pair is never  {@code null} even though itscomponents may be  {@code null}
 */
public TypePair getTypesUnderEquality(JSType that){
  if (that.isUnionType()) {
    TypePair p=that.toMaybeUnionType().getTypesUnderEquality(this);
    return new TypePair(p.typeB,p.typeA);
  }
switch (testForEquality(that)) {
case FALSE:
    return new TypePair(null,null);
case TRUE:
case UNKNOWN:
  return new TypePair(this,that);
}
throw new IllegalStateException();
}
Program: 18664
Project: 18664
Buggy source:
/** 
 * A hash code function for diagnosing complicated issues around type-identity.
 */
public String toDebugHashCodeString(){
  return "String_Node_Str" + this.hashCode() + "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * A hash code function for diagnosing complicated issues around type-identity.
 */
public String toDebugHashCodeString(){
  return "String_Node_Str" + hashCode() + "String_Node_Str";
}
Program: 18665
Project: 18665
Buggy source:
/** 
 * Tests whether   {@code this} and {@code that} are meaningfullycomparable. By meaningfully, we mean compatible types that do not lead to step 22 of the definition of the Abstract Equality Comparison Algorithm (11.9.3, page 55&ndash;56) of the ECMA-262 specification.<p>
 */
public final boolean canTestForEqualityWith(JSType that){
  return this.testForEquality(that).equals(UNKNOWN);
}

Fixed version (ground truth):
/** 
 * Tests whether   {@code this} and {@code that} are meaningfullycomparable. By meaningfully, we mean compatible types that do not lead to step 22 of the definition of the Abstract Equality Comparison Algorithm (11.9.3, page 55&ndash;56) of the ECMA-262 specification.<p>
 */
public final boolean canTestForEqualityWith(JSType that){
  return testForEquality(that).equals(UNKNOWN);
}
Program: 18666
Project: 18666
Buggy source:
/** 
 * Tests whether the type is a number (value or Object).
 * @return {@code this &lt;: (Number, number)}
 */
public final boolean isNumber(){
  return this.isSubtype(getNativeType(JSTypeNative.NUMBER_VALUE_OR_OBJECT_TYPE));
}

Fixed version (ground truth):
/** 
 * Tests whether the type is a number (value or Object).
 * @return {@code this &lt;: (Number, number)}
 */
public final boolean isNumber(){
  return isSubtype(getNativeType(JSTypeNative.NUMBER_VALUE_OR_OBJECT_TYPE));
}
Program: 18667
Project: 18667
Buggy source:
/** 
 * Returns true iff   {@code this} can be a {@code struct}. UnionType overrides the method, assume   {@code this} is not a union here.
 */
public boolean isStruct(){
  if (isObject()) {
    ObjectType objType=toObjectType();
    FunctionType ctor=objType.getConstructor();
    if (ctor == null) {
      JSDocInfo info=objType.getJSDocInfo();
      return info != null && info.makesStructs();
    }
 else {
      return ctor.makesStructs();
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Returns true iff   {@code this} can be a {@code struct}. UnionType overrides the method, assume   {@code this} is not a union here.
 */
public boolean isStruct(){
  if (isObject()) {
    ObjectType objType=toObjectType();
    ObjectType iproto=objType.getImplicitPrototype();
    if (iproto != null && iproto.isStruct()) {
      return true;
    }
    FunctionType ctor=objType.getConstructor();
    if (ctor == null) {
      JSDocInfo info=objType.getJSDocInfo();
      return info != null && info.makesStructs();
    }
 else {
      return ctor.makesStructs();
    }
  }
  return false;
}
Program: 18668
Project: 18668
Buggy source:
/** 
 * Computes the subset of   {@code this} and {@code that} types if inequalityis observed. If a value  {@code v1} of type {@code number} is not equal to avalue  {@code v2} of type {@code (undefined,number)}, we can infer that the type of   {@code v1} is {@code number} and the type of {@code v2} is{@code number} as well.
 * @return a pair containing the restricted type of {@code this} as the firstcomponent and the restricted type of  {@code that} as the secondelement. The returned pair is never  {@code null} even though itscomponents may be  {@code null}
 */
public TypePair getTypesUnderInequality(JSType that){
  if (that.isUnionType()) {
    TypePair p=that.toMaybeUnionType().getTypesUnderInequality(this);
    return new TypePair(p.typeB,p.typeA);
  }
switch (this.testForEquality(that)) {
case TRUE:
    JSType noType=getNativeType(JSTypeNative.NO_TYPE);
  return new TypePair(noType,noType);
case FALSE:
case UNKNOWN:
return new TypePair(this,that);
}
throw new IllegalStateException();
}

Fixed version (ground truth):
/** 
 * Computes the subset of   {@code this} and {@code that} types if inequalityis observed. If a value  {@code v1} of type {@code number} is not equal to avalue  {@code v2} of type {@code (undefined,number)}, we can infer that the type of   {@code v1} is {@code number} and the type of {@code v2} is{@code number} as well.
 * @return a pair containing the restricted type of {@code this} as the firstcomponent and the restricted type of  {@code that} as the secondelement. The returned pair is never  {@code null} even though itscomponents may be  {@code null}
 */
public TypePair getTypesUnderInequality(JSType that){
  if (that.isUnionType()) {
    TypePair p=that.toMaybeUnionType().getTypesUnderInequality(this);
    return new TypePair(p.typeB,p.typeA);
  }
switch (testForEquality(that)) {
case TRUE:
    JSType noType=getNativeType(JSTypeNative.NO_TYPE);
  return new TypePair(noType,noType);
case FALSE:
case UNKNOWN:
return new TypePair(this,that);
}
throw new IllegalStateException();
}
Program: 18669
Project: 18669
Buggy source:
/** 
 * Returns true iff   {@code this} can be a {@code dict}. UnionType overrides the method, assume   {@code this} is not a union here.
 */
public boolean isDict(){
  if (isObject()) {
    FunctionType ctor=toObjectType().getConstructor();
    return ctor != null && ctor.makesDicts();
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Returns true iff   {@code this} can be a {@code dict}. UnionType overrides the method, assume   {@code this} is not a union here.
 */
public boolean isDict(){
  if (isObject()) {
    ObjectType objType=toObjectType();
    ObjectType iproto=objType.getImplicitPrototype();
    if (iproto != null && iproto.isDict()) {
      return true;
    }
    FunctionType ctor=objType.getConstructor();
    return ctor != null && ctor.makesDicts();
  }
  return false;
}
Program: 18670
Project: 18670
Buggy source:
/** 
 * Tests whether this type is nullable.
 */
public boolean isNullable(){
  return this.isSubtype(getNativeType(JSTypeNative.NULL_TYPE));
}

Fixed version (ground truth):
/** 
 * Tests whether this type is nullable.
 */
public boolean isNullable(){
  return isSubtype(getNativeType(JSTypeNative.NULL_TYPE));
}
Program: 18671
Project: 18671
Buggy source:
/** 
 * Tests whether values of   {@code this} type can be safely assignedto values of  {@code that} type.<p>The default implementation verifies that  {@code this} is a subtypeof  {@code that}.<p>
 */
public boolean canAssignTo(JSType that){
  if (this.isSubtype(that)) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Tests whether values of   {@code this} type can be safely assignedto values of  {@code that} type.<p>The default implementation verifies that  {@code this} is a subtypeof  {@code that}.<p>
 */
public boolean canAssignTo(JSType that){
  return isSubtype(that);
}
Program: 18672
Project: 18672
Buggy source:
/** 
 * Computes the subset of   {@code this} and {@code that} types undershallow inequality.
 * @return A pair containing the restricted type of {@code this} as the firstcomponent and the restricted type of  {@code that} as the secondelement. The returned pair is never  {@code null} even though itscomponents may be  {@code null}
 */
public TypePair getTypesUnderShallowInequality(JSType that){
  if (that.isUnionType()) {
    TypePair p=that.toMaybeUnionType().getTypesUnderShallowInequality(this);
    return new TypePair(p.typeB,p.typeA);
  }
  if (this.isNullType() && that.isNullType() || this.isVoidType() && that.isVoidType()) {
    return new TypePair(null,null);
  }
 else {
    return new TypePair(this,that);
  }
}

Fixed version (ground truth):
/** 
 * Computes the subset of   {@code this} and {@code that} types undershallow inequality.
 * @return A pair containing the restricted type of {@code this} as the firstcomponent and the restricted type of  {@code that} as the secondelement. The returned pair is never  {@code null} even though itscomponents may be  {@code null}
 */
public TypePair getTypesUnderShallowInequality(JSType that){
  if (that.isUnionType()) {
    TypePair p=that.toMaybeUnionType().getTypesUnderShallowInequality(this);
    return new TypePair(p.typeB,p.typeA);
  }
  if (isNullType() && that.isNullType() || isVoidType() && that.isVoidType()) {
    return new TypePair(null,null);
  }
 else {
    return new TypePair(this,that);
  }
}
Program: 18674
Project: 18674
Buggy source:
/** 
 * Tests whether the type is a string (value or Object).
 * @return {@code this &lt;: (String, string)}
 */
public final boolean isString(){
  return this.isSubtype(getNativeType(JSTypeNative.STRING_VALUE_OR_OBJECT_TYPE));
}

Fixed version (ground truth):
/** 
 * Tests whether the type is a string (value or Object).
 * @return {@code this &lt;: (String, string)}
 */
public final boolean isString(){
  return isSubtype(getNativeType(JSTypeNative.STRING_VALUE_OR_OBJECT_TYPE));
}
Program: 18675
Project: 18675
Buggy source:
/** 
 * Given the name of a native object property, checks whether the property is present on the object and different from the native one.
 */
private boolean hasOverridenNativeProperty(String propertyName){
  if (isNativeObjectType()) {
    return false;
  }
  JSType propertyType=getPropertyType(propertyName);
  ObjectType nativeType=this.isFunctionType() ? registry.getNativeObjectType(JSTypeNative.FUNCTION_PROTOTYPE) : registry.getNativeObjectType(JSTypeNative.OBJECT_PROTOTYPE);
  JSType nativePropertyType=nativeType.getPropertyType(propertyName);
  return propertyType != nativePropertyType;
}

Fixed version (ground truth):
/** 
 * Given the name of a native object property, checks whether the property is present on the object and different from the native one.
 */
private boolean hasOverridenNativeProperty(String propertyName){
  if (isNativeObjectType()) {
    return false;
  }
  JSType propertyType=getPropertyType(propertyName);
  ObjectType nativeType=isFunctionType() ? registry.getNativeObjectType(JSTypeNative.FUNCTION_PROTOTYPE) : registry.getNativeObjectType(JSTypeNative.OBJECT_PROTOTYPE);
  JSType nativePropertyType=nativeType.getPropertyType(propertyName);
  return propertyType != nativePropertyType;
}
Program: 18676
Project: 18676
Buggy source:
@Override public boolean isSubtype(JSType that){
  if (JSType.isSubtypeHelper(this,that)) {
    return true;
  }
  if (that.isUnionType()) {
    return false;
  }
  if (that.isRecordType()) {
    return RecordType.isSubtype(this,that.toMaybeRecordType());
  }
  ObjectType thatObj=that.toObjectType();
  FunctionType thatCtor=thatObj == null ? null : thatObj.getConstructor();
  if (getConstructor() != null && getConstructor().isInterface()) {
    for (    ObjectType thisInterface : getCtorExtendedInterfaces()) {
      if (thisInterface.isSubtype(that)) {
        return true;
      }
    }
  }
 else   if (thatCtor != null && thatCtor.isInterface()) {
    Iterable<ObjectType> thisInterfaces=getCtorImplementedInterfaces();
    for (    ObjectType thisInterface : thisInterfaces) {
      if (thisInterface.isSubtype(that)) {
        return true;
      }
    }
  }
  if (isUnknownType() || implicitPrototypeChainIsUnknown()) {
    return true;
  }
  return thatObj != null && this.isImplicitPrototype(thatObj);
}

Fixed version (ground truth):
@Override public boolean isSubtype(JSType that){
  if (JSType.isSubtypeHelper(this,that)) {
    return true;
  }
  if (that.isUnionType()) {
    return false;
  }
  if (that.isRecordType()) {
    return RecordType.isSubtype(this,that.toMaybeRecordType());
  }
  ObjectType thatObj=that.toObjectType();
  FunctionType thatCtor=thatObj == null ? null : thatObj.getConstructor();
  if (getConstructor() != null && getConstructor().isInterface()) {
    for (    ObjectType thisInterface : getCtorExtendedInterfaces()) {
      if (thisInterface.isSubtype(that)) {
        return true;
      }
    }
  }
 else   if (thatCtor != null && thatCtor.isInterface()) {
    Iterable<ObjectType> thisInterfaces=getCtorImplementedInterfaces();
    for (    ObjectType thisInterface : thisInterfaces) {
      if (thisInterface.isSubtype(that)) {
        return true;
      }
    }
  }
  if (isUnknownType() || implicitPrototypeChainIsUnknown()) {
    return true;
  }
  return thatObj != null && isImplicitPrototype(thatObj);
}
Program: 18679
Project: 18679
Buggy source:
public void setImplementedInterfaces(List<ObjectType> implementedInterfaces){
  for (  ObjectType type : implementedInterfaces) {
    registry.registerTypeImplementingInterface(this,type);
  }
  this.implementedInterfaces=ImmutableList.copyOf(implementedInterfaces);
}

Fixed version (ground truth):
public void setImplementedInterfaces(List<ObjectType> implementedInterfaces){
  if (isConstructor()) {
    for (    ObjectType type : implementedInterfaces) {
      registry.registerTypeImplementingInterface(this,type);
    }
    this.implementedInterfaces=ImmutableList.copyOf(implementedInterfaces);
  }
 else {
    throw new UnsupportedOperationException();
  }
}
Program: 18680
Project: 18680
Buggy source:
private void addExpr(Node n,int minPrecedence,Context context){
  if ((NodeUtil.precedence(n.getType()) < minPrecedence) || ((context == Context.IN_FOR_INIT_CLAUSE) && (n.isIn()))) {
    add("String_Node_Str");
    add(n,clearContextForNoInOperator(context));
    add("String_Node_Str");
  }
 else {
    add(n,context);
  }
}

Fixed version (ground truth):
private void addExpr(Node n,int minPrecedence,Context context){
  if ((NodeUtil.precedence(n.getType()) < minPrecedence) || ((context == Context.IN_FOR_INIT_CLAUSE) && n.isIn())) {
    add("String_Node_Str");
    add(n,Context.OTHER);
    add("String_Node_Str");
  }
 else {
    add(n,context);
  }
}
Program: 18681
Project: 18681
Buggy source:
public void testObjectLit(){
  assertPrint("String_Node_Str","String_Node_Str");
  assertPrint("String_Node_Str","String_Node_Str");
  assertPrint("String_Node_Str","String_Node_Str");
  assertPrint("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
public void testObjectLit(){
  assertPrint("String_Node_Str","String_Node_Str");
  assertPrint("String_Node_Str","String_Node_Str");
  assertPrint("String_Node_Str","String_Node_Str");
  assertPrint("String_Node_Str","String_Node_Str");
  assertPrint("String_Node_Str","String_Node_Str");
}