nus-yam/ex-repair huggingface dataset:
Program: 185302
Project: 185302
Buggy source:
@Test public void testBoolean3(){
  String contents="String_Node_Str";
  int start=contents.indexOf("String_Node_Str");
  int end=start + "String_Node_Str".length();
  assertType(contents,start,end,"String_Node_Str");
}

Fixed version (ground truth):
@Test public void testBoolean3(){
  String contents="String_Node_Str";
  assertExprType(contents,"String_Node_Str","String_Node_Str");
}
Program: 185303
Project: 185303
Buggy source:
@Test public void testSpread7(){
  String contents="String_Node_Str";
  int start=contents.lastIndexOf("String_Node_Str");
  assertType(contents,start,start + "String_Node_Str".length(),"String_Node_Str");
}

Fixed version (ground truth):
@Test public void testSpread7(){
  String contents="String_Node_Str";
  assertExprType(contents,"String_Node_Str","String_Node_Str");
}
Program: 185304
Project: 185304
Buggy source:
@Test public void testSpread8(){
  String contents="String_Node_Str";
  int start=contents.lastIndexOf("String_Node_Str");
  assertType(contents,start,start + "String_Node_Str".length(),"String_Node_Str");
}

Fixed version (ground truth):
@Test public void testSpread8(){
  String contents="String_Node_Str";
  assertExprType(contents,"String_Node_Str","String_Node_Str");
}
Program: 185305
Project: 185305
Buggy source:
@Test public void testSpread5(){
  String contents="String_Node_Str";
  int start=contents.lastIndexOf("String_Node_Str");
  assertType(contents,start,start + "String_Node_Str".length(),"String_Node_Str");
}

Fixed version (ground truth):
@Test public void testSpread5(){
  String contents="String_Node_Str";
  assertExprType(contents,"String_Node_Str","String_Node_Str");
}
Program: 185306
Project: 185306
Buggy source:
@Test public void testSpread6(){
  String contents="String_Node_Str";
  int start=contents.lastIndexOf("String_Node_Str");
  assertType(contents,start,start + "String_Node_Str".length(),"String_Node_Str");
}

Fixed version (ground truth):
@Test public void testSpread6(){
  String contents="String_Node_Str";
  assertExprType(contents,"String_Node_Str","String_Node_Str");
}
Program: 185307
Project: 185307
Buggy source:
@Test public void testSpread9(){
  String contents="String_Node_Str";
  int start=contents.lastIndexOf("String_Node_Str");
  assertType(contents,start,start + "String_Node_Str".length(),"String_Node_Str");
}

Fixed version (ground truth):
@Test public void testSpread9(){
  String contents="String_Node_Str";
  assertExprType(contents,"String_Node_Str","String_Node_Str");
}
Program: 185308
Project: 185308
Buggy source:
@Test public void testMatcher2(){
  String contents="String_Node_Str";
  int start=contents.indexOf("String_Node_Str");
  int end=start + "String_Node_Str".length();
  assertType(contents,start,end,"String_Node_Str");
}

Fixed version (ground truth):
@Test public void testMatcher2(){
  String contents="String_Node_Str";
  assertExprType(contents,"String_Node_Str","String_Node_Str");
}
Program: 185309
Project: 185309
Buggy source:
@Test public void testSpread3(){
  String contents="String_Node_Str";
  int start=contents.lastIndexOf("String_Node_Str");
  assertType(contents,start,start + "String_Node_Str".length(),"String_Node_Str");
}

Fixed version (ground truth):
@Test public void testSpread3(){
  String contents="String_Node_Str";
  assertExprType(contents,"String_Node_Str","String_Node_Str");
}
Program: 185310
Project: 185310
Buggy source:
@Test public void testSpread4(){
  String contents="String_Node_Str";
  int start=contents.lastIndexOf("String_Node_Str");
  assertType(contents,start,start + "String_Node_Str".length(),"String_Node_Str");
}

Fixed version (ground truth):
@Test public void testSpread4(){
  String contents="String_Node_Str";
  assertExprType(contents,"String_Node_Str","String_Node_Str");
}
Program: 185311
Project: 185311
Buggy source:
@Test public void testSpread1(){
  String contents="String_Node_Str";
  int start=contents.lastIndexOf("String_Node_Str");
  assertType(contents,start,start + "String_Node_Str".length(),"String_Node_Str");
}

Fixed version (ground truth):
@Test public void testSpread1(){
  String contents="String_Node_Str";
  assertExprType(contents,"String_Node_Str","String_Node_Str");
}
Program: 185312
Project: 185312
Buggy source:
@Test public void testMatcher1(){
  String contents="String_Node_Str";
  int start=contents.lastIndexOf("String_Node_Str");
  int end=start + "String_Node_Str".length();
  assertType(contents,start,end,"String_Node_Str");
}

Fixed version (ground truth):
@Test public void testMatcher1(){
  String contents="String_Node_Str";
  assertExprType(contents,"String_Node_Str","String_Node_Str");
}
Program: 185313
Project: 185313
Buggy source:
@Test public void testSpread2(){
  String contents="String_Node_Str";
  int start=contents.lastIndexOf("String_Node_Str");
  assertType(contents,start,start + "String_Node_Str".length(),"String_Node_Str");
}

Fixed version (ground truth):
@Test public void testSpread2(){
  String contents="String_Node_Str";
  assertExprType(contents,"String_Node_Str","String_Node_Str");
}
Program: 185314
Project: 185314
Buggy source:
@Test public void testClassLiteral4(){
  String contents="String_Node_Str";
  int start=contents.indexOf("String_Node_Str"), end=start + 3;
  assertType(contents,start,end,"String_Node_Str");
}

Fixed version (ground truth):
@Test public void testClassLiteral4(){
  String contents="String_Node_Str";
  assertExprType(contents,"String_Node_Str","String_Node_Str");
}
Program: 185315
Project: 185315
Buggy source:
@Test public void testClassLiteral3(){
  String contents="String_Node_Str";
  int start=contents.indexOf("String_Node_Str"), end=start + 3;
  assertType(contents,start,end,"String_Node_Str");
}

Fixed version (ground truth):
@Test public void testClassLiteral3(){
  String contents="String_Node_Str";
  assertExprType(contents,"String_Node_Str","String_Node_Str");
}
Program: 185316
Project: 185316
Buggy source:
@Test public void testClassLiteral2(){
  String contents="String_Node_Str";
  int start=contents.indexOf("String_Node_Str"), end=start + 3;
  assertType(contents,start,end,"String_Node_Str");
}

Fixed version (ground truth):
@Test public void testClassLiteral2(){
  String contents="String_Node_Str";
  assertExprType(contents,"String_Node_Str","String_Node_Str");
}
Program: 185317
Project: 185317
Buggy source:
@Test public void testClassLiteral1(){
  String contents="String_Node_Str";
  int start=contents.indexOf("String_Node_Str"), end=start + 3;
  assertType(contents,start,end,"String_Node_Str");
}

Fixed version (ground truth):
@Test public void testClassLiteral1(){
  String contents="String_Node_Str";
  assertExprType(contents,"String_Node_Str","String_Node_Str");
}
Program: 185318
Project: 185318
Buggy source:
@Test public void testClassLiteral5(){
  String contents="String_Node_Str";
  int start=contents.indexOf("String_Node_Str"), end=start + 3;
  assertType(contents,start,end,"String_Node_Str");
}

Fixed version (ground truth):
@Test public void testClassLiteral5(){
  String contents="String_Node_Str";
  assertExprType(contents,"String_Node_Str","String_Node_Str");
}
Program: 185319
Project: 185319
Buggy source:
@Test public void testBoolean6(){
  String contents="String_Node_Str";
  int start=contents.indexOf("String_Node_Str");
  int end=start + "String_Node_Str".length();
  assertType(contents,start,end,"String_Node_Str");
}

Fixed version (ground truth):
@Test public void testBoolean6(){
  String contents="String_Node_Str";
  assertExprType(contents,"String_Node_Str","String_Node_Str");
}
Program: 185320
Project: 185320
Buggy source:
@Test public void testBoolean7(){
  String contents="String_Node_Str";
  int start=contents.indexOf("String_Node_Str");
  int end=start + "String_Node_Str".length();
  assertType(contents,start,end,"String_Node_Str");
}

Fixed version (ground truth):
@Test public void testBoolean7(){
  String contents="String_Node_Str";
  assertExprType(contents,"String_Node_Str","String_Node_Str");
}
Program: 185321
Project: 185321
Buggy source:
public PackageBinding getPackage(char[][] packageName,ModuleBinding moduleBinding){
}

Fixed version (ground truth):
public PackageBinding getPackage(char[][] packageName,ModuleBinding moduleBinding){
  if (packageName != null && packageName.length == 2) {
    PackageBinding parent=getTopLevelPackage(packageName[0]);
    if (parent != null) {
      Binding binding=parent.getTypeOrPackage(packageName[1],moduleBinding);
      if ((binding instanceof PackageBinding) && binding.isValidBinding()) {
        return (PackageBinding)binding;
      }
    }
  }
  org.eclipse.jdt.internal.core.util.Util.log(org.eclipse.core.runtime.IStatus.WARNING,"String_Node_Str" + CharOperation.toString(packageName));
  return TheNotFoundPackage;
}
Program: 185322
Project: 185322
Buggy source:
public PackageBinding getPackage(char[][] packageName,ModuleBinding moduleBinding){
}

Fixed version (ground truth):
public PackageBinding getPackage(char[][] packageName,ModuleBinding moduleBinding){
  if (packageName != null && packageName.length == 2) {
    PackageBinding parent=getTopLevelPackage(packageName[0]);
    if (parent != null) {
      Binding binding=parent.getTypeOrPackage(packageName[1],moduleBinding);
      if ((binding instanceof PackageBinding) && binding.isValidBinding()) {
        return (PackageBinding)binding;
      }
    }
  }
  org.eclipse.jdt.internal.core.util.Util.log(org.eclipse.core.runtime.IStatus.WARNING,"String_Node_Str" + CharOperation.toString(packageName));
  return TheNotFoundPackage;
}
Program: 185324
Project: 185324
Buggy source:
protected void addError(String msg,ASTNode expr){
  int line=expr.getLineNumber();
  int col=expr.getColumnNumber();
  int start=expr.getStart();
  int end=expr.getEnd() - 1;
  if (expr instanceof ClassNode) {
    ClassNode cn=(ClassNode)expr;
    if (cn.getNameEnd() > 0) {
      start=cn.getNameStart();
      end=cn.getNameEnd();
    }
 else     if (cn.getComponentType() != null) {
      end-=1;
    }
  }
 else   if (expr instanceof DeclarationExpression) {
    DeclarationExpression decl=(DeclarationExpression)expr;
    Expression lhs=decl.getLeftExpression();
    start=lhs.getStart();
    end=lhs instanceof VariableExpression ? start + lhs.getText().length() - 1 : lhs.getEnd() - 1;
  }
  SourceUnit source=getSourceUnit();
  source.getErrorCollector().addErrorAndContinue(new SyntaxErrorMessage(new PreciseSyntaxException(msg + '\n',line,col,start,end),source));
}

Fixed version (ground truth):
protected void addError(String msg,ASTNode node){
  int start, end;
  if (node instanceof AnnotatedNode && ((AnnotatedNode)node).getNameEnd() > 0) {
    start=((AnnotatedNode)node).getNameStart();
    end=((AnnotatedNode)node).getNameEnd();
  }
 else   if (!(node instanceof DeclarationExpression)) {
    start=node.getStart();
    end=node.getEnd() - 1;
    if (node instanceof ClassNode && ((ClassNode)node).isArray()) {
      end-=1;
    }
  }
 else {
    addError(msg,((DeclarationExpression)node).getLeftExpression());
    return;
  }
  SourceUnit source=getSourceUnit();
  source.getErrorCollector().addErrorAndContinue(new SyntaxErrorMessage(new PreciseSyntaxException(msg + '\n',node.getLineNumber(),node.getColumnNumber(),start,end),source));
}
Program: 185325
Project: 185325
Buggy source:
protected void addTypeError(String msg,ClassNode expr){
  SourceUnit source=getSourceUnit();
  source.getErrorCollector().addErrorAndContinue(new SyntaxErrorMessage(new PreciseSyntaxException(msg + '\n',expr.getLineNumber(),expr.getColumnNumber(),expr.getNameStart(),expr.getNameEnd()),source));
}

Fixed version (ground truth):
@Deprecated protected void addTypeError(String msg,ClassNode node){
  addError(msg,node);
}
Program: 185326
Project: 185326
Buggy source:
@Override public void visitDeclarationExpression(DeclarationExpression expression){
  visitAnnotations(expression);
  super.visitDeclarationExpression(expression);
}

Fixed version (ground truth):
public void visitDeclarationExpression(DeclarationExpression expression){
  visitAnnotations(expression);
  super.visitDeclarationExpression(expression);
}
Program: 185327
Project: 185327
Buggy source:
@Override public void visitConstantExpression(ConstantExpression expression){
  Expression original=expression.getNodeMetaData(ORIGINAL_EXPRESSION);
  if (original != null) {
    original.visit(this);
  }
}

Fixed version (ground truth):
public void visitConstantExpression(ConstantExpression expression){
  Expression original=expression.getNodeMetaData(ORIGINAL_EXPRESSION);
  if (original != null) {
    original.visit(this);
  }
}
Program: 185328
Project: 185328
Buggy source:
private void checkImplementsAndExtends(ClassNode node){
  ClassNode cn=node.getSuperClass();
  if (cn.isInterface() && !node.isInterface()) {
    addTypeError("String_Node_Str" + getDescription(cn) + "String_Node_Str",node);
  }
  for (  ClassNode anInterface : node.getInterfaces()) {
    cn=anInterface;
    if (!cn.isInterface()) {
      addTypeError("String_Node_Str" + getDescription(cn) + "String_Node_Str",node);
    }
  }
}

Fixed version (ground truth):
private void checkImplementsAndExtends(ClassNode node){
  ClassNode cn=node.getSuperClass();
  if (cn.isInterface() && !node.isInterface()) {
    addError("String_Node_Str" + getDescription(cn) + "String_Node_Str",node);
  }
  for (  ClassNode anInterface : node.getInterfaces()) {
    cn=anInterface;
    if (!cn.isInterface()) {
      addError("String_Node_Str" + getDescription(cn) + "String_Node_Str",node);
    }
  }
}
Program: 185329
Project: 185329
Buggy source:
private void addWeakerAccessError(ClassNode cn,MethodNode method,Parameter[] parameters,MethodNode superMethod){
  StringBuilder msg=new StringBuilder();
  msg.append(method.getName());
  appendParamsDescription(parameters,msg);
  msg.append("String_Node_Str");
  msg.append(cn.getName());
  msg.append("String_Node_Str");
  msg.append(superMethod.getName());
  msg.append("String_Node_Str");
  msg.append(superMethod.getDeclaringClass().getName());
  msg.append("String_Node_Str");
  msg.append(superMethod.isPublic() ? "String_Node_Str" : "String_Node_Str");
  addError(msg.toString(),method);
}

Fixed version (ground truth):
private void addWeakerAccessError(ClassNode cn,MethodNode method,Parameter[] parameters,MethodNode superMethod){
  StringBuilder msg=new StringBuilder();
  msg.append(method.getName());
  appendParamsDescription(parameters,msg);
  msg.append("String_Node_Str");
  msg.append(cn.getName());
  msg.append("String_Node_Str");
  msg.append(superMethod.getName());
  msg.append("String_Node_Str");
  msg.append(superMethod.getDeclaringClass().getName());
  msg.append("String_Node_Str");
  msg.append(superMethod.isPublic() ? "String_Node_Str" : (superMethod.isProtected() ? "String_Node_Str" : "String_Node_Str"));
  addError(msg.toString(),method);
}
Program: 185330
Project: 185330
Buggy source:
private void checkMethodForWeakerAccessPrivileges(MethodNode mn,ClassNode cn){
  if (mn.isPublic())   return;
  Parameter[] params=mn.getParameters();
  for (  MethodNode superMethod : cn.getSuperClass().getMethods(mn.getName())) {
    Parameter[] superParams=superMethod.getParameters();
    if (!hasEqualParameterTypes(params,superParams))     continue;
    if ((mn.isPrivate() && !superMethod.isPrivate()) || (mn.isProtected() && superMethod.isPublic())) {
      addWeakerAccessError(cn,mn,params,superMethod);
      return;
    }
  }
}

Fixed version (ground truth):
private void checkMethodForWeakerAccessPrivileges(MethodNode mn,ClassNode cn){
  if (mn.isPublic())   return;
  Parameter[] params=mn.getParameters();
  for (  MethodNode superMethod : cn.getSuperClass().getMethods(mn.getName())) {
    Parameter[] superParams=superMethod.getParameters();
    if (!hasEqualParameterTypes(params,superParams))     continue;
    if ((mn.isPrivate() && !superMethod.isPrivate()) || (mn.isProtected() && !superMethod.isProtected() && !superMethod.isPrivate()) || (!mn.isPrivate() && !mn.isProtected() && !mn.isPublic()&& (superMethod.isPublic() || superMethod.isProtected()))) {
      addWeakerAccessError(cn,mn,params,superMethod);
      return;
    }
  }
}
Program: 185331
Project: 185331
Buggy source:
private void checkNoAbstractMethodsNonabstractClass(ClassNode node){
  if (isAbstract(node.getModifiers()))   return;
  List<MethodNode> abstractMethods=node.getAbstractMethods();
  if (abstractMethods == null)   return;
  for (  MethodNode method : abstractMethods) {
    MethodNode sameArgsMethod=node.getMethod(method.getName(),method.getParameters());
    if (sameArgsMethod == null || method.getReturnType().equals(sameArgsMethod.getReturnType())) {
      addTypeError("String_Node_Str" + "String_Node_Str" + getDescription(node) + "String_Node_Str"+ "String_Node_Str"+ getDescription(method)+ "String_Node_Str",node);
    }
 else {
      addError("String_Node_Str" + getDescription(method) + "String_Node_Str"+ "String_Node_Str"+ (sameArgsMethod.isStatic() ? "String_Node_Str" : "String_Node_Str")+ getDescription(sameArgsMethod),method);
    }
  }
}

Fixed version (ground truth):
private void checkNoAbstractMethodsNonabstractClass(ClassNode node){
  if (isAbstract(node.getModifiers()))   return;
  List<MethodNode> abstractMethods=node.getAbstractMethods();
  if (abstractMethods == null)   return;
  for (  MethodNode method : abstractMethods) {
    MethodNode sameArgsMethod=node.getMethod(method.getName(),method.getParameters());
    if (sameArgsMethod == null || method.getReturnType().equals(sameArgsMethod.getReturnType())) {
      addError("String_Node_Str" + "String_Node_Str" + getDescription(node) + "String_Node_Str"+ "String_Node_Str"+ getDescription(method)+ "String_Node_Str",node);
    }
 else {
      addError("String_Node_Str" + getDescription(method) + "String_Node_Str"+ "String_Node_Str"+ (sameArgsMethod.isStatic() ? "String_Node_Str" : "String_Node_Str")+ getDescription(sameArgsMethod),method);
    }
  }
}
Program: 185332
Project: 185332
Buggy source:
public void addError(String msg,ASTNode expr){
  int line=expr.getLineNumber();
  int col=expr.getColumnNumber();
  int start=expr.getStart();
  int end=expr.getEnd() - 1;
  if (expr instanceof ClassNode) {
    ClassNode cn=(ClassNode)expr;
    if (cn.getNameEnd() > 0) {
      start=cn.getNameStart();
      end=cn.getNameEnd();
    }
  }
 else   if (expr instanceof DeclarationExpression) {
    DeclarationExpression decl=(DeclarationExpression)expr;
    Expression lhs=decl.getLeftExpression();
    start=lhs.getStart();
    end=lhs instanceof VariableExpression ? start + lhs.getText().length() - 1 : lhs.getEnd() - 1;
  }
  SourceUnit source=getSourceUnit();
  source.getErrorCollector().addErrorAndContinue(new SyntaxErrorMessage(new PreciseSyntaxException(msg + '\n',line,col,start,end),source));
}

Fixed version (ground truth):
public void addError(String msg,ASTNode node){
  int start, end;
  if (node instanceof AnnotatedNode && ((AnnotatedNode)node).getNameEnd() > 0) {
    start=((AnnotatedNode)node).getNameStart();
    end=((AnnotatedNode)node).getNameEnd();
  }
 else   if (!(node instanceof DeclarationExpression)) {
    start=node.getStart();
    end=node.getEnd() - 1;
  }
 else {
    addError(msg,((DeclarationExpression)node).getLeftExpression());
    return;
  }
  SourceUnit source=getSourceUnit();
  source.getErrorCollector().addErrorAndContinue(new SyntaxErrorMessage(new PreciseSyntaxException(msg + '\n',node.getLineNumber(),node.getColumnNumber(),start,end),source));
}
Program: 185333
Project: 185333
Buggy source:
@Test public void testDelegateAnnotationFromOtherMethod() throws Exception {
  createUnit("String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
  GroovyCompilationUnit unit=createUnit("String_Node_Str","String_Node_Str");
  env.fullBuild();
  expectingNoProblems();
  ClassNode clazz=getClassFromScript(unit);
  MethodNode method=null;
  for (  MethodNode m : clazz.getMethods()) {
    if ("String_Node_Str".equals(m.getName())) {
      method=m;
    }
  }
  assertAnnotation("String_Node_Str",method);
}

Fixed version (ground truth):
@Test public void testDelegateAnnotationFromOtherMethod() throws Exception {
  createUnit("String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
  GroovyCompilationUnit unit=createUnit("String_Node_Str","String_Node_Str");
  env.fullBuild();
  expectingNoProblems();
  MethodNode meth=getClassFromScript(unit).getMethods("String_Node_Str").stream().filter(mn -> mn.getParameters()[0].getType().getName().equals("String_Node_Str")).findFirst().get();
  assertAnnotation("String_Node_Str",meth);
}
Program: 185334
Project: 185334
Buggy source:
@Test public void testOverriding_FinalMethod2(){
  runNegativeTest(new String[]{"String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str","String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"},"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}

Fixed version (ground truth):
@Test public void testOverriding_FinalMethod2(){
  runNegativeTest(new String[]{"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: 185335
Project: 185335
Buggy source:
@Test public void testOverriding_FinalMethod1(){
  runNegativeTest(new String[]{"String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str","String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"},"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}

Fixed version (ground truth):
@Test public void testOverriding_FinalMethod1(){
  runNegativeTest(new String[]{"String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str","String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"},"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}
Program: 185336
Project: 185336
Buggy source:
/** 
 * Wraps up any pending operations for the current phase and switches to the next phase.
 */
public void gotoPhase(int phase) throws CompilationFailedException {
  if (!this.phaseComplete) {
    completePhase();
  }
  this.phase=phase;
  this.phaseComplete=false;
}

Fixed version (ground truth):
/** 
 * Wraps up any pending operations for the current phase and switches to the next phase.
 */
public void gotoPhase(int phase) throws CompilationFailedException {
  if (!phaseComplete) {
    completePhase();
  }
  this.phase=phase;
  phaseComplete=false;
}
Program: 185337
Project: 185337
Buggy source:
/** 
 * Returns the description for the current phase.
 */
public String getPhaseDescription(){
  return Phases.getDescription(this.phase);
}

Fixed version (ground truth):
/** 
 * Returns the description for the current phase.
 */
public String getPhaseDescription(){
  return Phases.getDescription(phase);
}
Program: 185338
Project: 185338
Buggy source:
/** 
 * A synonym for <code>gotoPhase( phase + 1 )</code>.
 */
public void nextPhase() throws CompilationFailedException {
  gotoPhase(this.phase + 1);
}

Fixed version (ground truth):
/** 
 * A synonym for <code>gotoPhase( phase + 1 )</code>.
 */
public void nextPhase() throws CompilationFailedException {
  gotoPhase(phase + 1);
}
Program: 185339
Project: 185339
Buggy source:
/** 
 * Returns the current phase.
 */
public int getPhase(){
  return this.phase;
}

Fixed version (ground truth):
/** 
 * Returns the current phase.
 */
public int getPhase(){
  return phase;
}
Program: 185340
Project: 185340
Buggy source:
/** 
 * Wraps up any pending operations for the current phase and switches to the next phase.
 */
public void gotoPhase(int phase) throws CompilationFailedException {
  if (!this.phaseComplete) {
    completePhase();
  }
  this.phase=phase;
  this.phaseComplete=false;
}

Fixed version (ground truth):
/** 
 * Wraps up any pending operations for the current phase and switches to the next phase.
 */
public void gotoPhase(int phase) throws CompilationFailedException {
  if (!phaseComplete) {
    completePhase();
  }
  this.phase=phase;
  phaseComplete=false;
}
Program: 185341
Project: 185341
Buggy source:
/** 
 * Returns the description for the current phase.
 */
public String getPhaseDescription(){
  return Phases.getDescription(this.phase);
}

Fixed version (ground truth):
/** 
 * Returns the description for the current phase.
 */
public String getPhaseDescription(){
  return Phases.getDescription(phase);
}
Program: 185342
Project: 185342
Buggy source:
/** 
 * A synonym for <code>gotoPhase( phase + 1 )</code>.
 */
public void nextPhase() throws CompilationFailedException {
  gotoPhase(this.phase + 1);
}

Fixed version (ground truth):
/** 
 * A synonym for <code>gotoPhase( phase + 1 )</code>.
 */
public void nextPhase() throws CompilationFailedException {
  gotoPhase(phase + 1);
}
Program: 185343
Project: 185343
Buggy source:
/** 
 * Returns the current phase.
 */
public int getPhase(){
  return this.phase;
}

Fixed version (ground truth):
/** 
 * Returns the current phase.
 */
public int getPhase(){
  return phase;
}
Program: 185344
Project: 185344
Buggy source:
@Ignore @Test public void testDGM28(){
  String contents="String_Node_Str";
  assertExprType(contents,"String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
@Test public void testDGM28(){
  String contents="String_Node_Str";
  assertExprType(contents,"String_Node_Str","String_Node_Str");
}
Program: 185345
Project: 185345
Buggy source:
@Test public void testDGM43(){
  String contents="String_Node_Str";
  assertExprType(contents,"String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
@Test @Ignore("String_Node_Str") public void testDGM43(){
  String contents="String_Node_Str";
  assertExprType(contents,"String_Node_Str","String_Node_Str");
}
Program: 185346
Project: 185346
Buggy source:
@Test public void testStaticReference5(){
  String contents="String_Node_Str";
  assertKnown(contents,"String_Node_Str","String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
@Test public void testStaticReference5(){
  String contents="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  assertKnown(contents,"String_Node_Str","String_Node_Str","String_Node_Str");
}
Program: 185347
Project: 185347
Buggy source:
@Test public void testStaticReference6(){
  String contents="String_Node_Str";
  assertUnknown(contents,"String_Node_Str");
}

Fixed version (ground truth):
@Test public void testStaticReference6(){
  String contents="String_Node_Str";
  assertKnown(contents,"String_Node_Str","String_Node_Str","String_Node_Str");
}
Program: 185349
Project: 185349
Buggy source:
public ModuleNode buildAST(SourceUnit sourceUnit,ClassLoader classLoader,Reduction cst) throws ParserException {
  setClassLoader(classLoader);
  makeModule();
  try {
    innerClassCounter=1;
    convertGroovy(ast);
    if (looksBroken(output) && output.getMethods().isEmpty() && sourceUnit.getErrorCollector().hasErrors()) {
      output.setEncounteredUnrecoverableError(true);
    }
    if (output.getStatementBlock().isEmpty() && output.getMethods().isEmpty() && output.getClasses().isEmpty()) {
      if (ast == null && sourceUnit.getErrorCollector().hasErrors()) {
        output.setEncounteredUnrecoverableError(true);
      }
      output.addStatement(ReturnStatement.RETURN_NULL_OR_VOID);
    }
    ClassNode scriptClassNode=output.getScriptClassDummy();
    if (scriptClassNode != null) {
      List<Statement> statements=output.getStatementBlock().getStatements();
      if (!statements.isEmpty()) {
        Statement firstStatement=statements.get(0);
        Statement lastStatement=statements.get(statements.size() - 1);
        scriptClassNode.setSourcePosition(firstStatement);
        scriptClassNode.setLastColumnNumber(lastStatement.getLastColumnNumber());
        scriptClassNode.setLastLineNumber(lastStatement.getLastLineNumber());
      }
    }
    fixModuleNodeLocations();
  }
 catch (  ASTRuntimeException e) {
    throw new ASTParserException(e.getMessage() + "String_Node_Str" + sourceUnit.getName(),e);
  }
  ast=null;
  return output;
}

Fixed version (ground truth):
public ModuleNode buildAST(SourceUnit sourceUnit,ClassLoader classLoader,Reduction cst) throws ParserException {
  setClassLoader(classLoader);
  makeModule();
  try {
    innerClassCounter=1;
    convertGroovy(ast);
    if (looksBroken(output) && output.getMethods().isEmpty() && sourceUnit.getErrorCollector().hasErrors()) {
      output.setEncounteredUnrecoverableError(true);
    }
    if (output.getStatementBlock().isEmpty() && output.getMethods().isEmpty() && output.getClasses().isEmpty()) {
      if (ast == null && sourceUnit.getErrorCollector().hasErrors()) {
        output.setEncounteredUnrecoverableError(true);
      }
      output.addStatement(ReturnStatement.RETURN_NULL_OR_VOID);
    }
    ClassNode scriptClassNode=output.getScriptClassDummy();
    if (scriptClassNode != null) {
      List<Statement> statements=output.getStatementBlock().getStatements();
      if (!statements.isEmpty()) {
        Statement firstStatement=statements.get(0);
        Statement lastStatement=statements.get(statements.size() - 1);
        scriptClassNode.setSourcePosition(firstStatement);
        scriptClassNode.setLastColumnNumber(lastStatement.getLastColumnNumber());
        scriptClassNode.setLastLineNumber(lastStatement.getLastLineNumber());
      }
    }
    fixModuleNodeLocations();
    output.putNodeMetaData(LocationSupport.class,locations);
  }
 catch (  ASTRuntimeException e) {
    throw new ASTParserException(e.getMessage() + "String_Node_Str" + sourceUnit.getName(),e);
  }
  ast=null;
  return output;
}
Program: 185350
Project: 185350
Buggy source:
public ModuleNode buildAST(SourceUnit sourceUnit,ClassLoader classLoader,Reduction cst) throws ParserException {
  setClassLoader(classLoader);
  makeModule();
  try {
    innerClassCounter=1;
    convertGroovy(ast);
    if (looksBroken(output) && output.getMethods().isEmpty() && sourceUnit.getErrorCollector().hasErrors()) {
      output.setEncounteredUnrecoverableError(true);
    }
    if (output.getStatementBlock().isEmpty() && output.getMethods().isEmpty() && output.getClasses().isEmpty()) {
      if (ast == null && sourceUnit.getErrorCollector().hasErrors()) {
        output.setEncounteredUnrecoverableError(true);
      }
      output.addStatement(ReturnStatement.RETURN_NULL_OR_VOID);
    }
    ClassNode scriptClassNode=output.getScriptClassDummy();
    if (scriptClassNode != null) {
      List<Statement> statements=output.getStatementBlock().getStatements();
      if (!statements.isEmpty()) {
        Statement firstStatement=statements.get(0);
        Statement lastStatement=statements.get(statements.size() - 1);
        scriptClassNode.setSourcePosition(firstStatement);
        scriptClassNode.setLastColumnNumber(lastStatement.getLastColumnNumber());
        scriptClassNode.setLastLineNumber(lastStatement.getLastLineNumber());
      }
    }
    fixModuleNodeLocations();
  }
 catch (  ASTRuntimeException e) {
    throw new ASTParserException(e.getMessage() + "String_Node_Str" + sourceUnit.getName(),e);
  }
  ast=null;
  return output;
}

Fixed version (ground truth):
public ModuleNode buildAST(SourceUnit sourceUnit,ClassLoader classLoader,Reduction cst) throws ParserException {
  setClassLoader(classLoader);
  makeModule();
  try {
    innerClassCounter=1;
    convertGroovy(ast);
    if (looksBroken(output) && output.getMethods().isEmpty() && sourceUnit.getErrorCollector().hasErrors()) {
      output.setEncounteredUnrecoverableError(true);
    }
    if (output.getStatementBlock().isEmpty() && output.getMethods().isEmpty() && output.getClasses().isEmpty()) {
      if (ast == null && sourceUnit.getErrorCollector().hasErrors()) {
        output.setEncounteredUnrecoverableError(true);
      }
      output.addStatement(ReturnStatement.RETURN_NULL_OR_VOID);
    }
    ClassNode scriptClassNode=output.getScriptClassDummy();
    if (scriptClassNode != null) {
      List<Statement> statements=output.getStatementBlock().getStatements();
      if (!statements.isEmpty()) {
        Statement firstStatement=statements.get(0);
        Statement lastStatement=statements.get(statements.size() - 1);
        scriptClassNode.setSourcePosition(firstStatement);
        scriptClassNode.setLastColumnNumber(lastStatement.getLastColumnNumber());
        scriptClassNode.setLastLineNumber(lastStatement.getLastLineNumber());
      }
    }
    fixModuleNodeLocations();
    output.putNodeMetaData(LocationSupport.class,locations);
  }
 catch (  ASTRuntimeException e) {
    throw new ASTParserException(e.getMessage() + "String_Node_Str" + sourceUnit.getName(),e);
  }
  ast=null;
  return output;
}
Program: 185353
Project: 185353
Buggy source:
public EclipseSourceUnit(IFile resource,String filepath,String string,CompilerConfiguration groovyCompilerConfig,GroovyClassLoader classLoader,ErrorCollector errorCollector,JDTResolver resolver){
  super(filepath,string,groovyCompilerConfig,classLoader,errorCollector);
  this.file=resource;
  this.resolver=resolver;
}

Fixed version (ground truth):
public EclipseSourceUnit(IFile file,String filePath,String sourceCode,boolean isReconcile,CompilerConfiguration compilerConfig,GroovyClassLoader classLoader,ErrorCollector errorCollector,JDTResolver resolver){
  super(filePath,sourceCode,compilerConfig,classLoader,errorCollector);
  this.file=file;
  this.resolver=resolver;
  this.isReconcile=isReconcile;
}
Program: 185354
Project: 185354
Buggy source:
@Override public CompilationUnitDeclaration newCompilationUnitDeclaration(ICompilationUnit icu,ProblemReporter problemReporter,CompilationResult compilationResult,int sourceLength){
  if (ContentTypeUtils.isGroovyLikeFileName(compilationResult.getFileName())) {
    CompilerConfiguration compilerConfig=newCompilerConfiguration(problemReporter.options,problemReporter);
    GroovyClassLoader classLoader=null;
    ErrorCollector errorCollector=new GroovyErrorCollectorForJDT(compilerConfig);
    SourceUnit groovySourceUnit=new SourceUnit(String.valueOf(compilationResult.getFileName()),String.valueOf(icu.getContents()),compilerConfig,classLoader,errorCollector);
    org.codehaus.groovy.control.CompilationUnit gcu=new org.codehaus.groovy.control.CompilationUnit(compilerConfig);
    JDTResolver resolver=new JDTResolver(gcu);
    gcu.setResolveVisitor(resolver);
    compilationResult.lineSeparatorPositions=GroovyUtils.getSourceLineSeparatorsIn(icu.getContents());
    gcu.addSource(groovySourceUnit);
    GroovyCompilationUnitDeclaration decl=new GroovyCompilationUnitDeclaration(problemReporter,compilationResult,sourceLength,gcu,groovySourceUnit,problemReporter.options);
    decl.processToPhase(Phases.CONVERSION);
    if (decl.getModuleNode() != null) {
      decl.populateCompilationUnitDeclaration();
      for (      TypeDeclaration type : decl.types) {
        resolver.record((GroovyTypeDeclaration)type);
      }
    }
    return decl;
  }
 else {
    return new CompilationUnitDeclaration(problemReporter,compilationResult,sourceLength);
  }
}

Fixed version (ground truth):
@Override public CompilationUnitDeclaration newCompilationUnitDeclaration(ICompilationUnit icu,ProblemReporter problemReporter,CompilationResult compilationResult,int sourceLength){
  if (ContentTypeUtils.isGroovyLikeFileName(compilationResult.getFileName())) {
    CompilerConfiguration compilerConfig=newCompilerConfiguration(problemReporter.options,problemReporter);
    GroovyClassLoader classLoader=null;
    ErrorCollector errorCollector=new GroovyErrorCollectorForJDT(compilerConfig);
    SourceUnit groovySourceUnit=new SourceUnit(String.valueOf(compilationResult.getFileName()),String.valueOf(icu.getContents()),compilerConfig,classLoader,errorCollector);
    org.codehaus.groovy.control.CompilationUnit gcu=new org.codehaus.groovy.control.CompilationUnit(compilerConfig);
    JDTResolver resolver=new JDTResolver(gcu);
    gcu.setResolveVisitor(resolver);
    gcu.addSource(groovySourceUnit);
    compilationResult.lineSeparatorPositions=GroovyUtils.getSourceLineSeparatorsIn(icu.getContents());
    GroovyCompilationUnitDeclaration decl=new GroovyCompilationUnitDeclaration(problemReporter,compilationResult,sourceLength,gcu,groovySourceUnit,problemReporter.options);
    decl.processToPhase(Phases.CONVERSION);
    if (decl.getModuleNode() != null) {
      decl.populateCompilationUnitDeclaration();
      for (      TypeDeclaration type : decl.types) {
        resolver.record((GroovyTypeDeclaration)type);
      }
    }
    return decl;
  }
 else {
    return new CompilationUnitDeclaration(problemReporter,compilationResult,sourceLength);
  }
}
Program: 185356
Project: 185356
Buggy source:
/** 
 * Configure an options map (usually retrieved from a CompilerOptions object) based on the project. If anything goes wrong it will configure the options to just build java.
 */
public static void configureOptionsBasedOnNature(Map<String,String> options,IJavaProject javaProject){
  try {
    IProject project=javaProject.getProject();
    if (isGroovyNaturedProject(project)) {
      options.put(CompilerOptions.OPTIONG_GroovyExcludeGlobalASTScan,project.getFile(javaProject.getOutputLocation().removeFirstSegments(1)).getRawLocation().toOSString());
      options.put(CompilerOptions.OPTIONG_GroovyProjectName,javaProject.getElementName());
      options.put(CompilerOptions.OPTIONG_BuildGroovyFiles,CompilerOptions.ENABLED);
      if (isProbablyGrailsProject(project)) {
        options.put(CompilerOptions.OPTIONG_GroovyFlags,Integer.toString(IsGrails));
      }
 else {
        options.put(CompilerOptions.OPTIONG_GroovyFlags,"String_Node_Str");
      }
    }
 else {
      options.put(CompilerOptions.OPTIONG_BuildGroovyFiles,CompilerOptions.DISABLED);
      options.put(CompilerOptions.OPTIONG_GroovyFlags,"String_Node_Str");
    }
  }
 catch (  CoreException e) {
    Util.log(e,"String_Node_Str");
    options.put(CompilerOptions.OPTIONG_BuildGroovyFiles,CompilerOptions.DISABLED);
    options.put(CompilerOptions.OPTIONG_GroovyFlags,"String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Configure an options map (usually retrieved from a CompilerOptions object) based on the project. If anything goes wrong it will configure the options to just build java.
 */
public static void configureOptionsBasedOnNature(Map<String,String> options,IJavaProject javaProject){
  IProject project=javaProject.getProject();
  try {
    if (isGroovyNaturedProject(project)) {
      options.put(CompilerOptions.OPTIONG_GroovyExcludeGlobalASTScan,getAbsoluteLocation(javaProject.getOutputLocation(),project));
      options.put(CompilerOptions.OPTIONG_GroovyProjectName,javaProject.getElementName());
      options.put(CompilerOptions.OPTIONG_BuildGroovyFiles,CompilerOptions.ENABLED);
      if (isProbablyGrailsProject(project)) {
        options.put(CompilerOptions.OPTIONG_GroovyFlags,Integer.toString(IsGrails));
      }
 else {
        options.put(CompilerOptions.OPTIONG_GroovyFlags,"String_Node_Str");
      }
    }
 else {
      options.put(CompilerOptions.OPTIONG_BuildGroovyFiles,CompilerOptions.DISABLED);
      options.put(CompilerOptions.OPTIONG_GroovyFlags,"String_Node_Str");
    }
  }
 catch (  CoreException e) {
    Util.log(e,"String_Node_Str");
    options.put(CompilerOptions.OPTIONG_BuildGroovyFiles,CompilerOptions.DISABLED);
    options.put(CompilerOptions.OPTIONG_GroovyFlags,"String_Node_Str");
  }
}
Program: 185357
Project: 185357
Buggy source:
/** 
 * Configure an options map (usually retrieved from a CompilerOptions object) based on the project. If anything goes wrong it will configure the options to just build java.
 */
public static void configureOptionsBasedOnNature(Map<String,String> options,IJavaProject javaProject){
  try {
    IProject project=javaProject.getProject();
    if (isGroovyNaturedProject(project)) {
      options.put(CompilerOptions.OPTIONG_GroovyExcludeGlobalASTScan,project.getFile(javaProject.getOutputLocation().removeFirstSegments(1)).getRawLocation().toOSString());
      options.put(CompilerOptions.OPTIONG_GroovyProjectName,javaProject.getElementName());
      options.put(CompilerOptions.OPTIONG_BuildGroovyFiles,CompilerOptions.ENABLED);
      if (isProbablyGrailsProject(project)) {
        options.put(CompilerOptions.OPTIONG_GroovyFlags,Integer.toString(IsGrails));
      }
 else {
        options.put(CompilerOptions.OPTIONG_GroovyFlags,"String_Node_Str");
      }
    }
 else {
      options.put(CompilerOptions.OPTIONG_BuildGroovyFiles,CompilerOptions.DISABLED);
      options.put(CompilerOptions.OPTIONG_GroovyFlags,"String_Node_Str");
    }
  }
 catch (  CoreException e) {
    Util.log(e,"String_Node_Str");
    options.put(CompilerOptions.OPTIONG_BuildGroovyFiles,CompilerOptions.DISABLED);
    options.put(CompilerOptions.OPTIONG_GroovyFlags,"String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Configure an options map (usually retrieved from a CompilerOptions object) based on the project. If anything goes wrong it will configure the options to just build java.
 */
public static void configureOptionsBasedOnNature(Map<String,String> options,IJavaProject javaProject){
  IProject project=javaProject.getProject();
  try {
    if (isGroovyNaturedProject(project)) {
      options.put(CompilerOptions.OPTIONG_GroovyExcludeGlobalASTScan,getAbsoluteLocation(javaProject.getOutputLocation(),project));
      options.put(CompilerOptions.OPTIONG_GroovyProjectName,javaProject.getElementName());
      options.put(CompilerOptions.OPTIONG_BuildGroovyFiles,CompilerOptions.ENABLED);
      if (isProbablyGrailsProject(project)) {
        options.put(CompilerOptions.OPTIONG_GroovyFlags,Integer.toString(IsGrails));
      }
 else {
        options.put(CompilerOptions.OPTIONG_GroovyFlags,"String_Node_Str");
      }
    }
 else {
      options.put(CompilerOptions.OPTIONG_BuildGroovyFiles,CompilerOptions.DISABLED);
      options.put(CompilerOptions.OPTIONG_GroovyFlags,"String_Node_Str");
    }
  }
 catch (  CoreException e) {
    Util.log(e,"String_Node_Str");
    options.put(CompilerOptions.OPTIONG_BuildGroovyFiles,CompilerOptions.DISABLED);
    options.put(CompilerOptions.OPTIONG_GroovyFlags,"String_Node_Str");
  }
}
Program: 185358
Project: 185358
Buggy source:
public int getStart(){
  return start;
}

Fixed version (ground truth):
public int getStart(){
  return offsets[0];
}
Program: 185359
Project: 185359
Buggy source:
public void setStart(int offset){
  start=offset;
}

Fixed version (ground truth):
public void setStart(int offset){
  offsets[0]=offset;
}
Program: 185360
Project: 185360
Buggy source:
public void setEnd(int offset){
  stop=offset;
}

Fixed version (ground truth):
public void setEnd(int offset){
  offsets[1]=offset;
}
Program: 185361
Project: 185361
Buggy source:
public int getEnd(){
  return stop;
}

Fixed version (ground truth):
public int getEnd(){
  return offsets[1];
}
Program: 185362
Project: 185362
Buggy source:
public int getLength(){
  return (stop > 0 && start >= 0 ? stop - start : -1);
}

Fixed version (ground truth):
public int getLength(){
  return (offsets[1] >= 0 && offsets[0] >= 0 ? offsets[1] - offsets[0] : -1);
}
Program: 185363
Project: 185363
Buggy source:
/** 
 * Sets the source position using another ASTNode. The sourcePosition consists of a line/column pair for the start and a line/column pair for the end of the expression or statement 
 * @param node - the node used to configure the position information
 */
public void setSourcePosition(ASTNode node){
  this.columnNumber=node.getColumnNumber();
  this.lastLineNumber=node.getLastLineNumber();
  this.lastColumnNumber=node.getLastColumnNumber();
  this.lineNumber=node.getLineNumber();
  this.start=node.getStart();
  this.stop=node.getEnd();
}

Fixed version (ground truth):
/** 
 * Sets the source position using another ASTNode. The sourcePosition consists of a line/column pair for the start and a line/column pair for the end of the expression or statement 
 * @param node - the node used to configure the position information
 */
public void setSourcePosition(ASTNode node){
  this.columnNumber=node.getColumnNumber();
  this.lastLineNumber=node.getLastLineNumber();
  this.lastColumnNumber=node.getLastColumnNumber();
  this.lineNumber=node.getLineNumber();
  this.offsets[0]=node.getStart();
  this.offsets[1]=node.getEnd();
}
Program: 185364
Project: 185364
Buggy source:
protected static boolean isCompatibleConstantExpression(Expression node,VariableScope scope){
  if (node instanceof ConstantExpression) {
    org.codehaus.groovy.ast.ASTNode enclosingNode=scope.getEnclosingNode();
    if (!(enclosingNode instanceof AttributeExpression || enclosingNode instanceof MethodPointerExpression)) {
      return (VariableScope.STRING_CLASS_NODE.equals(node.getType()) && node.getLength() <= node.getText().length());
    }
  }
  return false;
}

Fixed version (ground truth):
protected static boolean isCompatibleConstantExpression(Expression node,VariableScope scope){
  if (node instanceof ConstantExpression && !scope.isTopLevel()) {
    org.codehaus.groovy.ast.ASTNode enclosingNode=scope.getEnclosingNode();
    if (!(enclosingNode instanceof AttributeExpression || enclosingNode instanceof MethodPointerExpression)) {
      return (VariableScope.STRING_CLASS_NODE.equals(node.getType()) && node.getLength() <= node.getText().length());
    }
  }
  return false;
}
Program: 185365
Project: 185365
Buggy source:
private void assertKnown(String source,String target,String declaringType,String expressionType){
  int offset=source.lastIndexOf(target);
  GroovyCompilationUnit unit=createUnit("String_Node_Str",source);
  SearchRequestor requestor=doVisit(offset,offset + target.length(),unit,false);
  Assert.assertNotEquals(TypeLookupResult.TypeConfidence.UNKNOWN,requestor.result.confidence);
  Assert.assertEquals(declaringType,requestor.result.declaringType.getName());
  Assert.assertEquals(expressionType,printTypeName(requestor.result.type));
}

Fixed version (ground truth):
private void assertKnown(String source,String target,String declaringType,String expressionType){
  int offset=source.lastIndexOf(target);
  GroovyCompilationUnit unit=createUnit("String_Node_Str",source);
  SearchRequestor requestor=doVisit(offset,offset + target.length(),unit,false);
  Assert.assertNotEquals("String_Node_Str" + target + "String_Node_Str"+ offset+ "String_Node_Str",TypeLookupResult.TypeConfidence.UNKNOWN,requestor.result.confidence);
  Assert.assertEquals(declaringType,requestor.result.declaringType.getName());
  Assert.assertEquals(expressionType,printTypeName(requestor.result.type));
}
Program: 185366
Project: 185366
Buggy source:
/** 
 * Supplements   {@link #isTypeCompatible} by supporting unequal lengths andtagging Closure -> SAM type as an inexact match.
 */
protected static boolean isLooseMatch(List<ClassNode> arguments,Parameter[] parameters){
  int argCount=(arguments == null ? -1 : arguments.size());
  if (parameters.length != argCount && !(parameters.length < argCount && GenericsMapper.isVargs(parameters))) {
    return true;
  }
 else   if (argCount > 0 && arguments.get(argCount - 1).equals(VariableScope.CLOSURE_CLASS_NODE)) {
    ClassNode lastType=GroovyUtils.getBaseType(parameters[parameters.length - 1].getType());
    if (!lastType.equals(VariableScope.CLOSURE_CLASS_NODE)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Supplements   {@link #isTypeCompatible} by supporting unequal lengths andtagging Closure -> SAM type as an inexact match.
 */
protected static boolean isLooseMatch(List<ClassNode> arguments,Parameter[] parameters){
  int argCount=(arguments == null ? -1 : arguments.size());
  if (parameters.length != argCount && !(GenericsMapper.isVargs(parameters) && (parameters.length - 1 == argCount || parameters.length < argCount))) {
    return true;
  }
 else   if (argCount > 0 && arguments.get(argCount - 1).equals(VariableScope.CLOSURE_CLASS_NODE)) {
    ClassNode lastType=GroovyUtils.getBaseType(parameters[parameters.length - 1].getType());
    if (!lastType.equals(VariableScope.CLOSURE_CLASS_NODE)) {
      return true;
    }
  }
  return false;
}