nus-yam/ex-repair huggingface dataset:
Program: 28160
Project: 28160
Buggy source:
/** 
 * Gets the value of a node as a Number, or null if it cannot be converted. When it returns a non-null Double, this method effectively emulates the <code>Number()</code> JavaScript cast function.
 */
static Double getNumberValue(Node n){
switch (n.getType()) {
case Token.TRUE:
    return 1.0;
case Token.FALSE:
case Token.NULL:
  return 0.0;
case Token.NUMBER:
return n.getDouble();
case Token.VOID:
if (mayHaveSideEffects(n.getFirstChild())) {
return null;
}
 else {
return Double.NaN;
}
case Token.NAME:
String name=n.getString();
if (name.equals("String_Node_Str")) {
return Double.NaN;
}
if (name.equals("String_Node_Str")) {
return Double.NaN;
}
if (name.equals("String_Node_Str")) {
return Double.POSITIVE_INFINITY;
}
return null;
case Token.NEG:
if (n.getChildCount() == 1 && n.getFirstChild().getType() == Token.NAME && n.getFirstChild().getString().equals("String_Node_Str")) {
return Double.NEGATIVE_INFINITY;
}
return null;
case Token.NOT:
TernaryValue child=getBooleanValue(n.getFirstChild());
if (child != TernaryValue.UNKNOWN) {
return child.toBoolean(true) ? 0.0 : 1.0;
}
break;
case Token.STRING:
String s=trimJsWhiteSpace(n.getString());
if (s.length() == 0) {
return 0.0;
}
if (s.length() > 2 && s.charAt(0) == '0' && (s.charAt(1) == 'x' || s.charAt(1) == 'X')) {
try {
return Double.valueOf(Integer.parseInt(s.substring(2),16));
}
 catch (NumberFormatException e) {
return Double.NaN;
}
}
if (s.length() > 3 && (s.charAt(0) == '-' || s.charAt(0) == '+') && s.charAt(1) == '0' && (s.charAt(2) == 'x' || s.charAt(2) == 'X')) {
return null;
}
if (s.equals("String_Node_Str") || s.equals("String_Node_Str") || s.equals("String_Node_Str")) {
return null;
}
try {
return Double.parseDouble(s);
}
 catch (NumberFormatException e) {
return Double.NaN;
}
}
return null;
}

Fixed version (ground truth):
/** 
 * Gets the value of a node as a Number, or null if it cannot be converted. When it returns a non-null Double, this method effectively emulates the <code>Number()</code> JavaScript cast function.
 */
static Double getNumberValue(Node n){
switch (n.getType()) {
case Token.TRUE:
    return 1.0;
case Token.FALSE:
case Token.NULL:
  return 0.0;
case Token.NUMBER:
return n.getDouble();
case Token.VOID:
if (mayHaveSideEffects(n.getFirstChild())) {
return null;
}
 else {
return Double.NaN;
}
case Token.NAME:
String name=n.getString();
if (name.equals("String_Node_Str")) {
return Double.NaN;
}
if (name.equals("String_Node_Str")) {
return Double.NaN;
}
if (name.equals("String_Node_Str")) {
return Double.POSITIVE_INFINITY;
}
return null;
case Token.NEG:
if (n.getChildCount() == 1 && n.getFirstChild().getType() == Token.NAME && n.getFirstChild().getString().equals("String_Node_Str")) {
return Double.NEGATIVE_INFINITY;
}
return null;
case Token.NOT:
TernaryValue child=getBooleanValue(n.getFirstChild());
if (child != TernaryValue.UNKNOWN) {
return child.toBoolean(true) ? 0.0 : 1.0;
}
break;
case Token.STRING:
return getStringNumberValue(n.getString());
case Token.ARRAYLIT:
case Token.OBJECTLIT:
String value=getStringValue(n);
return value != null ? getStringNumberValue(value) : null;
}
return null;
}
Program: 28161
Project: 28161
Buggy source:
/** 
 * Gets the value of a node as a String, or null if it cannot be converted. When it returns a non-null String, this method effectively emulates the <code>String()</code> JavaScript cast function.
 */
static String getStringValue(Node n){
switch (n.getType()) {
case Token.STRING:
    return n.getString();
case Token.NAME:
  String name=n.getString();
if ("String_Node_Str".equals(name) || "String_Node_Str".equals(name) || "String_Node_Str".equals(name)) {
  return name;
}
break;
case Token.NUMBER:
double value=n.getDouble();
long longValue=(long)value;
if (longValue == value) {
return Long.toString(longValue);
}
 else {
return Double.toString(n.getDouble());
}
case Token.FALSE:
case Token.TRUE:
case Token.NULL:
return Node.tokenToName(n.getType());
case Token.VOID:
return "String_Node_Str";
case Token.NOT:
TernaryValue child=getBooleanValue(n.getFirstChild());
if (child != TernaryValue.UNKNOWN) {
return child.toBoolean(true) ? "String_Node_Str" : "String_Node_Str";
}
break;
}
return null;
}

Fixed version (ground truth):
/** 
 * Gets the value of a node as a String, or null if it cannot be converted. When it returns a non-null String, this method effectively emulates the <code>String()</code> JavaScript cast function.
 */
static String getStringValue(Node n){
switch (n.getType()) {
case Token.STRING:
    return n.getString();
case Token.NAME:
  String name=n.getString();
if ("String_Node_Str".equals(name) || "String_Node_Str".equals(name) || "String_Node_Str".equals(name)) {
  return name;
}
break;
case Token.NUMBER:
double value=n.getDouble();
long longValue=(long)value;
if (longValue == value) {
return Long.toString(longValue);
}
 else {
return Double.toString(n.getDouble());
}
case Token.FALSE:
case Token.TRUE:
case Token.NULL:
return Node.tokenToName(n.getType());
case Token.VOID:
return "String_Node_Str";
case Token.NOT:
TernaryValue child=getBooleanValue(n.getFirstChild());
if (child != TernaryValue.UNKNOWN) {
return child.toBoolean(true) ? "String_Node_Str" : "String_Node_Str";
}
break;
case Token.ARRAYLIT:
return arrayToString(n);
case Token.OBJECTLIT:
return "String_Node_Str";
}
return null;
}
Program: 28163
Project: 28163
Buggy source:
public void testGetStringValue(){
  assertEquals("String_Node_Str",NodeUtil.getStringValue(getNode("String_Node_Str")));
  assertEquals("String_Node_Str",NodeUtil.getStringValue(getNode("String_Node_Str")));
  assertEquals("String_Node_Str",NodeUtil.getStringValue(getNode("String_Node_Str")));
  assertEquals("String_Node_Str",NodeUtil.getStringValue(getNode("String_Node_Str")));
  assertEquals(null,NodeUtil.getStringValue(getNode("String_Node_Str")));
  assertEquals(null,NodeUtil.getStringValue(getNode("String_Node_Str")));
  assertEquals(null,NodeUtil.getStringValue(getNode("String_Node_Str")));
  assertEquals("String_Node_Str",NodeUtil.getStringValue(getNode("String_Node_Str")));
  assertEquals("String_Node_Str",NodeUtil.getStringValue(getNode("String_Node_Str")));
  assertEquals("String_Node_Str",NodeUtil.getStringValue(getNode("String_Node_Str")));
  assertEquals("String_Node_Str",NodeUtil.getStringValue(getNode("String_Node_Str")));
  assertEquals("String_Node_Str",NodeUtil.getStringValue(getNode("String_Node_Str")));
  assertEquals("String_Node_Str",NodeUtil.getStringValue(getNode("String_Node_Str")));
  assertEquals("String_Node_Str",NodeUtil.getStringValue(getNode("String_Node_Str")));
  assertEquals("String_Node_Str",NodeUtil.getStringValue(getNode("String_Node_Str")));
  assertEquals("String_Node_Str",NodeUtil.getStringValue(getNode("String_Node_Str")));
  assertEquals(null,NodeUtil.getStringValue(getNode("String_Node_Str")));
}

Fixed version (ground truth):
public void testGetStringValue(){
  assertEquals("String_Node_Str",NodeUtil.getStringValue(getNode("String_Node_Str")));
  assertEquals("String_Node_Str",NodeUtil.getStringValue(getNode("String_Node_Str")));
  assertEquals("String_Node_Str",NodeUtil.getStringValue(getNode("String_Node_Str")));
  assertEquals("String_Node_Str",NodeUtil.getStringValue(getNode("String_Node_Str")));
  assertEquals(null,NodeUtil.getStringValue(getNode("String_Node_Str")));
  assertEquals("String_Node_Str",NodeUtil.getStringValue(getNode("String_Node_Str")));
  assertEquals("String_Node_Str",NodeUtil.getStringValue(getNode("String_Node_Str")));
  assertEquals("String_Node_Str",NodeUtil.getStringValue(getNode("String_Node_Str")));
  assertEquals("String_Node_Str",NodeUtil.getStringValue(getNode("String_Node_Str")));
  assertEquals("String_Node_Str",NodeUtil.getStringValue(getNode("String_Node_Str")));
  assertEquals("String_Node_Str",NodeUtil.getStringValue(getNode("String_Node_Str")));
  assertEquals("String_Node_Str",NodeUtil.getStringValue(getNode("String_Node_Str")));
  assertEquals("String_Node_Str",NodeUtil.getStringValue(getNode("String_Node_Str")));
  assertEquals("String_Node_Str",NodeUtil.getStringValue(getNode("String_Node_Str")));
  assertEquals("String_Node_Str",NodeUtil.getStringValue(getNode("String_Node_Str")));
  assertEquals("String_Node_Str",NodeUtil.getStringValue(getNode("String_Node_Str")));
  assertEquals(null,NodeUtil.getStringValue(getNode("String_Node_Str")));
}
Program: 28164
Project: 28164
Buggy source:
public void testStringJoinAdd(){
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  foldSame("String_Node_Str");
  foldSame("String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
public void testStringJoinAdd(){
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  foldSame("String_Node_Str");
  foldSame("String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  foldSame("String_Node_Str");
}
Program: 28165
Project: 28165
Buggy source:
private void maybeCollectMember(NodeTraversal t,Node member,Node nodeWithJsDocInfo,@Nullable Node value){
  JSDocInfo info=nodeWithJsDocInfo.getJSDocInfo();
  if (info == null || member.getType() != Token.GETPROP || member.getFirstChild().getType() != Token.THIS) {
    return;
  }
  member.getFirstChild().setJSType(thisType);
  JSType jsType=getDeclaredPropType(t,info,member,value);
  Node name=member.getLastChild();
  if (jsType != null && (name.getType() == Token.NAME || name.getType() == Token.STRING)) {
    thisType.defineDeclaredProperty(name.getString(),jsType,false,member);
  }
}

Fixed version (ground truth):
private void maybeCollectMember(NodeTraversal t,Node member,Node nodeWithJsDocInfo,@Nullable Node value){
  JSDocInfo info=nodeWithJsDocInfo.getJSDocInfo();
  if (info == null || member.getType() != Token.GETPROP || member.getFirstChild().getType() != Token.THIS) {
    return;
  }
  member.getFirstChild().setJSType(thisType);
  JSType jsType=getDeclaredType(t.getSourceName(),info,member,value);
  Node name=member.getLastChild();
  if (jsType != null && (name.getType() == Token.NAME || name.getType() == Token.STRING)) {
    thisType.defineDeclaredProperty(name.getString(),jsType,false,member);
  }
}
Program: 28166
Project: 28166
Buggy source:
private JSType getDeclaredTypeInAnnotation(String sourceName,Node node,JSDocInfo info){
  JSType jsType=null;
  Node objNode=node.getType() == Token.GETPROP ? node.getFirstChild() : NodeUtil.isObjectLitKey(node,node.getParent()) ? node.getParent() : null;
  if (info != null) {
    if (info.hasType()) {
      jsType=info.getType().evaluate(scope,typeRegistry);
    }
 else     if (FunctionTypeBuilder.isFunctionTypeDeclaration(info)) {
      String fnName=node.getQualifiedName();
      jsType=createFunctionTypeFromNodes(null,fnName,info,node);
    }
  }
  return jsType;
}

Fixed version (ground truth):
/** 
 * Returns the type specified in a JSDoc annotation near a GETPROP or NAME. Extracts type information from either the   {@code @type} tag or fromthe  {@code @return} and {@code @param} tags.
 */
private JSType getDeclaredTypeInAnnotation(String sourceName,Node node,JSDocInfo info){
  JSType jsType=null;
  Node objNode=node.getType() == Token.GETPROP ? node.getFirstChild() : NodeUtil.isObjectLitKey(node,node.getParent()) ? node.getParent() : null;
  if (info != null) {
    if (info.hasType()) {
      jsType=info.getType().evaluate(scope,typeRegistry);
    }
 else     if (FunctionTypeBuilder.isFunctionTypeDeclaration(info)) {
      String fnName=node.getQualifiedName();
      jsType=createFunctionTypeFromNodes(null,fnName,info,node);
    }
  }
  return jsType;
}
Program: 28167
Project: 28167
Buggy source:
/** 
 * Defines a variable based on the   {@link Token#NAME} node passed.
 * @param name The {@link Token#NAME} node.
 * @param var The parent of the {@code name} node, which must be a{@link Token#VAR} node.
 * @param parent {@code var}'s parent.
 * @param info the {@link JSDocInfo} information relating to this{@code name} node.
 */
private void defineName(Node name,Node var,Node parent,JSDocInfo info){
  Node value=name.getFirstChild();
  JSType type=null;
  if (value != null && value.getType() == Token.FUNCTION && shouldUseFunctionLiteralType((FunctionType)value.getJSType(),info,name)) {
    type=value.getJSType();
  }
  if (type == null) {
    if (info == null) {
      CompilerInput input=compiler.getInput(sourceName);
      Preconditions.checkNotNull(input,sourceName);
      type=input.isExtern() ? getNativeType(UNKNOWN_TYPE) : null;
    }
 else     if (info.hasEnumParameterType()) {
      if (value != null && value.getType() == Token.OBJECTLIT) {
        type=value.getJSType();
      }
 else {
        type=createEnumTypeFromNodes(value,name.getString(),info,name);
      }
    }
 else     if (info.isConstructor()) {
      type=createFunctionTypeFromNodes(value,name.getString(),info,name);
    }
 else {
      type=getDeclaredTypeInAnnotation(sourceName,name,info);
    }
  }
  defineSlot(name,var,type);
}

Fixed version (ground truth):
/** 
 * Defines a variable based on the   {@link Token#NAME} node passed.
 * @param name The {@link Token#NAME} node.
 * @param var The parent of the {@code name} node, which must be a{@link Token#VAR} node.
 * @param parent {@code var}'s parent.
 * @param info the {@link JSDocInfo} information relating to this{@code name} node.
 */
private void defineName(Node name,Node var,Node parent,JSDocInfo info){
  Node value=name.getFirstChild();
  JSType type=getDeclaredType(sourceName,info,name,value);
  if (type == null) {
    CompilerInput input=compiler.getInput(sourceName);
    Preconditions.checkNotNull(input,sourceName);
    type=input.isExtern() ? getNativeType(UNKNOWN_TYPE) : null;
  }
  defineSlot(name,var,type);
}
Program: 28168
Project: 28168
Buggy source:
/** 
 * Process an object literal and all the types on it.
 * @param objLit The OBJECTLIT node.
 * @param objLitType The type of the OBJECTLIT node. This might be a namedtype, because of the lends annotation.
 */
void processObjectLitProperties(NodeTraversal t,Node objLit,ObjectType objLitType){
  for (Node keyNode=objLit.getFirstChild(); keyNode != null; keyNode=keyNode.getNext()) {
    Node value=keyNode.getFirstChild();
    String memberName=NodeUtil.getObjectLitKeyName(keyNode);
    JSDocInfo info=keyNode.getJSDocInfo();
    JSType valueType=getDeclaredPropType(t,info,keyNode,value);
    JSType keyType=NodeUtil.getObjectLitKeyTypeFromValueType(keyNode,valueType);
    if (keyType != null) {
      String qualifiedName=getBestLValueName(keyNode);
      if (qualifiedName != null) {
        defineSlot(keyNode,objLit,qualifiedName,keyType,false);
      }
 else {
        setDeferredType(keyNode,keyType);
      }
      if (objLitType != null) {
        boolean isExtern=t.getInput() != null && t.getInput().isExtern();
        objLitType.defineDeclaredProperty(memberName,keyType,isExtern,keyNode);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Process an object literal and all the types on it.
 * @param objLit The OBJECTLIT node.
 * @param objLitType The type of the OBJECTLIT node. This might be a namedtype, because of the lends annotation.
 */
void processObjectLitProperties(NodeTraversal t,Node objLit,ObjectType objLitType){
  for (Node keyNode=objLit.getFirstChild(); keyNode != null; keyNode=keyNode.getNext()) {
    Node value=keyNode.getFirstChild();
    String memberName=NodeUtil.getObjectLitKeyName(keyNode);
    JSDocInfo info=keyNode.getJSDocInfo();
    JSType valueType=getDeclaredType(t.getSourceName(),info,keyNode,value);
    JSType keyType=NodeUtil.getObjectLitKeyTypeFromValueType(keyNode,valueType);
    if (keyType != null) {
      String qualifiedName=getBestLValueName(keyNode);
      if (qualifiedName != null) {
        defineSlot(keyNode,objLit,qualifiedName,keyType,false);
      }
 else {
        setDeferredType(keyNode,keyType);
      }
      if (objLitType != null) {
        boolean isExtern=t.getInput() != null && t.getInput().isExtern();
        objLitType.defineDeclaredProperty(memberName,keyType,isExtern,keyNode);
      }
    }
  }
}
Program: 28169
Project: 28169
Buggy source:
public void testConstructorAlias10() throws Exception {
  testTypes("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str");
}

Fixed version (ground truth):
public void testConstructorAlias10() throws Exception {
  testTypes("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: 28170
Project: 28170
Buggy source:
public void testConstructorAlias9() throws Exception {
  testTypes("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str");
}

Fixed version (ground truth):
public void testConstructorAlias9() throws Exception {
  testTypes("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: 28171
Project: 28171
Buggy source:
public void testConstructorAlias8() throws Exception {
  testTypes("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str");
}

Fixed version (ground truth):
public void testConstructorAlias8() throws Exception {
  testTypes("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");
}
Program: 28172
Project: 28172
Buggy source:
public void testStubFunctionDeclaration8() throws Exception {
  testFunctionType("String_Node_Str","String_Node_Str",createNullableType(U2U_CONSTRUCTOR_TYPE).restrictByNotNullOrUndefined().toString());
}

Fixed version (ground truth):
public void testStubFunctionDeclaration8() throws Exception {
  testFunctionType("String_Node_Str","String_Node_Str",createOptionalType(createNullableType(U2U_CONSTRUCTOR_TYPE)).toString());
}
Program: 28173
Project: 28173
Buggy source:
public void testStubFunctionDeclaration8() throws Exception {
  testFunctionType("String_Node_Str","String_Node_Str",createNullableType(U2U_CONSTRUCTOR_TYPE).restrictByNotNullOrUndefined().toString());
}

Fixed version (ground truth):
public void testStubFunctionDeclaration8() throws Exception {
  testFunctionType("String_Node_Str","String_Node_Str",createNullableType(U2U_CONSTRUCTOR_TYPE).toString());
}
Program: 28175
Project: 28175
Buggy source:
public void testMinimizeWhileCondition(){
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
public void testMinimizeWhileCondition(){
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  foldSame("String_Node_Str");
  foldSame("String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
  fold("String_Node_Str","String_Node_Str");
}
Program: 28176
Project: 28176
Buggy source:
@Override public void visit(NodeTraversal t,Node n,Node parent){
  if (n.getType() != Token.NAME) {
    return;
  }
  String name=n.getString();
  if (name.length() == 0) {
    return;
  }
  Scope.Var var=t.getScope().getVar(name);
  boolean local=(var != null) && var.isLocal();
  if (!local && localRenamingOnly) {
    reservedNames.add(name);
    return;
  }
  if (preserveFunctionExpressionNames && var != null && NodeUtil.isFunctionExpression(var.getParentNode())) {
    reservedNames.add(name);
    return;
  }
  if (!okToRenameVar(name,local)) {
    if (local) {
      String newName=MakeDeclaredNamesUnique.ContextualRenameInverter.getOrginalName(name);
      if (!newName.equals(name)) {
        n.setString(newName);
      }
    }
    return;
  }
  if (isExternsPass_) {
    if (!local) {
      externNames.add(name);
    }
    return;
  }
  if (pseudoNameMap != null) {
    recordPseudoName(n);
  }
  if (local) {
    String tempName=LOCAL_VAR_PREFIX + var.getLocalVarIndex();
    incCount(tempName,null);
    localNameNodes.add(n);
    n.setString(tempName);
  }
 else   if (var != null) {
    incCount(name,var.input);
    globalNameNodes.add(n);
  }
}

Fixed version (ground truth):
@Override public void visit(NodeTraversal t,Node n,Node parent){
  if (n.getType() != Token.NAME) {
    return;
  }
  String name=n.getString();
  if (name.length() == 0) {
    return;
  }
  Scope.Var var=t.getScope().getVar(name);
  boolean local=(var != null) && var.isLocal() && (!var.scope.getParent().isGlobal() || !var.isBleedingFunction());
  if (!local && localRenamingOnly) {
    reservedNames.add(name);
    return;
  }
  if (preserveFunctionExpressionNames && var != null && NodeUtil.isFunctionExpression(var.getParentNode())) {
    reservedNames.add(name);
    return;
  }
  if (!okToRenameVar(name,local)) {
    if (local) {
      String newName=MakeDeclaredNamesUnique.ContextualRenameInverter.getOrginalName(name);
      if (!newName.equals(name)) {
        n.setString(newName);
      }
    }
    return;
  }
  if (isExternsPass_) {
    if (!local) {
      externNames.add(name);
    }
    return;
  }
  if (pseudoNameMap != null) {
    recordPseudoName(n);
  }
  if (local) {
    String tempName=LOCAL_VAR_PREFIX + var.getLocalVarIndex();
    incCount(tempName,null);
    localNameNodes.add(n);
    n.setString(tempName);
  }
 else   if (var != null) {
    incCount(name,var.input);
    globalNameNodes.add(n);
  }
}
Program: 28178
Project: 28178
Buggy source:
TernaryValue testForEqualityHelper(JSType aType,JSType bType){
  if (bType.isAllType() || bType.isEmptyType() || bType.isUnknownType()) {
    return UNKNOWN;
  }
  if (aType.isFunctionType() || bType.isFunctionType()) {
    JSType otherType=aType.isFunctionType() ? bType : aType;
    if (otherType.isSubtype(getNativeType(JSTypeNative.OBJECT_TYPE))) {
      return TernaryValue.UNKNOWN;
    }
 else {
      return TernaryValue.FALSE;
    }
  }
  if (bType.isEnumElementType() || bType.isUnionType()) {
    return bType.testForEquality(aType);
  }
  return null;
}

Fixed version (ground truth):
TernaryValue testForEqualityHelper(JSType aType,JSType bType){
  if (bType.isAllType() || bType.isEmptyType() || bType.isUnknownType()|| aType.isAllType()|| aType.isEmptyType()|| aType.isUnknownType()) {
    return UNKNOWN;
  }
  if (aType.isFunctionType() || bType.isFunctionType()) {
    JSType otherType=aType.isFunctionType() ? bType : aType;
    if (!otherType.getGreatestSubtype(getNativeType(JSTypeNative.OBJECT_TYPE)).isEmptyType()) {
      return TernaryValue.UNKNOWN;
    }
 else {
      return TernaryValue.FALSE;
    }
  }
  if (bType.isEnumElementType() || bType.isUnionType()) {
    return bType.testForEquality(aType);
  }
  return null;
}
Program: 28180
Project: 28180
Buggy source:
@Override public int parseArguments(Parameters params) throws CmdLineException {
  String param=params.getParameter(0);
  if (param == null) {
    setter.addValue(true);
    return 0;
  }
 else {
    String lowerParam=param.toLowerCase();
    if (TRUES.contains(lowerParam)) {
      setter.addValue(true);
    }
 else     if (FALSES.contains(lowerParam)) {
      setter.addValue(false);
    }
 else {
      setter.addValue(true);
      return 0;
    }
    return 1;
  }
}

Fixed version (ground truth):
@Override public int parseArguments(Parameters params) throws CmdLineException {
  String param=null;
  try {
    param=params.getParameter(0);
  }
 catch (  CmdLineException e) {
  }
  if (param == null) {
    setter.addValue(true);
    return 0;
  }
 else {
    String lowerParam=param.toLowerCase();
    if (TRUES.contains(lowerParam)) {
      setter.addValue(true);
    }
 else     if (FALSES.contains(lowerParam)) {
      setter.addValue(false);
    }
 else {
      setter.addValue(true);
      return 0;
    }
    return 1;
  }
}
Program: 28181
Project: 28181
Buggy source:
@Override public void setUp() throws Exception {
  super.setUp();
  externs=DEFAULT_EXTERNS;
  lastCompiler=null;
  outReader=new ByteArrayOutputStream();
  errReader=new ByteArrayOutputStream();
  useStringComparison=false;
  useModules=ModulePattern.NONE;
  args.clear();
  exitCodes=Lists.newArrayList();
}

Fixed version (ground truth):
@Override public void setUp() throws Exception {
  super.setUp();
  externs=DEFAULT_EXTERNS;
  lastCompiler=null;
  lastArg=null;
  outReader=new ByteArrayOutputStream();
  errReader=new ByteArrayOutputStream();
  useStringComparison=false;
  useModules=ModulePattern.NONE;
  args.clear();
  exitCodes=Lists.newArrayList();
}
Program: 28182
Project: 28182
Buggy source:
private CommandLineRunner createCommandLineRunner(String[] original){
  for (int i=0; i < original.length; i++) {
    args.add("String_Node_Str");
    args.add("String_Node_Str" + i + "String_Node_Str");
    if (useModules == ModulePattern.CHAIN) {
      args.add("String_Node_Str");
      args.add("String_Node_Str" + i + "String_Node_Str"+ (i > 0 ? ("String_Node_Str" + (i - 1)) : "String_Node_Str"));
    }
 else     if (useModules == ModulePattern.STAR) {
      args.add("String_Node_Str");
      args.add("String_Node_Str" + i + "String_Node_Str"+ (i > 0 ? "String_Node_Str" : "String_Node_Str"));
    }
  }
  String[] argStrings=args.toArray(new String[]{});
  return new CommandLineRunner(argStrings,new PrintStream(outReader),new PrintStream(errReader));
}

Fixed version (ground truth):
private CommandLineRunner createCommandLineRunner(String[] original){
  for (int i=0; i < original.length; i++) {
    args.add("String_Node_Str");
    args.add("String_Node_Str" + i + "String_Node_Str");
    if (useModules == ModulePattern.CHAIN) {
      args.add("String_Node_Str");
      args.add("String_Node_Str" + i + "String_Node_Str"+ (i > 0 ? ("String_Node_Str" + (i - 1)) : "String_Node_Str"));
    }
 else     if (useModules == ModulePattern.STAR) {
      args.add("String_Node_Str");
      args.add("String_Node_Str" + i + "String_Node_Str"+ (i > 0 ? "String_Node_Str" : "String_Node_Str"));
    }
  }
  if (lastArg != null) {
    args.add(lastArg);
  }
  String[] argStrings=args.toArray(new String[]{});
  return new CommandLineRunner(argStrings,new PrintStream(outReader),new PrintStream(errReader));
}
Program: 28183
Project: 28183
Buggy source:
/** 
 * @return The expression node.
 */
private Node getBlockExpression(Node n){
  Preconditions.checkState(isExpressBlock(n));
  return n.getFirstChild();
}

Fixed version (ground truth):
/** 
 * @return The expression node.
 */
private Node getBlockExpression(Node n){
  Preconditions.checkState(isFoldableExpressBlock(n));
  return n.getFirstChild();
}
Program: 28185
Project: 28185
Buggy source:
/** 
 * Determines whether two slots are meaningfully different for the purposes of data flow analysis.
 */
private boolean diffSlots(StaticSlot<JSType> slotA,StaticSlot<JSType> slotB){
  boolean aIsNull=slotA == null || slotA.getType() == null;
  boolean bIsNull=slotB == null || slotB.getType() == null;
  if (aIsNull && bIsNull) {
    return false;
  }
 else   if (aIsNull ^ bIsNull) {
    return true;
  }
  JSType aType=slotA.getType();
  JSType bType=slotB.getType();
  if (aType.isNoType() || bType.isNoType()) {
    return false;
  }
  return aType.differsFrom(bType);
}

Fixed version (ground truth):
/** 
 * Determines whether two slots are meaningfully different for the purposes of data flow analysis.
 */
private boolean diffSlots(StaticSlot<JSType> slotA,StaticSlot<JSType> slotB){
  boolean aIsNull=slotA == null || slotA.getType() == null;
  boolean bIsNull=slotB == null || slotB.getType() == null;
  if (aIsNull && bIsNull) {
    return false;
  }
 else   if (aIsNull ^ bIsNull) {
    return true;
  }
  return slotA.getType().differsFrom(slotB.getType());
}
Program: 28186
Project: 28186
Buggy source:
@Override JSType resolveInternal(ErrorReporter t,StaticScope<JSType> scope){
  setResolvedTypeInternal(this);
  if (implicitPrototype != null && !implicitPrototype.isNativeObjectType()) {
    implicitPrototype=(ObjectType)implicitPrototype.resolve(t,scope);
  }
  for (  Property prop : properties.values()) {
    prop.type=safeResolve(prop.type,t,scope);
  }
  return this;
}

Fixed version (ground truth):
@Override JSType resolveInternal(ErrorReporter t,StaticScope<JSType> scope){
  setResolvedTypeInternal(this);
  ObjectType implicitPrototype=getImplicitPrototype();
  if (implicitPrototype != null) {
    implicitPrototypeFallback=(ObjectType)implicitPrototype.resolve(t,scope);
  }
  for (  Property prop : properties.values()) {
    prop.type=safeResolve(prop.type,t,scope);
  }
  return this;
}
Program: 28187
Project: 28187
Buggy source:
/** 
 * This should only be reset on the FunctionPrototypeType, only to fix an incorrectly established prototype chain due to the user having a mismatch in super class declaration, and only before properties on that type are processed.
 */
void setImplicitPrototype(ObjectType implicitPrototype){
  checkState(!hasCachedValues());
  this.implicitPrototype=implicitPrototype;
}

Fixed version (ground truth):
/** 
 * This should only be reset on the FunctionPrototypeType, only to fix an incorrectly established prototype chain due to the user having a mismatch in super class declaration, and only before properties on that type are processed.
 */
final void setImplicitPrototype(ObjectType implicitPrototype){
  checkState(!hasCachedValues());
  this.implicitPrototypeFallback=implicitPrototype;
}
Program: 28188
Project: 28188
Buggy source:
@Override public ObjectType getImplicitPrototype(){
  return implicitPrototype;
}

Fixed version (ground truth):
@Override public ObjectType getImplicitPrototype(){
  return implicitPrototypeFallback;
}
Program: 28189
Project: 28189
Buggy source:
/** 
 * Creates an object type, allowing specification of the implicit prototype when creating native objects.
 */
PrototypeObjectType(JSTypeRegistry registry,String className,ObjectType implicitPrototype,boolean nativeType){
  super(registry);
  this.properties=Maps.newTreeMap();
  this.className=className;
  this.nativeType=nativeType;
  if (nativeType) {
    this.implicitPrototype=implicitPrototype;
  }
 else   if (implicitPrototype == null) {
    this.implicitPrototype=registry.getNativeObjectType(JSTypeNative.OBJECT_TYPE);
  }
 else {
    this.implicitPrototype=implicitPrototype;
  }
}

Fixed version (ground truth):
/** 
 * Creates an object type, allowing specification of the implicit prototype when creating native objects.
 */
PrototypeObjectType(JSTypeRegistry registry,String className,ObjectType implicitPrototype,boolean nativeType){
  super(registry);
  this.properties=Maps.newTreeMap();
  this.className=className;
  this.nativeType=nativeType;
  if (nativeType || implicitPrototype != null) {
    setImplicitPrototype(implicitPrototype);
  }
 else {
    setImplicitPrototype(registry.getNativeObjectType(JSTypeNative.OBJECT_TYPE));
  }
}
Program: 28191
Project: 28191
Buggy source:
/** 
 * Creates a dotted namespace assignment expression (e.g. <code>foo.bar = {};</code>).
 * @param namespace A dotted namespace
 * @param node A node from which to copy source info.
 */
private Node makeAssignmentExprNode(String namespace,Node node){
  Node decl=new Node(Token.EXPR_RESULT,new Node(Token.ASSIGN,NodeUtil.newQualifiedNameNode(namespace,node,namespace),new Node(Token.OBJECTLIT)));
  decl.putBooleanProp(Node.IS_NAMESPACE,true);
  Preconditions.checkState(isNamespacePlaceholder(decl));
  decl.copyInformationFromForTree(node);
  return decl;
}

Fixed version (ground truth):
/** 
 * Creates a dotted namespace assignment expression (e.g. <code>foo.bar = {};</code>).
 * @param namespace A dotted namespace
 * @param node A node from which to copy source info.
 */
private Node makeAssignmentExprNode(String namespace,Node node){
  Node decl=new Node(Token.EXPR_RESULT,new Node(Token.ASSIGN,NodeUtil.newQualifiedNameNode(namespace,node,namespace),createNamespaceLiteral()));
  decl.putBooleanProp(Node.IS_NAMESPACE,true);
  Preconditions.checkState(isNamespacePlaceholder(decl));
  decl.copyInformationFromForTree(node);
  return decl;
}
Program: 28192
Project: 28192
Buggy source:
/** 
 * Creates a simple namespace variable declaration (e.g. <code>var foo = {};</code>).
 * @param namespace A simple namespace (must be a valid js identifier)
 * @param sourceNode The node to get source information from.
 */
private Node makeVarDeclNode(String namespace,Node sourceNode){
  Node name=Node.newString(Token.NAME,namespace);
  name.addChildToFront(new Node(Token.OBJECTLIT));
  Node decl=new Node(Token.VAR,name);
  decl.putBooleanProp(Node.IS_NAMESPACE,true);
  if (compiler.getCodingConvention().isConstant(namespace)) {
    name.putBooleanProp(Node.IS_CONSTANT_NAME,true);
  }
  Preconditions.checkState(isNamespacePlaceholder(decl));
  decl.copyInformationFromForTree(sourceNode);
  return decl;
}

Fixed version (ground truth):
/** 
 * Creates a simple namespace variable declaration (e.g. <code>var foo = {};</code>).
 * @param namespace A simple namespace (must be a valid js identifier)
 * @param sourceNode The node to get source information from.
 */
private Node makeVarDeclNode(String namespace,Node sourceNode){
  Node name=Node.newString(Token.NAME,namespace);
  name.addChildToFront(createNamespaceLiteral());
  Node decl=new Node(Token.VAR,name);
  decl.putBooleanProp(Node.IS_NAMESPACE,true);
  if (compiler.getCodingConvention().isConstant(namespace)) {
    name.putBooleanProp(Node.IS_CONSTANT_NAME,true);
  }
  Preconditions.checkState(isNamespacePlaceholder(decl));
  decl.copyInformationFromForTree(sourceNode);
  return decl;
}
Program: 28193
Project: 28193
Buggy source:
private FlowScope traverseObjectLiteral(Node n,FlowScope scope){
  ObjectType objectType=(ObjectType)n.getJSType();
  if (objectType == null) {
    return scope;
  }
  if (objectType.hasReferenceName()) {
    return scope;
  }
  for (Node name=n.getFirstChild(); name != null; name=name.getNext().getNext()) {
    Node value=name.getNext();
    scope=traverse(name,scope);
    scope=traverse(value,scope);
    String memberName=NodeUtil.getStringValue(name);
    if (memberName != null) {
      objectType.defineInferredProperty(memberName,getJSType(value),false);
    }
 else {
      n.setJSType(getNativeType(UNKNOWN_TYPE));
      return scope;
    }
  }
  return scope;
}

Fixed version (ground truth):
private FlowScope traverseObjectLiteral(Node n,FlowScope scope){
  ObjectType objectType=(ObjectType)n.getJSType();
  Preconditions.checkNotNull(objectType);
  if (objectType.hasReferenceName()) {
    return scope;
  }
  for (Node name=n.getFirstChild(); name != null; name=name.getNext().getNext()) {
    Node value=name.getNext();
    scope=traverse(name,scope);
    scope=traverse(value,scope);
    String memberName=NodeUtil.getStringValue(name);
    if (memberName != null) {
      objectType.defineInferredProperty(memberName,getJSType(value),false);
    }
 else {
      n.setJSType(getNativeType(UNKNOWN_TYPE));
      return scope;
    }
  }
  return scope;
}
Program: 28194
Project: 28194
Buggy source:
private void attachLiteralTypes(Node n){
switch (n.getType()) {
case Token.NULL:
    n.setJSType(getNativeType(NULL_TYPE));
  break;
case Token.VOID:
n.setJSType(getNativeType(VOID_TYPE));
break;
case Token.STRING:
n.setJSType(getNativeType(STRING_TYPE));
break;
case Token.NUMBER:
n.setJSType(getNativeType(NUMBER_TYPE));
break;
case Token.TRUE:
case Token.FALSE:
n.setJSType(getNativeType(BOOLEAN_TYPE));
break;
case Token.REGEXP:
n.setJSType(getNativeType(REGEXP_TYPE));
break;
case Token.REF_SPECIAL:
n.setJSType(getNativeType(UNKNOWN_TYPE));
break;
case Token.OBJECTLIT:
n.setJSType(typeRegistry.createAnonymousObjectType());
break;
}
}

Fixed version (ground truth):
private void attachLiteralTypes(Node n){
switch (n.getType()) {
case Token.NULL:
    n.setJSType(getNativeType(NULL_TYPE));
  break;
case Token.VOID:
n.setJSType(getNativeType(VOID_TYPE));
break;
case Token.STRING:
n.setJSType(getNativeType(STRING_TYPE));
break;
case Token.NUMBER:
n.setJSType(getNativeType(NUMBER_TYPE));
break;
case Token.TRUE:
case Token.FALSE:
n.setJSType(getNativeType(BOOLEAN_TYPE));
break;
case Token.REGEXP:
n.setJSType(getNativeType(REGEXP_TYPE));
break;
case Token.REF_SPECIAL:
n.setJSType(getNativeType(UNKNOWN_TYPE));
break;
case Token.OBJECTLIT:
if (n.getJSType() == null) {
n.setJSType(typeRegistry.createAnonymousObjectType());
}
break;
}
}
Program: 28195
Project: 28195
Buggy source:
@Override public boolean apply(Node node){
  return NodeUtil.isCall(node) || NodeUtil.isNew(node) || NodeUtil.isFunction(node)|| NodeUtil.isName(node)|| (NodeUtil.isString(node) && NodeUtil.isGet(node.getParent()));
}

Fixed version (ground truth):
@Override public boolean apply(Node node){
  return NodeUtil.isCall(node) || NodeUtil.isNew(node) || NodeUtil.isFunction(node)|| NodeUtil.isName(node)|| NodeUtil.isGet(node)|| (NodeUtil.isString(node) && NodeUtil.isGet(node.getParent()));
}
Program: 28196
Project: 28196
Buggy source:
void addGuard(WarningsGuard guard){
  if (guard instanceof ComposeWarningsGuard) {
    addGuards(((ComposeWarningsGuard)guard).guards);
  }
 else {
    int index=Collections.binarySearch(this.guards,guard,guardComparator);
    if (index < 0) {
      index=-index - 1;
    }
    this.guards.add(index,guard);
  }
}

Fixed version (ground truth):
void addGuard(WarningsGuard guard){
  if (guard instanceof ComposeWarningsGuard) {
    addGuards(Iterables.reverse(((ComposeWarningsGuard)guard).guards));
  }
 else {
    int index=Collections.binarySearch(this.guards,guard,guardComparator);
    if (index < 0) {
      index=-index - 1;
    }
    this.guards.add(index,guard);
  }
}
Program: 28197
Project: 28197
Buggy source:
/** 
 * Determines whether this guard will "elevate" the status of any disabled diagnostic type in the group to a warning or an error.
 */
@Override public boolean enables(DiagnosticGroup group){
  for (  WarningsGuard guard : guards) {
    if (guard.enables(group)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Determines whether this guard will "elevate" the status of any disabled diagnostic type in the group to a warning or an error.
 */
@Override public boolean enables(DiagnosticGroup group){
  for (  WarningsGuard guard : guards) {
    if (guard.enables(group)) {
      return true;
    }
 else     if (guard.disables(group)) {
      return false;
    }
  }
  return false;
}
Program: 28198
Project: 28198
Buggy source:
/** 
 * Determines whether the given value is eligible to be moved across modules.
 */
private boolean canMoveValue(Node n){
  if (n == null || NodeUtil.isLiteralValue(n) || n.getType() == Token.FUNCTION) {
    return true;
  }
 else   if (n.getType() == Token.CALL) {
    Node functionName=n.getFirstChild();
    return functionName.getType() == Token.NAME && (functionName.getString().equals(CrossModuleMethodMotion.STUB_METHOD_NAME) || functionName.getString().equals(CrossModuleMethodMotion.UNSTUB_METHOD_NAME));
  }
 else   if (n.getType() == Token.ARRAYLIT || n.getType() == Token.OBJECTLIT) {
    for (Node child=n.getFirstChild(); child != null; child=child.getNext()) {
      if (!canMoveValue(child)) {
        return false;
      }
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Determines whether the given value is eligible to be moved across modules.
 */
private boolean canMoveValue(Node n){
  if (n == null || NodeUtil.isLiteralValue(n,true) || n.getType() == Token.FUNCTION) {
    return true;
  }
 else   if (n.getType() == Token.CALL) {
    Node functionName=n.getFirstChild();
    return functionName.getType() == Token.NAME && (functionName.getString().equals(CrossModuleMethodMotion.STUB_METHOD_NAME) || functionName.getString().equals(CrossModuleMethodMotion.UNSTUB_METHOD_NAME));
  }
 else   if (n.getType() == Token.ARRAYLIT || n.getType() == Token.OBJECTLIT) {
    for (Node child=n.getFirstChild(); child != null; child=child.getNext()) {
      if (!canMoveValue(child)) {
        return false;
      }
    }
    return true;
  }
  return false;
}
Program: 28199
Project: 28199
Buggy source:
@Override void visit(NodeTraversal t,Node callNode,Node parent,String callName){
  if (externMethods.contains(callName) || nonMethodProperties.contains(callName)) {
    return;
  }
  Collection<Node> definitions=methodDefinitions.get(callName);
  if (definitions == null || definitions.size() == 0) {
    return;
  }
  Node firstDefinition=definitions.iterator().next();
  if (definitions.size() == 1 || allDefinitionsEquivalent(definitions)) {
    if (!argsMayHaveSideEffects(callNode)) {
      Node returned=returnedExpression(firstDefinition);
      if (returned != null) {
        if (isPropertyTree(returned)) {
          logger.fine("String_Node_Str" + callName);
          inlinePropertyReturn(parent,callNode,returned);
        }
 else         if (NodeUtil.isLiteralValue(returned) && !NodeUtil.mayHaveSideEffects(callNode.getFirstChild())) {
          logger.fine("String_Node_Str" + callName);
          inlineConstReturn(parent,callNode,returned);
        }
      }
 else       if (isEmptyMethod(firstDefinition) && !NodeUtil.mayHaveSideEffects(callNode.getFirstChild())) {
        logger.fine("String_Node_Str" + callName);
        inlineEmptyMethod(t,parent,callNode);
      }
    }
  }
 else {
    logger.fine("String_Node_Str" + callName + "String_Node_Str");
  }
}

Fixed version (ground truth):
@Override void visit(NodeTraversal t,Node callNode,Node parent,String callName){
  if (externMethods.contains(callName) || nonMethodProperties.contains(callName)) {
    return;
  }
  Collection<Node> definitions=methodDefinitions.get(callName);
  if (definitions == null || definitions.size() == 0) {
    return;
  }
  Node firstDefinition=definitions.iterator().next();
  if (definitions.size() == 1 || allDefinitionsEquivalent(definitions)) {
    if (!argsMayHaveSideEffects(callNode)) {
      Node returned=returnedExpression(firstDefinition);
      if (returned != null) {
        if (isPropertyTree(returned)) {
          logger.fine("String_Node_Str" + callName);
          inlinePropertyReturn(parent,callNode,returned);
        }
 else         if (NodeUtil.isLiteralValue(returned,false) && !NodeUtil.mayHaveSideEffects(callNode.getFirstChild())) {
          logger.fine("String_Node_Str" + callName);
          inlineConstReturn(parent,callNode,returned);
        }
      }
 else       if (isEmptyMethod(firstDefinition) && !NodeUtil.mayHaveSideEffects(callNode.getFirstChild())) {
        logger.fine("String_Node_Str" + callName);
        inlineEmptyMethod(t,parent,callNode);
      }
    }
  }
 else {
    logger.fine("String_Node_Str" + callName + "String_Node_Str");
  }
}
Program: 28200
Project: 28200
Buggy source:
/** 
 * If the value is a literal, we can cross more boundaries to inline it.
 */
private boolean canMoveAggressively(Node value){
  return NodeUtil.isLiteralValue(value) || value.getType() == Token.FUNCTION;
}

Fixed version (ground truth):
/** 
 * If the value is a literal, we can cross more boundaries to inline it.
 */
private boolean canMoveAggressively(Node value){
  return NodeUtil.isLiteralValue(value,true) || value.getType() == Token.FUNCTION;
}
Program: 28201
Project: 28201
Buggy source:
/** 
 * If the value of a variable is not constant, then it may read or modify state. Therefore it cannot be moved past anything else that may modify the value being read or read values that are modified.
 */
private boolean canMoveModerately(Reference initialization,Reference reference){
  Iterator<Node> it;
  if (initialization.getParent().getType() == Token.VAR) {
    it=NodeIterators.LocalVarMotion.forVar(initialization.getNameNode(),initialization.getParent(),initialization.getGrandparent());
  }
 else   if (initialization.getParent().getType() == Token.ASSIGN) {
    Preconditions.checkState(initialization.getGrandparent().getType() == Token.EXPR_RESULT);
    it=NodeIterators.LocalVarMotion.forAssign(initialization.getNameNode(),initialization.getParent(),initialization.getGrandparent(),initialization.getGrandparent().getParent());
  }
 else {
    throw new IllegalStateException("String_Node_Str");
  }
  Node targetName=reference.getNameNode();
  while (it.hasNext()) {
    Node curNode=it.next();
    if (curNode == targetName) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * If the value of a variable is not constant, then it may read or modify state. Therefore it cannot be moved past anything else that may modify the value being read or read values that are modified.
 */
private boolean canMoveModerately(Reference initialization,Reference reference){
  Iterator<Node> it;
  if (initialization.getParent().getType() == Token.VAR) {
    it=NodeIterators.LocalVarMotion.forVar(initialization.getNameNode(),initialization.getParent(),initialization.getGrandparent());
  }
 else   if (initialization.getParent().getType() == Token.ASSIGN) {
    Preconditions.checkState(initialization.getGrandparent().getType() == Token.EXPR_RESULT);
    it=NodeIterators.LocalVarMotion.forAssign(initialization.getNameNode(),initialization.getParent(),initialization.getGrandparent(),initialization.getGrandparent().getParent());
  }
 else {
    throw new IllegalStateException("String_Node_Str" + initialization.getParent().toStringTree());
  }
  Node targetName=reference.getNameNode();
  while (it.hasNext()) {
    Node curNode=it.next();
    if (curNode == targetName) {
      return true;
    }
  }
  return false;
}