nus-yam/ex-repair huggingface dataset:
Program: 19388
Project: 19388
Buggy source:
/** 
 * Checks whether the CodeReplacements have any overlap. The replacements must be provided in order sorted by start position, as sorted by ORDER_CODE_REPLACEMENTS.
 */
private static boolean containsOverlaps(List<CodeReplacement> replacements){
  Preconditions.checkState(ORDER_CODE_REPLACEMENTS.isOrdered(replacements));
  int start=-1;
  for (  CodeReplacement replacement : replacements) {
    if (replacement.getStartPosition() < start) {
      return true;
    }
    start=Math.max(start,replacement.getStartPosition() + replacement.getLength());
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Checks whether the CodeReplacements have any overlap. The replacements must be provided in order sorted by start position, as sorted by ORDER_CODE_REPLACEMENTS.
 */
private static boolean containsOverlaps(List<CodeReplacement> replacements){
  Preconditions.checkState(ORDER_CODE_REPLACEMENTS.isOrdered(replacements));
  int start=-1;
  for (  CodeReplacement replacement : replacements) {
    if (replacement.getStartPosition() < start) {
      return true;
    }
    start=Math.max(start,replacement.getEndPosition());
  }
  return false;
}
Program: 19389
Project: 19389
Buggy source:
/** 
 * Returns how many bytes the new content should replace in the original content.
 */
public int getLength(){
  return length;
}

Fixed version (ground truth):
/** 
 * Returns how many characters the new content should replace in the original content.
 */
public int getLength(){
  return length;
}
Program: 19393
Project: 19393
Buggy source:
/** 
 * Records that this property could be referenced from any interface that this type, or any type in its superclass chain, implements. If the property p is defined only on a subtype of constructor, then this method has no effect. But we tried modifying getTypeWithProperty to tell us when the returned type is a subtype, and then skip those calls to recordInterface, and there was no speed-up. And it made the code harder to understand, so we don't do it.
 */
private void recordInterfaces(FunctionType constructor,JSType relatedType,DisambiguateProperties.Property p){
  Preconditions.checkArgument(constructor.isConstructor());
  Iterable<ObjectType> interfaces=implementedInterfaces.get(constructor);
  if (interfaces == null) {
    interfaces=constructor.getImplementedInterfaces();
    implementedInterfaces.put(constructor,interfaces);
  }
  for (  ObjectType itype : interfaces) {
    JSType top=getTypeWithProperty(p.name,itype);
    if (top != null) {
      p.addType(itype,relatedType);
    }
    if (p.skipRenaming) {
      return;
    }
  }
}

Fixed version (ground truth):
/** 
 * Records that this property could be referenced from any interface that this type inherits from. If the property p is defined only on a subtype of constructor, then this method has no effect. But we tried modifying getTypeWithProperty to tell us when the returned type is a subtype, and then skip those calls to recordInterface, and there was no speed-up. And it made the code harder to understand, so we don't do it.
 */
private void recordInterfaces(FunctionType constructor,JSType relatedType,Property p){
  Iterable<ObjectType> interfaces=ancestorInterfaces.get(constructor);
  if (interfaces == null) {
    interfaces=constructor.isConstructor() ? constructor.getImplementedInterfaces() : constructor.getExtendedInterfaces();
    ancestorInterfaces.put(constructor,interfaces);
  }
  for (  ObjectType itype : interfaces) {
    JSType top=getTypeWithProperty(p.name,itype);
    if (top != null) {
      p.addType(itype,relatedType);
    }
    if (p.skipRenaming) {
      return;
    }
  }
}
Program: 19394
Project: 19394
Buggy source:
@Override public void process(Node externs,Node root){
  Preconditions.checkState(compiler.getLifeCycleStage() == LifeCycleStage.NORMALIZED);
  this.implementedInterfaces=new HashMap<>();
  this.gtwpCache=new HashMap<>();
  for (  TypeMismatch mis : compiler.getTypeMismatches()) {
    recordInvalidatingType(mis.typeA,mis.src);
    recordInvalidatingType(mis.typeB,mis.src);
  }
  for (  TypeMismatch mis : compiler.getImplicitInterfaceUses()) {
    recordInvalidatingType(mis.typeA,mis.src);
    recordInvalidatingType(mis.typeB,mis.src);
  }
  NodeTraversal.traverseEs6(compiler,externs,new FindExternProperties());
  NodeTraversal.traverseEs6(compiler,root,new FindRenameableProperties());
  renameProperties();
}

Fixed version (ground truth):
@Override public void process(Node externs,Node root){
  Preconditions.checkState(compiler.getLifeCycleStage() == LifeCycleStage.NORMALIZED);
  this.ancestorInterfaces=new HashMap<>();
  this.gtwpCache=new HashMap<>();
  for (  TypeMismatch mis : compiler.getTypeMismatches()) {
    recordInvalidatingType(mis.typeA,mis.src);
    recordInvalidatingType(mis.typeB,mis.src);
  }
  for (  TypeMismatch mis : compiler.getImplicitInterfaceUses()) {
    recordInvalidatingType(mis.typeA,mis.src);
    recordInvalidatingType(mis.typeB,mis.src);
  }
  NodeTraversal.traverseEs6(compiler,externs,new FindExternProperties());
  NodeTraversal.traverseEs6(compiler,root,new FindRenameableProperties());
  renameProperties();
}
Program: 19395
Project: 19395
Buggy source:
private FunctionType getConstructor(JSType type){
  ObjectType objType=ObjectType.cast(type);
  if (objType == null) {
    return null;
  }
  FunctionType constructor=null;
  if (objType.isFunctionType()) {
    constructor=objType.toMaybeFunctionType();
  }
 else   if (objType.isFunctionPrototypeType()) {
    constructor=objType.getOwnerFunction();
  }
 else {
    constructor=objType.getConstructor();
  }
  return constructor != null && constructor.isConstructor() ? constructor : null;
}

Fixed version (ground truth):
private FunctionType getConstructor(JSType type){
  ObjectType objType=ObjectType.cast(type);
  if (objType == null) {
    return null;
  }
  FunctionType constructor=null;
  if (objType.isFunctionType()) {
    constructor=objType.toMaybeFunctionType();
  }
 else   if (objType.isFunctionPrototypeType()) {
    constructor=objType.getOwnerFunction();
  }
 else {
    constructor=objType.getConstructor();
  }
  return constructor;
}
Program: 19396
Project: 19396
Buggy source:
/** 
 * Returns the alternatives if this is a type that represents multiple types, and null if not. Union and interface types can correspond to multiple other types.
 */
private Iterable<JSType> getTypeAlternatives(JSType type){
  if (type.isUnionType()) {
    return type.toMaybeUnionType().getAlternatesWithoutStructuralTyping();
  }
 else {
    ObjectType objType=type.toObjectType();
    if (objType != null && objType.getConstructor() != null && objType.getConstructor().isInterface()) {
      List<JSType> list=new ArrayList<>();
      for (      FunctionType impl : registry.getDirectImplementors(objType)) {
        list.add(impl.getInstanceType());
      }
      return list;
    }
 else {
      return null;
    }
  }
}

Fixed version (ground truth):
/** 
 * Returns the alternatives if this is a type that represents multiple types, and null if not. Union and interface types can correspond to multiple other types.
 */
private Iterable<JSType> getTypeAlternatives(JSType type){
  if (type.isUnionType()) {
    return type.toMaybeUnionType().getAlternatesWithoutStructuralTyping();
  }
 else {
    ObjectType objType=type.toObjectType();
    if (objType != null && objType.getConstructor() != null && objType.getConstructor().isInterface()) {
      List<JSType> list=new ArrayList<>();
      for (      FunctionType impl : registry.getDirectImplementors(objType)) {
        list.add(impl.getInstanceType());
      }
      return list.isEmpty() ? null : list;
    }
 else {
      return null;
    }
  }
}
Program: 19397
Project: 19397
Buggy source:
/** 
 * Traverse a node and its children and remove any references to from the structures.
 */
void removeReferences(Node node){
  if (DefinitionsRemover.isDefinitionNode(node)) {
    DefinitionSite defSite=definitionNodeByDefinitionSite.get(node);
    if (defSite != null) {
      Definition def=defSite.definition;
      String name=getSimplifiedName(def.getLValue());
      if (name != null) {
        this.definitionNodeByDefinitionSite.remove(node);
        this.nameDefinitionMultimap.remove(name,node);
      }
    }
  }
 else {
    Node useSite=node;
    if (useSite.isGetProp()) {
      String propName=useSite.getLastChild().getString();
      if (propName.equals("String_Node_Str") || propName.equals("String_Node_Str")) {
        useSite=useSite.getFirstChild();
      }
    }
    String name=getSimplifiedName(useSite);
    if (name != null) {
      this.nameUseSiteMultimap.remove(name,new UseSite(useSite,null,null));
    }
  }
  for (  Node child : node.children()) {
    removeReferences(child);
  }
}

Fixed version (ground truth):
/** 
 * Traverse a node and its children and remove any references to from the structures.
 */
void removeReferences(Node node){
  if (DefinitionsRemover.isDefinitionNode(node)) {
    DefinitionSite defSite=definitionNodeByDefinitionSite.get(node);
    if (defSite != null) {
      Definition def=defSite.definition;
      String name=getSimplifiedName(def.getLValue());
      if (name != null) {
        this.definitionNodeByDefinitionSite.remove(node);
        this.nameDefinitionMultimap.remove(name,def);
      }
    }
  }
 else {
    Node useSite=node;
    if (useSite.isGetProp()) {
      String propName=useSite.getLastChild().getString();
      if (propName.equals("String_Node_Str") || propName.equals("String_Node_Str")) {
        useSite=useSite.getFirstChild();
      }
    }
    String name=getSimplifiedName(useSite);
    if (name != null) {
      this.nameUseSiteMultimap.remove(name,new UseSite(useSite,null,null));
    }
  }
  for (  Node child : node.children()) {
    removeReferences(child);
  }
}
Program: 19399
Project: 19399
Buggy source:
public static RawNominalType makeStructuralInterface(JSTypes commonTypes,Node defSite,String name,ImmutableList<String> typeParameters){
  return new RawNominalType(commonTypes,defSite,name,typeParameters,Kind.RECORD,ObjectKind.UNRESTRICTED);
}

Fixed version (ground truth):
public static RawNominalType makeStructuralInterface(JSTypes commonTypes,Node defSite,String name,ImmutableList<String> typeParameters,ObjectKind objKind){
  if (objKind == ObjectKind.DICT) {
    objKind=ObjectKind.UNRESTRICTED;
  }
  return new RawNominalType(commonTypes,defSite,name,typeParameters,Kind.RECORD,objKind);
}
Program: 19400
Project: 19400
Buggy source:
public static RawNominalType makeNominalInterface(JSTypes commonTypes,Node defSite,String name,ImmutableList<String> typeParameters){
  return new RawNominalType(commonTypes,defSite,name,typeParameters,Kind.INTERFACE,ObjectKind.UNRESTRICTED);
}

Fixed version (ground truth):
public static RawNominalType makeNominalInterface(JSTypes commonTypes,Node defSite,String name,ImmutableList<String> typeParameters,ObjectKind objKind){
  if (objKind == ObjectKind.DICT) {
    objKind=ObjectKind.UNRESTRICTED;
  }
  return new RawNominalType(commonTypes,defSite,name,typeParameters,Kind.INTERFACE,objKind);
}
Program: 19401
Project: 19401
Buggy source:
public void testMisplacedStructDictAnnotation(){
  typeCheck("String_Node_Str",GlobalTypeInfo.STRUCTDICT_WITHOUT_CTOR);
  typeCheck("String_Node_Str",GlobalTypeInfo.STRUCTDICT_WITHOUT_CTOR);
}

Fixed version (ground truth):
public void testMisplacedStructDictAnnotation(){
  typeCheck("String_Node_Str",GlobalTypeInfo.STRUCT_WITHOUT_CTOR_OR_INTERF);
  typeCheck("String_Node_Str",GlobalTypeInfo.DICT_WITHOUT_CTOR);
  typeCheck("String_Node_Str",GlobalTypeInfo.DICT_WITHOUT_CTOR);
}
Program: 19403
Project: 19403
Buggy source:
static ObjectType join(ObjectType obj1,ObjectType obj2){
  if (obj1.isTopObject() || obj2.isTopObject()) {
    return obj1.commonTypes.TOP_OBJECTTYPE;
  }
  NominalType nom1=obj1.nominalType;
  NominalType nom2=obj2.nominalType;
  Preconditions.checkState(nom1 == null || nom2 == null || nom1.isRawSubtypeOf(nom2) || nom2.isRawSubtypeOf(nom1));
  if (obj1.equals(obj2)) {
    return obj1;
  }
  JSTypes commonTypes=obj1.commonTypes;
  boolean isLoose=obj1.isLoose || obj2.isLoose;
  FunctionType fn=FunctionType.join(obj1.fn,obj2.fn);
  PersistentMap<String,Property> props;
  if (isLoose) {
    fn=fn == null ? null : fn.withLoose();
    props=joinPropsLoosely(commonTypes,obj1.props,obj2.props);
  }
 else {
    props=joinProps(obj1.props,obj2.props,nom1,nom2);
  }
  NominalType nominal=NominalType.pickSuperclass(nom1,nom2);
  if (nominal == null || !nominal.isFunction()) {
    fn=null;
  }
  Namespace ns=Objects.equals(obj1.ns,obj2.ns) ? obj1.ns : null;
  return makeObjectType(commonTypes,nominal,props,fn,ns,isLoose,ObjectKind.join(obj1.objectKind,obj2.objectKind));
}

Fixed version (ground truth):
static ObjectType join(ObjectType obj1,ObjectType obj2){
  if ((obj1.isTopObject() && obj2.props.isEmpty()) || (obj2.isTopObject() && obj1.props.isEmpty())) {
    return obj1.commonTypes.TOP_OBJECTTYPE;
  }
  NominalType nom1=obj1.nominalType;
  NominalType nom2=obj2.nominalType;
  Preconditions.checkState(nom1 == null || nom2 == null || nom1.isRawSubtypeOf(nom2) || nom2.isRawSubtypeOf(nom1));
  if (obj1.equals(obj2)) {
    return obj1;
  }
  JSTypes commonTypes=obj1.commonTypes;
  boolean isLoose=obj1.isLoose || obj2.isLoose;
  FunctionType fn=FunctionType.join(obj1.fn,obj2.fn);
  PersistentMap<String,Property> props;
  if (isLoose) {
    fn=fn == null ? null : fn.withLoose();
    props=joinPropsLoosely(commonTypes,obj1.props,obj2.props);
  }
 else {
    props=joinProps(obj1.props,obj2.props,nom1,nom2);
  }
  NominalType nominal=NominalType.pickSuperclass(nom1,nom2);
  if (nominal == null || !nominal.isFunction()) {
    fn=null;
  }
  Namespace ns=Objects.equals(obj1.ns,obj2.ns) ? obj1.ns : null;
  return makeObjectType(commonTypes,nominal,props,fn,ns,isLoose,ObjectKind.join(obj1.objectKind,obj2.objectKind));
}
Program: 19404
Project: 19404
Buggy source:
public void testJoinWithTopObject(){
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str"));
}

Fixed version (ground truth):
public void testJoinWithTopObject(){
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str"));
  typeCheck(LINE_JOINER.join("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"));
}
Program: 19405
Project: 19405
Buggy source:
@Override public final void visit(NodeTraversal nodeTraversal,Node n,Node parent){
  if (n.isCall() && parent.isExprResult() && n.getFirstChild().matchesQualifiedName(closureFunction)) {
    calls.add(parent);
  }
 else   if (NodeUtil.isNameDeclaration(parent) && n.getLastChild().getFirstChild().matchesQualifiedName(closureFunction)) {
    Preconditions.checkState(n.isName() || n.isDestructuringLhs());
    calls.add(parent);
  }
}

Fixed version (ground truth):
@Override public final void visit(NodeTraversal nodeTraversal,Node n,Node parent){
  if (n.isCall() && parent.isExprResult() && n.getFirstChild().matchesQualifiedName(closureFunction)) {
    calls.add(parent);
  }
 else   if (NodeUtil.isNameDeclaration(parent) && n.hasChildren() && n.getLastChild().isCall()&& n.getLastChild().getFirstChild().matchesQualifiedName(closureFunction)) {
    Preconditions.checkState(n.isName() || n.isDestructuringLhs());
    calls.add(parent);
  }
}
Program: 19406
Project: 19406
Buggy source:
public void testDoWhileLoopBranch() throws Exception {
  compareDoWhileLoopBranch(LanguageMode.ECMASCRIPT6);
}

Fixed version (ground truth):
public void testDoWhileLoopBranch() throws Exception {
  compareDoWhileLoopBranch(LanguageMode.ECMASCRIPT5);
  compareDoWhileLoopBranch(LanguageMode.ECMASCRIPT6);
}
Program: 19407
Project: 19407
Buggy source:
public void testDoWhileLoopMultiLineBranch() throws Exception {
  compareDoWhileLoopBranch(LanguageMode.ECMASCRIPT6);
}

Fixed version (ground truth):
public void testDoWhileLoopMultiLineBranch() throws Exception {
  compareDoWhileLoopMultiLineBranch(LanguageMode.ECMASCRIPT5);
  compareDoWhileLoopMultiLineBranch(LanguageMode.ECMASCRIPT6);
}
Program: 19408
Project: 19408
Buggy source:
/** 
 * Normalize the type of a constructor, its instance, and its prototype all down to the same type (the instance type).
 */
private static TypeI normalizeClassType(TypeI type){
  if (type == null || type.isUnknownType()) {
    return type;
  }
 else   if (type.isConstructor() || type.isInterface()) {
    return type.toMaybeFunctionType().getInstanceType();
  }
 else   if (type.isPrototypeObject()) {
    Preconditions.checkState(type instanceof ObjectType);
    FunctionType owner=((ObjectType)type).getOwnerFunction();
    if (owner.isConstructor()) {
      return owner.getInstanceType();
    }
  }
  return type;
}

Fixed version (ground truth):
/** 
 * Normalize the type of a constructor, its instance, and its prototype all down to the same type (the instance type).
 */
private static TypeI normalizeClassType(TypeI type){
  if (type == null || type.isUnknownType()) {
    return type;
  }
 else   if (type.isConstructor() || type.isInterface()) {
    return type.toMaybeFunctionType().getInstanceType();
  }
 else {
    ObjectTypeI obj=type.toMaybeObjectType();
    if (obj != null) {
      return obj.normalizeObjectForCheckAccessControls();
    }
  }
  return type;
}
Program: 19409
Project: 19409
Buggy source:
private void fixLineNumbers(Node expr){
  expr.setLineno(expr.getLineno() + templateLineno - 1);
  for (  Node child : expr.children()) {
    fixLineNumbers(child);
  }
}

Fixed version (ground truth):
private void fixLineNumbers(Node expr){
  expr.setLineno(expr.getLineno() + templateLineno);
  for (  Node child : expr.children()) {
    fixLineNumbers(child);
  }
}
Program: 19410
Project: 19410
Buggy source:
private ParseTree parseCoverParenthesizedExpressionAndArrowParameterList(){
  if (peekType(1) == TokenType.FOR) {
    return parseGeneratorComprehension();
  }
  SourcePosition start=getTreeStartLocation();
  eat(TokenType.OPEN_PAREN);
  if (peek(TokenType.CLOSE_PAREN)) {
    eat(TokenType.CLOSE_PAREN);
    return new FormalParameterListTree(getTreeLocation(start),ImmutableList.<ParseTree>of());
  }
  if (peek(TokenType.SPREAD)) {
    ParseTree result=new FormalParameterListTree(getTreeLocation(start),ImmutableList.of(parseParameter(ParamContext.IMPLEMENTATION)));
    eat(TokenType.CLOSE_PAREN);
    return result;
  }
  ParseTree result=parseExpression();
  if (peek(TokenType.COMMA)) {
    eat(TokenType.COMMA);
    result=new CommaExpressionTree(getTreeLocation(start),ImmutableList.of(result,parseParameter(ParamContext.IMPLEMENTATION)));
  }
  eat(TokenType.CLOSE_PAREN);
  return new ParenExpressionTree(getTreeLocation(start),result);
}

Fixed version (ground truth):
private ParseTree parseCoverParenthesizedExpressionAndArrowParameterList(){
  if (peekType(1) == TokenType.FOR) {
    return parseGeneratorComprehension();
  }
  SourcePosition start=getTreeStartLocation();
  eat(TokenType.OPEN_PAREN);
  if (peek(TokenType.CLOSE_PAREN)) {
    eat(TokenType.CLOSE_PAREN);
    if (peek(TokenType.ARROW)) {
      return new FormalParameterListTree(getTreeLocation(start),ImmutableList.<ParseTree>of());
    }
 else {
      reportError("String_Node_Str");
      return new MissingPrimaryExpressionTree(getTreeLocation(start));
    }
  }
  if (peek(TokenType.SPREAD)) {
    ImmutableList<ParseTree> params=ImmutableList.of(parseParameter(ParamContext.IMPLEMENTATION));
    eat(TokenType.CLOSE_PAREN);
    if (peek(TokenType.ARROW)) {
      return new FormalParameterListTree(getTreeLocation(start),params);
    }
 else {
      reportError("String_Node_Str");
      return new MissingPrimaryExpressionTree(getTreeLocation(start));
    }
  }
  ParseTree result=parseExpression();
  if (peek(TokenType.COMMA)) {
    eat(TokenType.COMMA);
    result=new CommaExpressionTree(getTreeLocation(start),ImmutableList.of(result,parseParameter(ParamContext.IMPLEMENTATION)));
  }
  eat(TokenType.CLOSE_PAREN);
  return new ParenExpressionTree(getTreeLocation(start),result);
}
Program: 19411
Project: 19411
Buggy source:
private ParseTree parseAssignment(Expression expressionIn){
  if (peek(TokenType.YIELD) && inGeneratorContext()) {
    return parseYield(expressionIn);
  }
  SourcePosition start=getTreeStartLocation();
  ParseTree left=parseConditional(expressionIn);
  if (peek(TokenType.ARROW)) {
    return completeAssignmentExpressionParseAtArrow(left,expressionIn);
  }
  if (left.type == ParseTreeType.FORMAL_PARAMETER_LIST) {
    reportError("String_Node_Str");
  }
  if (peekAssignmentOperator()) {
    left=transformLeftHandSideExpression(left);
    if (!left.isValidAssignmentTarget()) {
      reportError("String_Node_Str");
    }
    Token operator=nextToken();
    if (TokenType.STAR_STAR_EQUAL.equals(operator.type)) {
      features=features.require(Feature.EXPONENT_OP);
    }
    ParseTree right=parseAssignment(expressionIn);
    return new BinaryOperatorTree(getTreeLocation(start),left,operator,right);
  }
  return left;
}

Fixed version (ground truth):
private ParseTree parseAssignment(Expression expressionIn){
  if (peek(TokenType.YIELD) && inGeneratorContext()) {
    return parseYield(expressionIn);
  }
  SourcePosition start=getTreeStartLocation();
  ParseTree left=parseConditional(expressionIn);
  if (peek(TokenType.ARROW)) {
    return completeAssignmentExpressionParseAtArrow(left,expressionIn);
  }
  if (peekAssignmentOperator()) {
    left=transformLeftHandSideExpression(left);
    if (!left.isValidAssignmentTarget()) {
      reportError("String_Node_Str");
    }
    Token operator=nextToken();
    if (TokenType.STAR_STAR_EQUAL.equals(operator.type)) {
      features=features.require(Feature.EXPONENT_OP);
    }
    ParseTree right=parseAssignment(expressionIn);
    return new BinaryOperatorTree(getTreeLocation(start),left,operator,right);
  }
  return left;
}
Program: 19413
Project: 19413
Buggy source:
protected CodeGenerator(CodeConsumer consumer,CompilerOptions options){
  cc=consumer;
  this.outputCharsetEncoder=new OutputCharsetEncoder(options.getOutputCharset());
  this.preferSingleQuotes=options.preferSingleQuotes;
  this.trustedStrings=options.trustedStrings;
  this.preserveTypeAnnotations=options.preserveTypeAnnotations;
  this.quoteKeywordProperties=options.quoteKeywordProperties;
  this.outputAsExterns=options.shouldGenerateTypedExterns();
  this.useOriginalName=options.getUseOriginalNamesInOutput();
}

Fixed version (ground truth):
protected CodeGenerator(CodeConsumer consumer,CompilerOptions options){
  cc=consumer;
  this.outputCharsetEncoder=new OutputCharsetEncoder(options.getOutputCharset());
  this.preferSingleQuotes=options.preferSingleQuotes;
  this.trustedStrings=options.trustedStrings;
  this.preserveTypeAnnotations=options.preserveTypeAnnotations;
  this.quoteKeywordProperties=options.quoteKeywordProperties;
  this.outputAsExterns=options.shouldGenerateTypedExterns();
  this.useOriginalName=options.getUseOriginalNamesInOutput();
  this.jsDocInfoPrinter=new JSDocInfoPrinter(useOriginalName);
}
Program: 19414
Project: 19414
Buggy source:
private static String buildAnnotationWithType(String annotation,Node type){
  StringBuilder sb=new StringBuilder();
  sb.append("String_Node_Str");
  sb.append(annotation);
  sb.append("String_Node_Str");
  appendTypeNode(sb,type);
  sb.append("String_Node_Str");
  return sb.toString();
}

Fixed version (ground truth):
private String buildAnnotationWithType(String annotation,Node type){
  StringBuilder sb=new StringBuilder();
  sb.append("String_Node_Str");
  sb.append(annotation);
  sb.append("String_Node_Str");
  appendTypeNode(sb,type);
  sb.append("String_Node_Str");
  return sb.toString();
}
Program: 19415
Project: 19415
Buggy source:
private static String typeNode(Node typeNode){
  StringBuilder sb=new StringBuilder();
  appendTypeNode(sb,typeNode);
  return sb.toString();
}

Fixed version (ground truth):
private String typeNode(Node typeNode){
  StringBuilder sb=new StringBuilder();
  appendTypeNode(sb,typeNode);
  return sb.toString();
}
Program: 19417
Project: 19417
Buggy source:
private static Node stripBang(Node typeNode){
  if (typeNode.getToken() == Token.BANG) {
    typeNode=typeNode.getFirstChild();
  }
  return typeNode;
}

Fixed version (ground truth):
private Node stripBang(Node typeNode){
  if (typeNode.getToken() == Token.BANG) {
    typeNode=typeNode.getFirstChild();
  }
  return typeNode;
}
Program: 19418
Project: 19418
Buggy source:
private static String buildParamType(String name,JSTypeExpression type){
  if (type != null) {
    return "String_Node_Str" + typeNode(type.getRoot()) + "String_Node_Str"+ name;
  }
 else {
    return name;
  }
}

Fixed version (ground truth):
private String buildParamType(String name,JSTypeExpression type){
  if (type != null) {
    return "String_Node_Str" + typeNode(type.getRoot()) + "String_Node_Str"+ name;
  }
 else {
    return name;
  }
}
Program: 19419
Project: 19419
Buggy source:
private static void appendFunctionNode(StringBuilder sb,Node function){
  boolean hasNewOrThis=false;
  sb.append("String_Node_Str");
  Node first=function.getFirstChild();
  if (first.isNew()) {
    sb.append("String_Node_Str");
    appendTypeNode(sb,first.getFirstChild());
    hasNewOrThis=true;
  }
 else   if (first.isThis()) {
    sb.append("String_Node_Str");
    appendTypeNode(sb,first.getFirstChild());
    hasNewOrThis=true;
  }
 else   if (first.isEmpty()) {
    sb.append("String_Node_Str");
    return;
  }
 else   if (!first.isParamList()) {
    sb.append("String_Node_Str");
    appendTypeNode(sb,first);
    return;
  }
  Node paramList=null;
  if (first.isParamList()) {
    paramList=first;
  }
 else   if (first.getNext().isParamList()) {
    paramList=first.getNext();
  }
  if (paramList != null) {
    boolean firstParam=true;
    for (    Node param : paramList.children()) {
      if (!firstParam || hasNewOrThis) {
        sb.append("String_Node_Str");
      }
      appendTypeNode(sb,param);
      firstParam=false;
    }
  }
  sb.append("String_Node_Str");
  Node returnType=function.getLastChild();
  if (!returnType.isEmpty()) {
    sb.append("String_Node_Str");
    appendTypeNode(sb,returnType);
  }
}

Fixed version (ground truth):
private void appendFunctionNode(StringBuilder sb,Node function){
  boolean hasNewOrThis=false;
  sb.append("String_Node_Str");
  Node first=function.getFirstChild();
  if (first.isNew()) {
    sb.append("String_Node_Str");
    appendTypeNode(sb,first.getFirstChild());
    hasNewOrThis=true;
  }
 else   if (first.isThis()) {
    sb.append("String_Node_Str");
    appendTypeNode(sb,first.getFirstChild());
    hasNewOrThis=true;
  }
 else   if (first.isEmpty()) {
    sb.append("String_Node_Str");
    return;
  }
 else   if (!first.isParamList()) {
    sb.append("String_Node_Str");
    appendTypeNode(sb,first);
    return;
  }
  Node paramList=null;
  if (first.isParamList()) {
    paramList=first;
  }
 else   if (first.getNext().isParamList()) {
    paramList=first.getNext();
  }
  if (paramList != null) {
    boolean firstParam=true;
    for (    Node param : paramList.children()) {
      if (!firstParam || hasNewOrThis) {
        sb.append("String_Node_Str");
      }
      appendTypeNode(sb,param);
      firstParam=false;
    }
  }
  sb.append("String_Node_Str");
  Node returnType=function.getLastChild();
  if (!returnType.isEmpty()) {
    sb.append("String_Node_Str");
    appendTypeNode(sb,returnType);
  }
}
Program: 19421
Project: 19421
Buggy source:
private void fixTypeNode(Node typeNode){
  if (typeNode.isString()) {
    String name=typeNode.getString();
    int endIndex=name.indexOf('.');
    if (endIndex == -1) {
      endIndex=name.length();
    }
    String baseName=name.substring(0,endIndex);
    Var aliasVar=aliases.get(baseName);
    if (aliasVar != null) {
      aliasUsages.add(new AliasedTypeNode(aliasVar,typeNode));
    }
  }
  for (Node child=typeNode.getFirstChild(); child != null; child=child.getNext()) {
    fixTypeNode(child);
  }
}

Fixed version (ground truth):
private void fixTypeNode(Node typeNode){
  if (typeNode.isString()) {
    String name=typeNode.getString();
    int endIndex=name.indexOf('.');
    if (endIndex == -1) {
      endIndex=name.length();
    }
    String baseName=name.substring(0,endIndex);
    Var aliasVar=aliases.get(baseName);
    if (aliasVar != null) {
      aliasUsages.add(new AliasedTypeNode(aliasVar,typeNode));
    }
    if (compiler.getOptions().preservesDetailedSourceInfo()) {
      typeNode.setOriginalName(name);
    }
  }
  for (Node child=typeNode.getFirstChild(); child != null; child=child.getNext()) {
    fixTypeNode(child);
  }
}
Program: 19422
Project: 19422
Buggy source:
@Override public void visit(NodeTraversal t,Node n,Node parent){
  if (isCallToScopeMethod(n)) {
    validateScopeCall(t,n,n.getParent());
  }
  if (!inGoogScopeBody()) {
    return;
  }
  Token type=n.getToken();
  boolean isObjLitShorthand=type == Token.STRING_KEY && !n.hasChildren();
  Var aliasVar=null;
  if (type == Token.NAME || isObjLitShorthand) {
    String name=n.getString();
    Var lexicalVar=t.getScope().getVar(name);
    if (lexicalVar != null && lexicalVar == aliases.get(name)) {
      aliasVar=lexicalVar;
    }
  }
  if (isGoogScopeFunctionBody(t.getEnclosingFunction().getLastChild())) {
    if (aliasVar != null && !isObjLitShorthand && NodeUtil.isLValue(n)) {
      if (aliasVar.getNode() == n) {
        aliasDefinitionsInOrder.add(n);
        return;
      }
 else {
        report(t,n,GOOG_SCOPE_ALIAS_REDEFINED,n.getString());
      }
    }
    if (type == Token.RETURN) {
      report(t,n,GOOG_SCOPE_USES_RETURN);
    }
 else     if (type == Token.THIS) {
      report(t,n,GOOG_SCOPE_REFERENCES_THIS);
    }
 else     if (type == Token.THROW) {
      report(t,n,GOOG_SCOPE_USES_THROW);
    }
  }
  if (inGoogScopeBody()) {
    if (aliasVar != null) {
      aliasUsages.add(new AliasedNode(aliasVar,n));
    }
    JSDocInfo info=n.getJSDocInfo();
    if (info != null && !injectedDecls.contains(n)) {
      for (      Node node : info.getTypeNodes()) {
        fixTypeNode(node);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void visit(NodeTraversal t,Node n,Node parent){
  if (isCallToScopeMethod(n)) {
    validateScopeCall(t,n,n.getParent());
  }
  if (!inGoogScopeBody()) {
    return;
  }
  Token type=n.getToken();
  boolean isObjLitShorthand=type == Token.STRING_KEY && !n.hasChildren();
  Var aliasVar=null;
  if (type == Token.NAME || isObjLitShorthand) {
    String name=n.getString();
    Var lexicalVar=t.getScope().getVar(name);
    if (lexicalVar != null && lexicalVar == aliases.get(name)) {
      aliasVar=lexicalVar;
      if (compiler.getOptions().preservesDetailedSourceInfo() && n.isName()) {
        n.setOriginalName(name);
      }
    }
  }
  if (isGoogScopeFunctionBody(t.getEnclosingFunction().getLastChild())) {
    if (aliasVar != null && !isObjLitShorthand && NodeUtil.isLValue(n)) {
      if (aliasVar.getNode() == n) {
        aliasDefinitionsInOrder.add(n);
        return;
      }
 else {
        report(t,n,GOOG_SCOPE_ALIAS_REDEFINED,n.getString());
      }
    }
    if (type == Token.RETURN) {
      report(t,n,GOOG_SCOPE_USES_RETURN);
    }
 else     if (type == Token.THIS) {
      report(t,n,GOOG_SCOPE_REFERENCES_THIS);
    }
 else     if (type == Token.THROW) {
      report(t,n,GOOG_SCOPE_USES_THROW);
    }
  }
  if (inGoogScopeBody()) {
    if (aliasVar != null) {
      aliasUsages.add(new AliasedNode(aliasVar,n));
    }
    JSDocInfo info=n.getJSDocInfo();
    if (info != null && !injectedDecls.contains(n)) {
      for (      Node node : info.getTypeNodes()) {
        fixTypeNode(node);
      }
    }
  }
}
Program: 19423
Project: 19423
Buggy source:
@Override protected void add(Node n,Context context){
  Node parent=n.getParent();
  if (parent != null && (parent.isBlock() || parent.isScript())) {
    if (n.isFunction()) {
      add(getFunctionAnnotation(n));
    }
 else     if (n.isExprResult() && n.getFirstChild().isAssign()) {
      Node assign=n.getFirstChild();
      if (NodeUtil.isNamespaceDecl(assign.getFirstChild())) {
        add(JSDocInfoPrinter.print(assign.getJSDocInfo()));
      }
 else {
        Node rhs=assign.getLastChild();
        add(getTypeAnnotation(rhs));
      }
    }
 else     if (n.isVar() && n.getFirstFirstChild() != null) {
      if (NodeUtil.isNamespaceDecl(n.getFirstChild())) {
        add(JSDocInfoPrinter.print(n.getJSDocInfo()));
      }
 else {
        add(getTypeAnnotation(n.getFirstFirstChild()));
      }
    }
  }
  super.add(n,context);
}

Fixed version (ground truth):
@Override protected void add(Node n,Context context){
  Node parent=n.getParent();
  if (parent != null && (parent.isBlock() || parent.isScript())) {
    if (n.isFunction()) {
      add(getFunctionAnnotation(n));
    }
 else     if (n.isExprResult() && n.getFirstChild().isAssign()) {
      Node assign=n.getFirstChild();
      if (NodeUtil.isNamespaceDecl(assign.getFirstChild())) {
        add(jsDocInfoPrinter.print(assign.getJSDocInfo()));
      }
 else {
        Node rhs=assign.getLastChild();
        add(getTypeAnnotation(rhs));
      }
    }
 else     if (n.isVar() && n.getFirstFirstChild() != null) {
      if (NodeUtil.isNamespaceDecl(n.getFirstChild())) {
        add(jsDocInfoPrinter.print(n.getJSDocInfo()));
      }
 else {
        add(getTypeAnnotation(n.getFirstFirstChild()));
      }
    }
  }
  super.add(n,context);
}
Program: 19424
Project: 19424
Buggy source:
TypedCodeGenerator(CodeConsumer consumer,CompilerOptions options,TypeIRegistry registry){
  super(consumer,options);
  Preconditions.checkNotNull(registry);
  this.registry=registry;
}

Fixed version (ground truth):
TypedCodeGenerator(CodeConsumer consumer,CompilerOptions options,TypeIRegistry registry){
  super(consumer,options);
  Preconditions.checkNotNull(registry);
  this.registry=registry;
  this.jsDocInfoPrinter=new JSDocInfoPrinter(options.getUseOriginalNamesInOutput());
}
Program: 19425
Project: 19425
Buggy source:
@Override public boolean isUnresolved(){
  return isUnknown();
}

Fixed version (ground truth):
@Override public boolean isUnresolved(){
  return false;
}
Program: 19426
Project: 19426
Buggy source:
public void testCustomBanUnresolvedType(){
  configuration="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  this.mode=TypeInferenceMode.OTI_ONLY;
  testSame(EXTERNS,"String_Node_Str" + "String_Node_Str",CheckConformance.CONFORMANCE_VIOLATION,"String_Node_Str");
}

Fixed version (ground truth):
public void testCustomBanUnresolvedType(){
  configuration="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  this.mode=TypeInferenceMode.OTI_ONLY;
  testSame(EXTERNS,"String_Node_Str" + "String_Node_Str",CheckConformance.CONFORMANCE_VIOLATION,"String_Node_Str");
  this.mode=TypeInferenceMode.BOTH;
  testSame(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
}
Program: 19427
Project: 19427
Buggy source:
/** 
 * Creates a SuggestedFix for the given error. Note that some errors have multiple fixes so getFixesForJsError should often be used instead of this.
 */
public static SuggestedFix getFixForJsError(JSError error,AbstractCompiler compiler){
switch (error.getType().key) {
case "String_Node_Str":
    return getFixForMissingSemicolon(error,compiler);
case "String_Node_Str":
  return getFixForUnsortedRequiresOrProvides("String_Node_Str",error,compiler);
case "String_Node_Str":
return getFixForUnsortedRequiresOrProvides("String_Node_Str",error,compiler);
case "String_Node_Str":
case "String_Node_Str":
return removeNode(error,compiler);
case "String_Node_Str":
return getFixForInexistentProperty(error,compiler);
case "String_Node_Str":
return getFixForMissingSuper(error,compiler);
case "String_Node_Str":
return getFixForInvalidSuper(error,compiler);
case "String_Node_Str":
case "String_Node_Str":
return getFixForMissingRequire(error,compiler);
case "String_Node_Str":
return getFixForExtraRequire(error,compiler,DUPLICATE_REQUIRE);
case "String_Node_Str":
return getFixForExtraRequire(error,compiler,EXTRA_REQUIRE);
default :
return null;
}
}

Fixed version (ground truth):
/** 
 * Creates a SuggestedFix for the given error. Note that some errors have multiple fixes so getFixesForJsError should often be used instead of this.
 */
public static SuggestedFix getFixForJsError(JSError error,AbstractCompiler compiler){
switch (error.getType().key) {
case "String_Node_Str":
    return getFixForMissingSemicolon(error,compiler);
case "String_Node_Str":
  return getFixForUnsortedRequiresOrProvides("String_Node_Str",error,compiler);
case "String_Node_Str":
return getFixForUnsortedRequiresOrProvides("String_Node_Str",error,compiler);
case "String_Node_Str":
case "String_Node_Str":
return removeNode(error,compiler);
case "String_Node_Str":
return getFixForInexistentProperty(error,compiler);
case "String_Node_Str":
return getFixForMissingSuper(error,compiler);
case "String_Node_Str":
return getFixForInvalidSuper(error,compiler);
case "String_Node_Str":
case "String_Node_Str":
return getFixForMissingRequire(error,compiler);
case "String_Node_Str":
return getFixForExtraRequire(error,compiler,DUPLICATE_REQUIRE);
case "String_Node_Str":
return getFixForExtraRequire(error,compiler,EXTRA_REQUIRE);
case "String_Node_Str":
return getFixForReferenceToShortImportByLongName(error,compiler);
default :
return null;
}
}
Program: 19428
Project: 19428
Buggy source:
@Override public void visit(NodeTraversal t,Node n,Node parent){
switch (n.getType()) {
case FUNCTION:
    Node grandparent=parent.getParent();
  if (grandparent == null || (!isPrototypePropertyDeclaration(grandparent) && !isClassPropertyDeclaration(parent.getFirstChild(),currentScope))) {
    RawNominalType ownerType=maybeGetOwnerType(n,parent);
    visitFunctionLate(n,ownerType);
  }
break;
case NAME:
{
String name=n.getString();
if (name == null || parent.isFunction()) {
  return;
}
if (parent.isVar() || parent.isCatch()) {
  visitVar(n,parent);
}
 else if (currentScope.isOuterVarEarly(name)) {
  currentScope.addOuterVar(name);
}
 else if (currentScope.getTypedef(name) != null || !name.equals(currentScope.getName()) && !currentScope.isDefinedLocally(name,false)) {
}
break;
}
case GETPROP:
if (NodeUtil.isPropertyTest(compiler,n) || isPropertyAbsentTest(n)) {
allPropertyNames.add(n.getLastChild().getString());
}
if (parent.isExprResult() && n.isQualifiedName()) {
visitPropertyDeclaration(n);
}
break;
case ASSIGN:
{
Node lvalue=n.getFirstChild();
if (lvalue.isGetProp() && lvalue.isQualifiedName() && parent.isExprResult()) {
visitPropertyDeclaration(lvalue);
}
break;
}
case CAST:
castTypes.put(n,getDeclaredTypeOfNode(n.getJSDocInfo(),currentScope));
break;
case OBJECTLIT:
visitObjectLit(n,parent);
break;
case CALL:
visitCall(n);
break;
default :
break;
}
}

Fixed version (ground truth):
@Override public void visit(NodeTraversal t,Node n,Node parent){
switch (n.getType()) {
case FUNCTION:
    Node grandparent=parent.getParent();
  if (grandparent == null || (!isPrototypePropertyDeclaration(grandparent) && !isClassPropertyDeclaration(parent.getFirstChild(),currentScope))) {
    RawNominalType ownerType=maybeGetOwnerType(n,parent);
    visitFunctionLate(n,ownerType);
  }
break;
case NAME:
{
String name=n.getString();
if (name == null || parent.isFunction()) {
  return;
}
if (parent.isVar() || parent.isCatch()) {
  visitVar(n,parent);
}
 else if (currentScope.isOuterVarEarly(name)) {
  currentScope.addOuterVar(name);
}
 else if (currentScope.getTypedef(name) != null || !name.equals(currentScope.getName()) && !currentScope.isDefinedLocally(name,false)) {
}
break;
}
case GETPROP:
if (NodeUtil.isPropertyTest(compiler,n) || isPropertyAbsentTest(n)) {
allPropertyNames.add(n.getLastChild().getString());
}
if (parent.isExprResult() && n.isQualifiedName()) {
visitPropertyDeclaration(n);
}
break;
case ASSIGN:
{
Node lvalue=n.getFirstChild();
if (lvalue.isGetProp() && lvalue.isQualifiedName()) {
visitPropertyDeclaration(lvalue);
}
break;
}
case CAST:
castTypes.put(n,getDeclaredTypeOfNode(n.getJSDocInfo(),currentScope));
break;
case OBJECTLIT:
visitObjectLit(n,parent);
break;
case CALL:
visitCall(n);
break;
default :
break;
}
}
Program: 19429
Project: 19429
Buggy source:
boolean isPropDefinedOnSubtype(QualifiedName pname){
  Preconditions.checkArgument(pname.isIdentifier());
  return this.rawType.isPropDefinedOnSubtype(this,pname);
}

Fixed version (ground truth):
boolean isPropDefinedOnSubtype(QualifiedName pname){
  Preconditions.checkArgument(pname.isIdentifier());
  return this.rawType.isPropDefinedOnSubtype(pname.getLeftmostName());
}
Program: 19430
Project: 19430
Buggy source:
boolean isPropDefinedOnSubtype(QualifiedName pname){
  Preconditions.checkArgument(pname.isIdentifier());
  NominalType nt=getNominalType();
  Preconditions.checkState(!nt.isBuiltinObject());
  return nt.isPropDefinedOnSubtype(pname);
}

Fixed version (ground truth):
boolean isPropDefinedOnSubtype(QualifiedName pname){
  Preconditions.checkArgument(pname.isIdentifier());
  NominalType nt=getNominalType();
  return nt.isBuiltinObject() ? false : nt.isPropDefinedOnSubtype(pname);
}
Program: 19431
Project: 19431
Buggy source:
/** 
 * @return Whether the superclass can be added without creating a cycle. 
 */
public boolean addSuperClass(NominalType superclass){
  Preconditions.checkState(!this.isFinalized);
  Preconditions.checkState(this.superclass == null);
  if (superclass.hasAncestorClass(this)) {
    return false;
  }
  this.superclass=superclass;
  addSubtypeTo(superclass,this);
  return true;
}

Fixed version (ground truth):
/** 
 * @return Whether the superclass can be added without creating a cycle. 
 */
public boolean addSuperClass(NominalType superclass){
  Preconditions.checkState(!this.isFinalized);
  Preconditions.checkState(this.superclass == null);
  if (superclass.hasAncestorClass(this)) {
    return false;
  }
  this.superclass=superclass;
  superclass.getRawNominalType().addSubtype(this);
  return true;
}
Program: 19432
Project: 19432
Buggy source:
/** 
 * @return Whether the interface can be added without creating a cycle. 
 */
public boolean addInterfaces(ImmutableSet<NominalType> interfaces){
  Preconditions.checkState(!this.isFinalized);
  Preconditions.checkState(this.interfaces == null);
  Preconditions.checkNotNull(interfaces);
  if (this.isInterface()) {
    for (    NominalType interf : interfaces) {
      if (interf.hasAncestorInterface(this)) {
        this.interfaces=ImmutableSet.of();
        return false;
      }
    }
  }
  for (  NominalType interf : interfaces) {
    if (interf.getRawNominalType().inheritsFromIObjectReflexive()) {
      this.objectKind=ObjectKind.UNRESTRICTED;
    }
    addSubtypeTo(interf,this);
  }
  this.interfaces=interfaces;
  return true;
}

Fixed version (ground truth):
/** 
 * @return Whether the interface can be added without creating a cycle. 
 */
public boolean addInterfaces(ImmutableSet<NominalType> interfaces){
  Preconditions.checkState(!this.isFinalized);
  Preconditions.checkState(this.interfaces == null);
  Preconditions.checkNotNull(interfaces);
  if (this.isInterface()) {
    for (    NominalType interf : interfaces) {
      if (interf.hasAncestorInterface(this)) {
        this.interfaces=ImmutableSet.of();
        return false;
      }
    }
  }
  for (  NominalType interf : interfaces) {
    if (interf.getRawNominalType().inheritsFromIObjectReflexive()) {
      this.objectKind=ObjectKind.UNRESTRICTED;
    }
    interf.getRawNominalType().addSubtype(this);
  }
  this.interfaces=interfaces;
  return true;
}
Program: 19433
Project: 19433
Buggy source:
boolean isPropDefinedOnSubtype(NominalType thisAsNominal,QualifiedName qname){
  Preconditions.checkArgument(qname.isIdentifier());
  String pname=qname.getLeftmostName();
  for (  RawNominalType subtype : this.subtypes.get(thisAsNominal)) {
    if (subtype.mayHaveProp(pname)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
boolean isPropDefinedOnSubtype(String pname){
  if (mayHaveProp(pname)) {
    return true;
  }
  for (  RawNominalType subtype : this.subtypes) {
    if (subtype.isPropDefinedOnSubtype(pname)) {
      return true;
    }
  }
  return false;
}
Program: 19437
Project: 19437
Buggy source:
void collectPropertyNames(Set<String> props){
  Set<PropertyMap> identitySet=Sets.newIdentityHashSet();
  collectPropertyNamesHelper(props,identitySet);
}

Fixed version (ground truth):
void collectPropertyNames(Set<String> props){
  props.addAll(properties.keySet());
  PropertyMap primaryParent=getPrimaryParent();
  if (primaryParent != null) {
    primaryParent.collectPropertyNames(props);
  }
  for (  PropertyMap p : getSecondaryParents()) {
    if (p != null) {
      p.collectPropertyNames(props);
    }
  }
}
Program: 19438
Project: 19438
Buggy source:
public void testInterfaceExtendsLoop2(){
  testClosureTypes(suppressMissingProperty("String_Node_Str") + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
public void testInterfaceExtendsLoop2(){
  testClosureTypesMultipleWarnings(suppressMissingProperty("String_Node_Str") + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",ImmutableList.of("String_Node_Str" + "String_Node_Str","String_Node_Str" + "String_Node_Str"));
}
Program: 19439
Project: 19439
Buggy source:
void collectPropertyNames(Set<String> props){
  props.addAll(properties.keySet());
  PropertyMap primaryParent=getPrimaryParent();
  if (primaryParent != null) {
    primaryParent.collectPropertyNames(props);
  }
  for (  PropertyMap p : getSecondaryParents()) {
    if (p != null) {
      p.collectPropertyNames(props);
    }
  }
}

Fixed version (ground truth):
void collectPropertyNames(Set<String> props){
  Set<PropertyMap> identitySet=Sets.newIdentityHashSet();
  collectPropertyNamesHelper(props,identitySet);
}
Program: 19440
Project: 19440
Buggy source:
public void testInterfaceExtendsLoop2(){
  testClosureTypesMultipleWarnings(suppressMissingProperty("String_Node_Str") + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",ImmutableList.of("String_Node_Str" + "String_Node_Str","String_Node_Str" + "String_Node_Str"));
}

Fixed version (ground truth):
public void testInterfaceExtendsLoop2(){
  testClosureTypes(suppressMissingProperty("String_Node_Str") + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str","String_Node_Str");
}
Program: 19441
Project: 19441
Buggy source:
@Override public void visit(NodeTraversal t,Node n,Node parent){
  if (n.isExprResult()) {
    Node expr=n.getFirstChild();
    Node name=expr.isAssign() ? expr.getFirstChild() : expr;
    if (!name.isGetProp() || !name.getFirstChild().isThis()) {
      return;
    }
    JSType type=name.getJSType();
    String pname=name.getLastChild().getString();
    JSDocInfo jsdoc=NodeUtil.getBestJSDocInfo(name);
    Node initializer=null;
    if (type == null) {
      initializer=NodeUtil.getRValueOfLValue(name).detachFromParent();
    }
 else     if (isInferrableConst(jsdoc,name)) {
      jsdoc=maybeUpdateJSDocInfoWithType(jsdoc,name);
    }
    Node newProtoAssignStmt=NodeUtil.newQNameDeclaration(compiler,className + "String_Node_Str" + pname,initializer,jsdoc);
    newProtoAssignStmt.useSourceInfoIfMissingFromForTree(expr);
    insertionPoint.getParent().addChildAfter(newProtoAssignStmt,insertionPoint);
    compiler.reportCodeChange();
  }
}

Fixed version (ground truth):
@Override public void visit(NodeTraversal t,Node n,Node parent){
  if (n.isExprResult()) {
    Node expr=n.getFirstChild();
    Node name=expr.isAssign() ? expr.getFirstChild() : expr;
    if (!name.isGetProp() || !name.getFirstChild().isThis()) {
      return;
    }
    String pname=name.getLastChild().getString();
    String fullyQualifiedName=className + "String_Node_Str" + pname;
    if (seenNames.contains(fullyQualifiedName)) {
      return;
    }
    JSType type=name.getJSType();
    JSDocInfo jsdoc=NodeUtil.getBestJSDocInfo(name);
    if (jsdoc == null) {
      jsdoc=getAllTypeJSDoc();
    }
 else     if (isInferrableConst(jsdoc,name)) {
      jsdoc=maybeUpdateJSDocInfoWithType(jsdoc,name);
      if (type == null) {
        compiler.report(JSError.make(name,CONSTANT_WITHOUT_EXPLICIT_TYPE));
        return;
      }
    }
    Node newProtoAssignStmt=NodeUtil.newQNameDeclaration(compiler,fullyQualifiedName,null,jsdoc);
    newProtoAssignStmt.useSourceInfoIfMissingFromForTree(expr);
    insertionPoint.getParent().addChildAfter(newProtoAssignStmt,insertionPoint);
    compiler.reportCodeChange();
    seenNames.add(fullyQualifiedName);
  }
}