nus-yam/ex-repair huggingface dataset:
Program: 185459
Project: 185459
Buggy source:
@Test public void testImportStatic3(){
  runConformTest(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");
  GroovyCompilationUnitDeclaration gcud=getCUDeclFor("String_Node_Str");
  ImportReference[] irs=gcud.imports;
  assertTrue(irs[0] instanceof AliasImportReference);
  assertEquals("String_Node_Str",irs[0].toString().trim());
  assertTrue(irs[0].isStatic());
  assertEquals("String_Node_Str",new String(((AliasImportReference)irs[0]).getSimpleName()));
}

Fixed version (ground truth):
@Test public void testImportStatic3(){
  runConformTest(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");
  ImportReference ref=getCUDeclFor("String_Node_Str").imports[0];
  assertTrue(ref.isStatic());
  assertTrue(ref instanceof AliasImportReference);
  assertEquals("String_Node_Str",ref.toString());
  assertEquals("String_Node_Str",String.valueOf(ref.getSimpleName()));
}
Program: 185460
Project: 185460
Buggy source:
@Test public void testImportStatic1(){
  runConformTest(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");
  GroovyCompilationUnitDeclaration gcud=getCUDeclFor("String_Node_Str");
  ImportReference[] irs=gcud.imports;
  assertEquals("String_Node_Str",irs[0].toString().trim());
  assertTrue(irs[0].isStatic());
}

Fixed version (ground truth):
@Test public void testImportStatic1(){
  runConformTest(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");
  ImportReference ref=getCUDeclFor("String_Node_Str").imports[0];
  assertTrue(ref.isStatic());
  assertEquals("String_Node_Str",ref.toString());
  assertFalse(ref instanceof AliasImportReference);
  assertEquals("String_Node_Str",String.valueOf(ref.getSimpleName()));
}
Program: 185461
Project: 185461
Buggy source:
@Test public void testImportStatic2(){
  runConformTest(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");
  GroovyCompilationUnitDeclaration gcud=getCUDeclFor("String_Node_Str");
  ImportReference[] irs=gcud.imports;
  assertEquals("String_Node_Str",irs[0].toString().trim());
  assertTrue(irs[0].isStatic());
}

Fixed version (ground truth):
@Test public void testImportStatic2(){
  runConformTest(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");
  ImportReference ref=getCUDeclFor("String_Node_Str").imports[0];
  assertTrue(ref.isStatic());
  assertEquals("String_Node_Str",ref.toString());
}
Program: 185462
Project: 185462
Buggy source:
private ClassNode javaTypeToGroovyClass(IType type){
  ICompilationUnit unit=type.getCompilationUnit();
  if (unit instanceof GroovyCompilationUnit) {
    ModuleNode module=((GroovyCompilationUnit)unit).getModuleNode();
    List<ClassNode> classes=module.getClasses();
    for (    ClassNode classNode : classes) {
      if (classNode.getNameWithoutPackage().equals(type.getElementName())) {
        return classNode;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
private static ClassNode javaTypeToGroovyClass(IType type){
  ICompilationUnit unit=type.getCompilationUnit();
  if (unit instanceof GroovyCompilationUnit) {
    ModuleNode module=((GroovyCompilationUnit)unit).getModuleNode();
    List<ClassNode> classes=module.getClasses();
    for (    ClassNode classNode : classes) {
      if (classNode.getNameWithoutPackage().equals(type.getElementName())) {
        return classNode;
      }
    }
  }
  return null;
}
Program: 185463
Project: 185463
Buggy source:
private Parameter[] getParametersForTypes(String[] signatures){
  int n=signatures.length;
  Parameter[] parameters=new Parameter[n];
  for (int i=0; i < n; i+=1) {
    parameters[i]=new Parameter(ClassHelper.makeWithoutCaching(Signature.toString(signatures[i])),null);
  }
  return parameters;
}

Fixed version (ground truth):
private Parameter[] getParametersForTypes(String[] signatures){
  int n=signatures.length;
  Parameter[] parameters=new Parameter[n];
  for (int i=0; i < n; i+=1) {
    parameters[i]=new Parameter(javaTypeToGroovyClass(signatures[i]),null);
  }
  return parameters;
}
Program: 185464
Project: 185464
Buggy source:
@Test public void testConstructorReferenceSearch() throws Exception {
  String groovyContents="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 otherContents="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  GroovyCompilationUnit first=createUnit("String_Node_Str","String_Node_Str",groovyContents);
  createUnit("String_Node_Str","String_Node_Str",otherContents);
  IMethod constructor=first.getType("String_Node_Str").getMethods()[0];
  MockSearchRequestor requestor=new MockSearchRequestor();
  SearchEngine engine=new SearchEngine();
  engine.search(SearchPattern.createPattern(constructor,IJavaSearchConstants.REFERENCES),new SearchParticipant[]{SearchEngine.getDefaultSearchParticipant()},SearchEngine.createJavaSearchScope(new IJavaElement[]{first.getPackageFragmentRoot()},false),requestor,new NullProgressMonitor());
  List<SearchMatch> matches=requestor.getMatches();
  assertEquals("String_Node_Str" + matches,6,matches.size());
  int fooCnt=0, otherCnt=0;
  for (  SearchMatch match : matches) {
    if (match.getElement() instanceof IMethod) {
      if (((IMethod)match.getElement()).getResource().getName().equals("String_Node_Str")) {
        fooCnt+=1;
      }
 else       if (((IMethod)match.getElement()).getResource().getName().equals("String_Node_Str")) {
        otherCnt+=1;
      }
    }
  }
  assertEquals("String_Node_Str",2,fooCnt);
  assertEquals("String_Node_Str",4,otherCnt);
}

Fixed version (ground truth):
@Test public void testConstructorReferenceSearch() throws Exception {
  String groovyContents="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 otherContents="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  GroovyCompilationUnit first=createUnit("String_Node_Str","String_Node_Str",groovyContents);
  createUnit("String_Node_Str","String_Node_Str",otherContents);
  IMethod constructor=first.getType("String_Node_Str").getMethods()[0];
  new SearchEngine().search(SearchPattern.createPattern(constructor,IJavaSearchConstants.REFERENCES),new SearchParticipant[]{SearchEngine.getDefaultSearchParticipant()},SearchEngine.createJavaSearchScope(new IJavaElement[]{first.getPackageFragmentRoot()},false),searchRequestor,new NullProgressMonitor());
  List<SearchMatch> matches=searchRequestor.getMatches();
  assertEquals("String_Node_Str" + matches,6,matches.size());
  int fooCnt=0, otherCnt=0;
  for (  SearchMatch match : matches) {
    if (match.getElement() instanceof IMethod) {
      if (((IMethod)match.getElement()).getResource().getName().equals("String_Node_Str")) {
        fooCnt+=1;
      }
 else       if (((IMethod)match.getElement()).getResource().getName().equals("String_Node_Str")) {
        otherCnt+=1;
      }
    }
  }
  assertEquals("String_Node_Str",2,fooCnt);
  assertEquals("String_Node_Str",4,otherCnt);
}
Program: 185465
Project: 185465
Buggy source:
@Override public void buildFieldsAndMethods(){
  super.buildFieldsAndMethods();
  GroovyTypeDeclaration context=(GroovyTypeDeclaration)referenceContext;
  GroovyTypeDeclaration[] anonymousTypes=context.getAnonymousTypes();
  if (anonymousTypes != null) {
    for (    GroovyTypeDeclaration anonType : anonymousTypes) {
      anonType.scope=new GroovyClassScope(this,anonType);
      anonType.resolve(anonType.enclosingScope);
    }
  }
  for (  MethodBinding method : referenceContext.binding.methods()) {
    fixupTypeParameters(method);
  }
}

Fixed version (ground truth):
@Override public void buildFieldsAndMethods(){
  super.buildFieldsAndMethods();
  GroovyTypeDeclaration[] anonymousTypes=((GroovyTypeDeclaration)referenceContext).getAnonymousTypes();
  if (anonymousTypes != null) {
    for (    GroovyTypeDeclaration anonType : anonymousTypes) {
      anonType.scope=new GroovyClassScope(this,anonType);
      anonType.resolve(anonType.enclosingScope);
    }
  }
  for (  MethodBinding method : referenceContext.binding.methods()) {
    fixupTypeParameters(method);
  }
}
Program: 185466
Project: 185466
Buggy source:
protected Parser basicParser(){
  if (this.basicParser == null) {
    ProblemReporter problemReporter=new ProblemReporter(DefaultErrorHandlingPolicies.proceedWithAllProblems(),this.options,new DefaultProblemFactory());
    this.basicParser=new Parser(problemReporter,false);
    this.basicParser.reportOnlyOneSyntaxError=true;
  }
  return this.basicParser;
}

Fixed version (ground truth):
protected Parser basicParser(){
  if (this.basicParser == null) {
    ProblemReporter problemReporter=new ProblemReporter(DefaultErrorHandlingPolicies.proceedWithAllProblems(),this.options,new DefaultProblemFactory());
    this.basicParser=LanguageSupportFactory.getParser(this,this.options,problemReporter,false,1);
    this.basicParser.reportOnlyOneSyntaxError=true;
  }
  return this.basicParser;
}
Program: 185467
Project: 185467
Buggy source:
protected Parser basicParser(){
  if (this.basicParser == null) {
    ProblemReporter problemReporter=new ProblemReporter(DefaultErrorHandlingPolicies.proceedWithAllProblems(),this.options,new DefaultProblemFactory());
    this.basicParser=new Parser(problemReporter,false);
    this.basicParser.reportOnlyOneSyntaxError=true;
  }
  return this.basicParser;
}

Fixed version (ground truth):
protected Parser basicParser(){
  if (this.basicParser == null) {
    ProblemReporter problemReporter=new ProblemReporter(DefaultErrorHandlingPolicies.proceedWithAllProblems(),this.options,new DefaultProblemFactory());
    this.basicParser=LanguageSupportFactory.getParser(this,this.options,problemReporter,false,1);
    this.basicParser.reportOnlyOneSyntaxError=true;
  }
  return this.basicParser;
}
Program: 185468
Project: 185468
Buggy source:
protected Parser basicParser(){
  if (this.basicParser == null) {
    ProblemReporter problemReporter=new ProblemReporter(DefaultErrorHandlingPolicies.proceedWithAllProblems(),this.options,new DefaultProblemFactory());
    this.basicParser=new Parser(problemReporter,false);
    this.basicParser.reportOnlyOneSyntaxError=true;
  }
  return this.basicParser;
}

Fixed version (ground truth):
protected Parser basicParser(){
  if (this.basicParser == null) {
    ProblemReporter problemReporter=new ProblemReporter(DefaultErrorHandlingPolicies.proceedWithAllProblems(),this.options,new DefaultProblemFactory());
    this.basicParser=LanguageSupportFactory.getParser(this,this.options,problemReporter,false,1);
    this.basicParser.reportOnlyOneSyntaxError=true;
  }
  return this.basicParser;
}
Program: 185469
Project: 185469
Buggy source:
protected Parser basicParser(){
  if (this.basicParser == null) {
    ProblemReporter problemReporter=new ProblemReporter(DefaultErrorHandlingPolicies.proceedWithAllProblems(),this.options,new DefaultProblemFactory());
    this.basicParser=new Parser(problemReporter,false);
    this.basicParser.reportOnlyOneSyntaxError=true;
  }
  return this.basicParser;
}

Fixed version (ground truth):
protected Parser basicParser(){
  if (this.basicParser == null) {
    ProblemReporter problemReporter=new ProblemReporter(DefaultErrorHandlingPolicies.proceedWithAllProblems(),this.options,new DefaultProblemFactory());
    this.basicParser=LanguageSupportFactory.getParser(this,this.options,problemReporter,false,1);
    this.basicParser.reportOnlyOneSyntaxError=true;
  }
  return this.basicParser;
}
Program: 185470
Project: 185470
Buggy source:
protected Parser basicParser(){
  if (this.basicParser == null) {
    ProblemReporter problemReporter=new ProblemReporter(DefaultErrorHandlingPolicies.proceedWithAllProblems(),this.options,new DefaultProblemFactory());
    this.basicParser=new Parser(problemReporter,false);
    this.basicParser.reportOnlyOneSyntaxError=true;
  }
  return this.basicParser;
}

Fixed version (ground truth):
protected Parser basicParser(){
  if (this.basicParser == null) {
    ProblemReporter problemReporter=new ProblemReporter(DefaultErrorHandlingPolicies.proceedWithAllProblems(),this.options,new DefaultProblemFactory());
    this.basicParser=LanguageSupportFactory.getParser(this,this.options,problemReporter,false,1);
    this.basicParser.reportOnlyOneSyntaxError=true;
  }
  return this.basicParser;
}
Program: 185471
Project: 185471
Buggy source:
protected Parser basicParser(){
  if (this.basicParser == null) {
    ProblemReporter problemReporter=new ProblemReporter(DefaultErrorHandlingPolicies.proceedWithAllProblems(),this.options,new DefaultProblemFactory());
    this.basicParser=new Parser(problemReporter,false);
    this.basicParser.reportOnlyOneSyntaxError=true;
  }
  return this.basicParser;
}

Fixed version (ground truth):
protected Parser basicParser(){
  if (this.basicParser == null) {
    ProblemReporter problemReporter=new ProblemReporter(DefaultErrorHandlingPolicies.proceedWithAllProblems(),this.options,new DefaultProblemFactory());
    this.basicParser=LanguageSupportFactory.getParser(this,this.options,problemReporter,false,1);
    this.basicParser.reportOnlyOneSyntaxError=true;
  }
  return this.basicParser;
}
Program: 185472
Project: 185472
Buggy source:
protected Parser basicParser(){
  if (this.basicParser == null) {
    ProblemReporter problemReporter=new ProblemReporter(DefaultErrorHandlingPolicies.proceedWithAllProblems(),this.options,new DefaultProblemFactory());
    this.basicParser=new Parser(problemReporter,false);
    this.basicParser.reportOnlyOneSyntaxError=true;
  }
  return this.basicParser;
}

Fixed version (ground truth):
protected Parser basicParser(){
  if (this.basicParser == null) {
    ProblemReporter problemReporter=new ProblemReporter(DefaultErrorHandlingPolicies.proceedWithAllProblems(),this.options,new DefaultProblemFactory());
    this.basicParser=LanguageSupportFactory.getParser(this,this.options,problemReporter,false,1);
    this.basicParser.reportOnlyOneSyntaxError=true;
  }
  return this.basicParser;
}
Program: 185474
Project: 185474
Buggy source:
protected Parser basicParser(){
  if (this.basicParser == null) {
    ProblemReporter problemReporter=new ProblemReporter(DefaultErrorHandlingPolicies.proceedWithAllProblems(),this.options,new DefaultProblemFactory());
    this.basicParser=new Parser(problemReporter,false);
    this.basicParser.reportOnlyOneSyntaxError=true;
  }
  return this.basicParser;
}

Fixed version (ground truth):
protected Parser basicParser(){
  if (this.basicParser == null) {
    ProblemReporter problemReporter=new ProblemReporter(DefaultErrorHandlingPolicies.proceedWithAllProblems(),this.options,new DefaultProblemFactory());
    this.basicParser=LanguageSupportFactory.getParser(this,this.options,problemReporter,false,1);
    this.basicParser.reportOnlyOneSyntaxError=true;
  }
  return this.basicParser;
}
Program: 185476
Project: 185476
Buggy source:
protected Parser basicParser(){
  if (this.basicParser == null) {
    ProblemReporter problemReporter=new ProblemReporter(DefaultErrorHandlingPolicies.proceedWithAllProblems(),this.options,new DefaultProblemFactory());
    this.basicParser=new Parser(problemReporter,false);
    this.basicParser.reportOnlyOneSyntaxError=true;
  }
  return this.basicParser;
}

Fixed version (ground truth):
protected Parser basicParser(){
  if (this.basicParser == null) {
    ProblemReporter problemReporter=new ProblemReporter(DefaultErrorHandlingPolicies.proceedWithAllProblems(),this.options,new DefaultProblemFactory());
    this.basicParser=LanguageSupportFactory.getParser(this,this.options,problemReporter,false,1);
    this.basicParser.reportOnlyOneSyntaxError=true;
  }
  return this.basicParser;
}
Program: 185477
Project: 185477
Buggy source:
protected MethodNode findMethodDeclaration0(List<MethodNode> candidates,List<ClassNode> arguments){
  MethodNode closestMatch=candidates.get(0);
  if (arguments == null) {
    arguments=Collections.emptyList();
  }
  for (Iterator<MethodNode> iterator=candidates.iterator(); iterator.hasNext(); ) {
    MethodNode maybeMethod=iterator.next();
    Parameter[] parameters=maybeMethod.getParameters();
    if (parameters.length == 0 && arguments.isEmpty()) {
      return maybeMethod.getOriginal();
    }
    if (parameters.length == arguments.size()) {
      Boolean suitable=isTypeCompatible(arguments,parameters);
      if (Boolean.TRUE.equals(suitable)) {
        return maybeMethod.getOriginal();
      }
      if (!Boolean.FALSE.equals(suitable)) {
        closestMatch=maybeMethod.getOriginal();
        continue;
      }
    }
    iterator.remove();
  }
  return closestMatch;
}

Fixed version (ground truth):
protected MethodNode findMethodDeclaration0(List<MethodNode> candidates,List<ClassNode> arguments){
  MethodNode closestMatch=candidates.get(0);
  if (arguments == null) {
    arguments=Collections.emptyList();
  }
  for (  MethodNode candidate : candidates) {
    Parameter[] parameters=candidate.getParameters();
    if (parameters.length == 0 && arguments.isEmpty()) {
      return candidate.getOriginal();
    }
    if (parameters.length == arguments.size()) {
      Boolean suitable=isTypeCompatible(arguments,parameters);
      if (Boolean.TRUE.equals(suitable)) {
        return candidate.getOriginal();
      }
      if (!Boolean.FALSE.equals(suitable) || closestMatch.getParameters().length != arguments.size()) {
        closestMatch=candidate.getOriginal();
      }
    }
  }
  return closestMatch;
}
Program: 185478
Project: 185478
Buggy source:
private ClassNode findClassNode(String name){
  for (  ClassNode clazz : findModuleNode().getClasses()) {
    if (clazz.getNameWithoutPackage().equals(name)) {
      return clazz;
    }
  }
  return null;
}

Fixed version (ground truth):
private ClassNode findClassNode(String name){
  for (  ClassNode clazz : enclosingModule.getClasses()) {
    if (clazz.getNameWithoutPackage().equals(name)) {
      return clazz;
    }
  }
  return null;
}
Program: 185479
Project: 185479
Buggy source:
/** 
 * Use factory to instantiate
 */
TypeInferencingVisitorWithRequestor(GroovyCompilationUnit unit,ITypeLookup[] lookups){
  super();
  this.unit=unit;
  this.lookups=lookups;
  ModuleNodeInfo info=createModuleNode(unit);
  this.resolver=info != null ? info.resolver : null;
  this.enclosingDeclarationNode=info != null ? info.module : null;
}

Fixed version (ground truth):
/** 
 * Use factory to instantiate
 */
TypeInferencingVisitorWithRequestor(GroovyCompilationUnit unit,ITypeLookup[] lookups){
  super();
  this.unit=unit;
  this.lookups=lookups;
  ModuleNodeInfo info=createModuleNode(unit);
  this.resolver=info != null ? info.resolver : null;
  this.enclosingDeclarationNode=this.enclosingModule=info != null ? info.module : null;
}
Program: 185480
Project: 185480
Buggy source:
public void visitCompilationUnit(ITypeRequestor requestor){
  if (enclosingDeclarationNode == null) {
    return;
  }
  this.requestor=requestor;
  this.enclosingElement=unit;
  VariableScope topLevelScope=new VariableScope(null,enclosingDeclarationNode,false);
  scopes.add(topLevelScope);
  for (  ITypeLookup lookup : lookups) {
    if (lookup instanceof ITypeResolver) {
      ((ITypeResolver)lookup).setResolverInformation((ModuleNode)enclosingDeclarationNode,resolver);
    }
    lookup.initialize(unit,topLevelScope);
  }
  try {
    visitPackage(((ModuleNode)enclosingDeclarationNode).getPackage());
    visitImports((ModuleNode)enclosingDeclarationNode);
    for (    IType type : unit.getTypes()) {
      visitJDT(type,requestor);
    }
  }
 catch (  VisitCompleted vc) {
  }
catch (  Exception e) {
    log(e,"String_Node_Str",unit.getElementName());
    if (DEBUG) {
      System.err.println("String_Node_Str");
      e.printStackTrace();
    }
  }
 finally {
    scopes.removeLast();
  }
  if (DEBUG) {
    postVisitSanityCheck();
  }
}

Fixed version (ground truth):
public void visitCompilationUnit(ITypeRequestor requestor){
  if (enclosingModule == null) {
    return;
  }
  this.requestor=requestor;
  this.enclosingElement=unit;
  VariableScope topLevelScope=new VariableScope(null,enclosingModule,false);
  scopes.add(topLevelScope);
  for (  ITypeLookup lookup : lookups) {
    if (lookup instanceof ITypeResolver) {
      ((ITypeResolver)lookup).setResolverInformation(enclosingModule,resolver);
    }
    lookup.initialize(unit,topLevelScope);
  }
  try {
    visitPackage(enclosingModule.getPackage());
    visitImports(enclosingModule);
    for (    IType type : unit.getTypes()) {
      visitJDT(type,requestor);
    }
  }
 catch (  VisitCompleted vc) {
  }
catch (  Exception e) {
    log(e,"String_Node_Str",unit.getElementName());
    if (DEBUG) {
      System.err.println("String_Node_Str");
      e.printStackTrace();
    }
  }
 finally {
    scopes.removeLast();
  }
  if (DEBUG) {
    postVisitSanityCheck();
  }
}
Program: 185481
Project: 185481
Buggy source:
private IType findAnonType(ClassNode node){
  return new GroovyProjectFacade(enclosingElement).groovyClassToJavaType(node);
}

Fixed version (ground truth):
private IType findAnonType(ClassNode node){
}
Program: 185482
Project: 185482
Buggy source:
@Override public void visitMethodCallExpression(MethodCallExpression node){
  VariableScope scope=scopes.getLast();
  scope.setCurrentNode(node);
  if (isDependentExpression(node)) {
    primaryTypeStack.removeLast();
  }
  completeExpressionStack.add(node);
  node.getObjectExpression().visit(this);
  if (node.isSpreadSafe()) {
    ClassNode objType=primaryTypeStack.removeLast();
    primaryTypeStack.add(VariableScope.extractElementType(objType));
  }
  if (node.isUsingGenerics()) {
    visitGenericTypes(node.getGenericsTypes(),null);
  }
  node.getMethod().visit(this);
  ClassNode returnType=dependentTypeStack.removeLast();
  Tuple t=dependentDeclarationStack.removeLast();
  VariableScope.CallAndType call=new VariableScope.CallAndType(node,t.declaration,t.declaringType,unit.getModuleNode());
  completeExpressionStack.removeLast();
  ClassNode catNode=isCategoryDeclaration(node);
  if (catNode != null) {
    scope.setCategoryBeingDeclared(catNode);
  }
  scope.addEnclosingMethodCall(call);
  node.getArguments().visit(this);
  scope.forgetEnclosingMethodCall();
  if (node.isSpreadSafe()) {
    returnType=createParameterizedList(returnType);
  }
  Expression expr=GroovyUtils.getTraitFieldExpression(node);
  if (expr != null) {
    handleSimpleExpression(expr);
    postVisit(node,returnType,t.declaringType,node);
  }
 else {
    handleCompleteExpression(node,returnType,t.declaringType);
  }
  scope.forgetCurrentNode();
}

Fixed version (ground truth):
@Override public void visitMethodCallExpression(MethodCallExpression node){
  VariableScope scope=scopes.getLast();
  scope.setCurrentNode(node);
  if (isDependentExpression(node)) {
    primaryTypeStack.removeLast();
  }
  completeExpressionStack.add(node);
  node.getObjectExpression().visit(this);
  if (node.isSpreadSafe()) {
    ClassNode objType=primaryTypeStack.removeLast();
    primaryTypeStack.add(VariableScope.extractElementType(objType));
  }
  if (node.isUsingGenerics()) {
    visitGenericTypes(node.getGenericsTypes(),null);
  }
  node.getMethod().visit(this);
  ClassNode returnType=dependentTypeStack.removeLast();
  Tuple t=dependentDeclarationStack.removeLast();
  VariableScope.CallAndType call=new VariableScope.CallAndType(node,t.declaration,t.declaringType,enclosingModule);
  completeExpressionStack.removeLast();
  ClassNode catNode=isCategoryDeclaration(node);
  if (catNode != null) {
    scope.setCategoryBeingDeclared(catNode);
  }
  scope.addEnclosingMethodCall(call);
  node.getArguments().visit(this);
  scope.forgetEnclosingMethodCall();
  if (node.isSpreadSafe()) {
    returnType=createParameterizedList(returnType);
  }
  Expression expr=GroovyUtils.getTraitFieldExpression(node);
  if (expr != null) {
    handleSimpleExpression(expr);
    postVisit(node,returnType,t.declaringType,node);
  }
 else {
    handleCompleteExpression(node,returnType,t.declaringType);
  }
  scope.forgetCurrentNode();
}
Program: 185483
Project: 185483
Buggy source:
@Test public void testDGM45() throws Throwable {
  String contents="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  int start=contents.lastIndexOf("String_Node_Str");
  int end=start + "String_Node_Str".length();
  assertTypeOneOf(contents,start,end,"String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
@Test public void testDGM45(){
  String contents="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  int offset=contents.lastIndexOf("String_Node_Str");
  assertType(contents,offset,offset + 2,"String_Node_Str");
}
Program: 185484
Project: 185484
Buggy source:
@Test public void testDGM44(){
  String contents="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "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 testDGM44(){
  String contents="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  int offset=contents.lastIndexOf("String_Node_Str");
  assertType(contents,offset,offset + 2,"String_Node_Str");
}
Program: 185485
Project: 185485
Buggy source:
@Test public void testListSort1(){
  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");
  assertDeclaringType(contents,start,end,"String_Node_Str");
}

Fixed version (ground truth):
@Test public void testListSort1(){
  String contents="String_Node_Str";
  int offset=contents.lastIndexOf("String_Node_Str");
  assertType(contents,offset,offset + 4,"String_Node_Str");
  assertDeclaringType(contents,offset,offset + 4,"String_Node_Str");
}
Program: 185486
Project: 185486
Buggy source:
@Test public void testListSort2(){
  boolean jdkListSort;
  try {
    List.class.getDeclaredMethod("String_Node_Str",Comparator.class);
    jdkListSort=true;
  }
 catch (  Exception e) {
    jdkListSort=false;
  }
  String contents="String_Node_Str";
  int start=contents.lastIndexOf("String_Node_Str");
  int end=start + "String_Node_Str".length();
  assertType(contents,start,end,jdkListSort ? "String_Node_Str" : "String_Node_Str");
  assertDeclaringType(contents,start,end,jdkListSort ? "String_Node_Str" : "String_Node_Str");
}

Fixed version (ground truth):
@Test public void testListSort2(){
  String contents="String_Node_Str";
  int offset=contents.lastIndexOf("String_Node_Str");
  assertType(contents,offset,offset + 4,"String_Node_Str");
  assertDeclaringType(contents,offset,offset + 4,"String_Node_Str");
}
Program: 185487
Project: 185487
Buggy source:
/** 
 * @return finds the number of parameters in the method reference/declaration currently being analyzed.
 */
private int findNumberOfParameters(ASTNode node,TypeLookupResult result){
  return (node instanceof MethodNode && ((MethodNode)node).getParameters() != null) ? ((MethodNode)node).getParameters().length : Math.max(0,result.scope.getMethodCallNumberOfArguments());
}

Fixed version (ground truth):
/** 
 * @return finds the number of parameters in the method reference/declaration currently being analyzed.
 */
private int findNumberOfParameters(ASTNode node,TypeLookupResult result){
  return (node instanceof MethodNode && ((MethodNode)node).getParameters() != null) ? ((MethodNode)node).getParameters().length : result.scope.getMethodCallNumberOfArguments();
}
Program: 185489
Project: 185489
Buggy source:
public void visitMethodCallExpression(MethodCallExpression expression){
  visitAnnotations(expression.getAnnotations());
  expression.getObjectExpression().visit(this);
  expression.getMethod().visit(this);
  expression.getArguments().visit(this);
  visitIfPresent(getTraitFieldExpression(expression));
  visitExpression(expression);
}

Fixed version (ground truth):
public void visitMethodCallExpression(MethodCallExpression expression){
  visitAnnotations(expression.getAnnotations());
  expression.getObjectExpression().visit(this);
  expression.getMethod().visit(this);
  expression.getArguments().visit(this);
  visitIfPresent(getTraitFieldExpression(expression));
  ClassNode type=expression.getType();
  if (type.isEnum() && GroovyUtils.isAnonymous(type.redirect()) && expression.getMethodAsString().equals("String_Node_Str")) {
    visitClass(type.redirect());
  }
  visitExpression(expression);
}
Program: 185490
Project: 185490
Buggy source:
public Image decorateImage(Image image,Object element){
  if (preventRecursion) {
    return null;
  }
  boolean isGroovyFile=false, noBaseImage=(image == null);
  if (element instanceof String && (isGroovyFile=isGroovyLikeFileName((String)element))) {
    image=getImage(new JavaElementImageDescriptor(GroovyPluginImages.DESC_GROOVY_FILE,0,JavaElementImageProvider.SMALL_SIZE));
  }
 else {
    IResource resource=null;
    if (element instanceof IFile) {
      resource=(IResource)element;
    }
 else     if (element instanceof ICompilationUnit) {
      resource=((ICompilationUnit)element).getResource();
    }
    if (resource != null && (isGroovyFile=isGroovyLikeFileName(resource.getName()))) {
      image=getJavaElementImageDescriptor(image,resource);
    }
  }
  if (image != null && isGroovyFile) {
    preventRecursion=true;
    try {
      image=problemsDecorator.decorateImage(image,element);
      if (!noBaseImage) {
        if (defaultDecorator == null) {
          defaultDecorator=WorkbenchPlugin.getDefault().getDecoratorManager();
        }
        image=defaultDecorator.decorateImage(image,element);
      }
    }
  finally {
      preventRecursion=false;
    }
    return image;
  }
  return null;
}

Fixed version (ground truth):
private Image decorateImage(ImageDescriptor base,IResource rsrc,Point size){
  int flags=0;
  if (!isExternalProject(rsrc.getProject()))   try {
    if (isGroovyProject(rsrc.getProject())) {
      if (isRuntimeCompiled(rsrc)) {
        flags|=0x8000;
      }
    }
 else {
      flags|=JavaElementImageDescriptor.BUILDPATH_ERROR;
    }
  }
 catch (  Exception e) {
    GroovyPlugin.getDefault().logError("String_Node_Str" + rsrc.getName(),e);
  }
  return getImage(base,flags,size);
}
Program: 185491
Project: 185491
Buggy source:
private Image getImage(ImageDescriptor descriptor){
  return JavaPlugin.getImageDescriptorRegistry().get(descriptor);
}

Fixed version (ground truth):
private Image getImage(ImageDescriptor base,int flags,Point size){
  return JavaPlugin.getImageDescriptorRegistry().get(new JavaElementImageDescriptor(base,flags,size));
}
Program: 185493
Project: 185493
Buggy source:
public Object getElementInfo() throws JavaModelException {
  try {
    return super.getElementInfo();
  }
 catch (  JavaModelException jme) {
    if (!jme.getJavaModelStatus().isDoesNotExist()) {
      throw jme;
    }
    final IType anonType=this;
    return new org.eclipse.jdt.internal.core.SourceTypeElementInfo(){
{
        setHandle(anonType);
        setFlags(inner.getModifiers());
        ClassNode[] faces=inner.getInterfaces();
        char[][] names=new char[faces.length][];
        for (int i=0; i < faces.length; i+=1) {
          names[i]=faces[i].getName().toCharArray();
        }
        setSuperInterfaceNames(names);
        setSuperclassName(inner.getUnresolvedSuperClass().getName().toCharArray());
        setNameSourceStart(inner.getNameStart());
        setNameSourceEnd(inner.getNameEnd());
        setSourceRangeStart(inner.getStart());
        setSourceRangeEnd(inner.getEnd());
      }
    }
;
  }
}

Fixed version (ground truth):
@Override public Object getElementInfo() throws JavaModelException {
  try {
    return super.getElementInfo();
  }
 catch (  JavaModelException jme) {
    if (!jme.getJavaModelStatus().isDoesNotExist()) {
      throw jme;
    }
    return new org.eclipse.jdt.internal.core.SourceMethodInfo(){
{
        setReturnType(methodNode.getReturnType().getNameWithoutPackage().toCharArray());
        setNameSourceStart(methodNode.getNameStart());
        setNameSourceEnd(methodNode.getNameEnd());
        setSourceRangeStart(methodNode.getStart());
        setSourceRangeEnd(methodNode.getEnd());
        setFlags(methodNode.getModifiers());
      }
    }
;
  }
}
Program: 185494
Project: 185494
Buggy source:
/** 
 * If this fully qualified name is in a groovy file, then return the classnode If this is not a groovy file, then return null
 */
public ClassNode getClassNodeForName(String name){
  try {
    IType type=project.findType(name,new NullProgressMonitor());
    if (type instanceof SourceType) {
      return javaTypeToGroovyClass(type);
    }
  }
 catch (  JavaModelException e) {
    Util.log(e);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * If this fully qualified name is in a groovy file, then return the ClassNode. If this is not a groovy file, then return null
 */
public ClassNode getClassNodeForName(String name){
  try {
    IType type=project.findType(name,(IProgressMonitor)null);
    if (type instanceof SourceType) {
      return javaTypeToGroovyClass(type);
    }
  }
 catch (  JavaModelException e) {
    Util.log(e);
  }
  return null;
}
Program: 185495
Project: 185495
Buggy source:
public IType groovyClassToJavaType(ClassNode node){
  try {
    ClassNode toLookFor=node;
    if (GroovyUtils.isAnonymous(node)) {
      toLookFor=node.getOuterClass();
      IType enclosing=groovyClassToJavaType(toLookFor);
      if (enclosing != null) {
        if (!enclosing.isBinary()) {
          return fakeAnonymousInnerClass(enclosing,(InnerClassNode)node);
        }
 else {
          return project.findType(node.getName(),new NullProgressMonitor());
        }
      }
 else {
        return null;
      }
    }
    String name=toLookFor.getName().replace('$','.');
    IType type=project.findType(name,new NullProgressMonitor());
    if (type != null && toLookFor != node) {
      type=type.getType("String_Node_Str",1);
      if (!type.exists()) {
        type=null;
      }
    }
    return type;
  }
 catch (  JavaModelException e) {
    Util.log(e,"String_Node_Str" + node.getName());
    return null;
  }
}

Fixed version (ground truth):
public IType groovyClassToJavaType(ClassNode node){
  if (parent != null && parent.getFullyQualifiedName().equals(node.getName())) {
    return parent;
  }
  try {
    ClassNode toLookFor=node;
    if (GroovyUtils.isAnonymous(node)) {
      toLookFor=node.getOuterClass();
      IType enclosing=groovyClassToJavaType(toLookFor);
      if (enclosing != null && !enclosing.isBinary()) {
        return fakeAnonymousInnerClass(enclosing,(InnerClassNode)node);
      }
 else {
        return project.findType(node.getName(),(IProgressMonitor)null);
      }
    }
    String name=toLookFor.getName().replace('$','.');
    IType type=project.findType(name,(IProgressMonitor)null);
    if (type != null && toLookFor != node) {
      type=type.getType("String_Node_Str",1);
      if (!type.exists()) {
        type=null;
      }
    }
    return type;
  }
 catch (  JavaModelException e) {
    Util.log(e,"String_Node_Str" + node.getName());
    return null;
  }
}
Program: 185496
Project: 185496
Buggy source:
/** 
 * @param node anonymous inner class for enum constant
 */
private void visitMethodOverrides(ClassNode node){
  scopes.add(new VariableScope(scopes.getLast(),node,false));
  ASTNode enclosingDeclaration0=enclosingDeclarationNode;
  IJavaElement enclosingElement0=enclosingElement;
  enclosingDeclarationNode=node;
  try {
    for (    MethodNode method : node.getMethods()) {
      if (method.getEnd() > 0) {
        visitMethodInternal(method,false);
      }
    }
  }
  finally {
    scopes.removeLast();
    enclosingElement=enclosingElement0;
    enclosingDeclarationNode=enclosingDeclaration0;
  }
}

Fixed version (ground truth):
/** 
 * @param node anonymous inner class for enum constant
 */
private void visitMethodOverrides(ClassNode node){
  scopes.add(new VariableScope(scopes.getLast(),node,false));
  ASTNode enclosingDeclaration0=enclosingDeclarationNode;
  IJavaElement enclosingElement0=enclosingElement;
  enclosingDeclarationNode=node;
  try {
    for (    MethodNode method : node.getMethods()) {
      if (method.getEnd() > 0) {
        enclosingElement=findAnonType(node).getMethod(method.getName(),GroovyUtils.getParameterTypeSignatures(method,true));
        visitMethodInternal(method,false);
      }
    }
  }
  finally {
    scopes.removeLast();
    enclosingElement=enclosingElement0;
    enclosingDeclarationNode=enclosingDeclaration0;
  }
}
Program: 185499
Project: 185499
Buggy source:
protected static String[] getParameterTypeNames(MethodPattern pattern,String[] parameterTypeSignatures,IType declaringType){
  int n=parameterTypeSignatures.length;
  String[] typeNames=new String[n];
  for (int i=0; i < n; i+=1) {
    if (pattern.parameterQualifications[i] != null || isPrimitiveType(pattern.parameterSimpleNames[i])) {
      typeNames[i]=String.valueOf(CharOperation.concat(pattern.parameterQualifications[i],pattern.parameterSimpleNames[i],'.'));
    }
 else {
      int arrayCount=Signature.getArrayCount(parameterTypeSignatures[i]);
      try {
        String[][] resolved=declaringType.resolveType(String.valueOf(pattern.parameterSimpleNames[i],0,pattern.parameterSimpleNames[i].length - (2 * arrayCount)));
        typeNames[i]=Signature.toQualifiedName(resolved[0]);
        if (typeNames[i].charAt(0) == '.') {
          typeNames[i]=typeNames[i].substring(1);
        }
        while (arrayCount-- > 0) {
          typeNames[i]+="String_Node_Str";
        }
      }
 catch (      Exception e) {
        Util.log(e);
      }
    }
  }
  return typeNames;
}

Fixed version (ground truth):
protected static String[] getParameterTypeNames(MethodPattern pattern,String[] parameterTypeSignatures,IType declaringType){
  int n=parameterTypeSignatures.length;
  String[] typeNames=new String[n];
  if (declaringType != null)   try {
    int candidates=0;
    if (n > 0) {
      for (      IMethod m : declaringType.getMethods()) {
        if (equal(pattern.selector,m.getElementName()) && n == m.getNumberOfParameters()) {
          candidates+=1;
        }
      }
    }
    if (candidates > 1) {
      for (int i=0; i < n; i+=1) {
        if (pattern.parameterQualifications[i] != null || isPrimitiveType(pattern.parameterSimpleNames[i])) {
          typeNames[i]=String.valueOf(CharOperation.concat(pattern.parameterQualifications[i],pattern.parameterSimpleNames[i],'.'));
        }
 else {
          int arrayCount=Signature.getArrayCount(parameterTypeSignatures[i]);
          String[][] resolved=declaringType.resolveType(String.valueOf(pattern.parameterSimpleNames[i],0,pattern.parameterSimpleNames[i].length - (2 * arrayCount)));
          typeNames[i]=Signature.toQualifiedName(resolved[0]);
          if (typeNames[i].charAt(0) == '.') {
            typeNames[i]=typeNames[i].substring(1);
          }
          while (arrayCount-- > 0) {
            typeNames[i]+="String_Node_Str";
          }
        }
      }
    }
  }
 catch (  Exception e) {
    Util.log(e);
  }
  return typeNames;
}
Program: 185501
Project: 185501
Buggy source:
@Override public void visitStaticMethodCallExpression(StaticMethodCallExpression node){
  ClassNode type=node.getOwnerType();
  if (isPrimaryExpression(node)) {
    visitMethodCallExpression(new MethodCallExpression(new ClassExpression(type),node.getMethod(),node.getArguments()));
  }
  boolean shouldContinue=handleSimpleExpression(node);
  if (shouldContinue) {
    boolean isPresentInSource=(node.getEnd() > 0);
    if (isPresentInSource) {
      visitClassReference(type);
    }
    if (isPresentInSource || isEnumInit(node)) {
      super.visitStaticMethodCallExpression(node);
      if (GroovyUtils.isAnonymous(type)) {
        scopes.add(new VariableScope(scopes.getLast(),type,false));
        ASTNode enclosingDeclaration0=enclosingDeclarationNode;
        IJavaElement enclosingElement0=enclosingElement;
        enclosingDeclarationNode=type;
        try {
          for (          MethodNode method : type.getMethods()) {
            if (method.getEnd() > 0) {
              visitMethodInternal(method,false);
            }
          }
        }
  finally {
          scopes.removeLast();
          enclosingElement=enclosingElement0;
          enclosingDeclarationNode=enclosingDeclaration0;
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void visitStaticMethodCallExpression(StaticMethodCallExpression node){
  ClassNode type=node.getOwnerType();
  if (isPrimaryExpression(node)) {
    visitMethodCallExpression(new MethodCallExpression(new ClassExpression(type),node.getMethod(),node.getArguments()));
  }
  boolean shouldContinue=handleSimpleExpression(node);
  if (shouldContinue) {
    boolean isPresentInSource=(node.getEnd() > 0);
    if (isPresentInSource) {
      visitClassReference(type);
    }
    if (isPresentInSource || isEnumInit(node)) {
      super.visitStaticMethodCallExpression(node);
      if (GroovyUtils.isAnonymous(type)) {
        visitMethodOverrides(type);
      }
    }
  }
}
Program: 185502
Project: 185502
Buggy source:
@Override public void visitMethodCallExpression(MethodCallExpression node){
  VariableScope scope=scopes.getLast();
  scope.setCurrentNode(node);
  if (isDependentExpression(node)) {
    primaryTypeStack.removeLast();
  }
  completeExpressionStack.add(node);
  node.getObjectExpression().visit(this);
  if (node.isSpreadSafe()) {
    ClassNode objType=primaryTypeStack.removeLast();
    primaryTypeStack.add(VariableScope.extractElementType(objType));
  }
  if (node.isUsingGenerics()) {
    visitGenericTypes(node.getGenericsTypes(),null);
  }
  node.getMethod().visit(this);
  ClassNode returnType=dependentTypeStack.removeLast();
  Tuple t=dependentDeclarationStack.removeLast();
  VariableScope.CallAndType call=new VariableScope.CallAndType(node,t.declaration,t.declaringType,enclosingModule);
  completeExpressionStack.removeLast();
  ClassNode catNode=isCategoryDeclaration(node);
  if (catNode != null) {
    scope.setCategoryBeingDeclared(catNode);
  }
  scope.addEnclosingMethodCall(call);
  node.getArguments().visit(this);
  scope.forgetEnclosingMethodCall();
  if (node.isSpreadSafe()) {
    returnType=createParameterizedList(returnType);
  }
  Expression expr=GroovyUtils.getTraitFieldExpression(node);
  if (expr != null) {
    handleSimpleExpression(expr);
    postVisit(node,returnType,t.declaringType,node);
  }
 else {
    handleCompleteExpression(node,returnType,t.declaringType);
  }
  scope.forgetCurrentNode();
}

Fixed version (ground truth):
@Override public void visitMethodCallExpression(MethodCallExpression node){
  VariableScope scope=scopes.getLast();
  scope.setCurrentNode(node);
  if (isDependentExpression(node)) {
    primaryTypeStack.removeLast();
  }
  completeExpressionStack.add(node);
  node.getObjectExpression().visit(this);
  if (node.isSpreadSafe()) {
    ClassNode objType=primaryTypeStack.removeLast();
    primaryTypeStack.add(VariableScope.extractElementType(objType));
  }
  if (node.isUsingGenerics()) {
    visitGenericTypes(node.getGenericsTypes(),null);
  }
  node.getMethod().visit(this);
  ClassNode returnType=dependentTypeStack.removeLast();
  Tuple t=dependentDeclarationStack.removeLast();
  VariableScope.CallAndType call=new VariableScope.CallAndType(node,t.declaration,t.declaringType,enclosingModule);
  completeExpressionStack.removeLast();
  ClassNode catNode=isCategoryDeclaration(node);
  if (catNode != null) {
    scope.setCategoryBeingDeclared(catNode);
  }
  scope.addEnclosingMethodCall(call);
  node.getArguments().visit(this);
  scope.forgetEnclosingMethodCall();
  ClassNode type;
  if (isEnumInit(node) && GroovyUtils.isAnonymous(type=((Expression)node.getReceiver()).getType())) {
    visitMethodOverrides(type);
  }
  if (node.isSpreadSafe()) {
    returnType=createParameterizedList(returnType);
  }
  Expression expr=GroovyUtils.getTraitFieldExpression(node);
  if (expr != null) {
    handleSimpleExpression(expr);
    postVisit(node,returnType,t.declaringType,node);
  }
 else {
    handleCompleteExpression(node,returnType,t.declaringType);
  }
  scope.forgetCurrentNode();
}
Program: 185503
Project: 185503
Buggy source:
/** 
 * Checks to see if this requestor has something to do with refactoring, if so, we always want an accurate match otherwise we get complaints in the refactoring wizard of "possible matches".
 */
private boolean shouldAlwaysBeAccurate(){
  return requestor.getClass().getPackage().getName().indexOf("String_Node_Str") != -1;
}

Fixed version (ground truth):
/** 
 * Checks to see if this requestor has something to do with refactoring, if so, we always want an accurate match otherwise we get complaints in the refactoring wizard of "possible matches".
 */
private boolean shouldAlwaysBeAccurate(){
  return (requestor.getClass().getPackage().getName().indexOf("String_Node_Str") != -1);
}
Program: 185504
Project: 185504
Buggy source:
private int getAccuracy(TypeConfidence confidence){
  if (shouldAlwaysBeAccurate()) {
    return SearchMatch.A_ACCURATE;
  }
switch (confidence) {
case EXACT:
    return SearchMatch.A_ACCURATE;
default :
  return SearchMatch.A_INACCURATE;
}
}

Fixed version (ground truth):
private int getAccuracy(TypeConfidence confidence){
  return (shouldAlwaysBeAccurate() || confidence == TypeConfidence.EXACT ? SearchMatch.A_ACCURATE : SearchMatch.A_INACCURATE);
}
Program: 185505
Project: 185505
Buggy source:
protected TypeReferenceMatch createMatch(TypeLookupResult result,IJavaElement enclosingElement,int start,int end){
  IJavaElement element;
  if (findDeclaration) {
    try {
      ClassNode type=result.type;
      while (type.getComponentType() != null) {
        type=type.getComponentType();
      }
      element=enclosingElement.getJavaProject().findType(type.getName().replace('$','.'),new NullProgressMonitor());
      if (element == null) {
        element=enclosingElement;
      }
    }
 catch (    JavaModelException e) {
      Util.log(e);
      element=enclosingElement;
    }
  }
 else {
    element=enclosingElement;
  }
  return new TypeReferenceMatch(element,getAccuracy(result.confidence),start,end - start,false,participant,element.getResource());
}

Fixed version (ground truth):
protected TypeReferenceMatch createMatch(TypeLookupResult result,IJavaElement enclosingElement,int start,int end){
  IJavaElement element=enclosingElement;
  if (findDeclaration) {
    try {
      ClassNode type=GroovyUtils.getBaseType(result.type);
      IJavaElement e=enclosingElement.getJavaProject().findType(type.getName().replace('$','.'),new NullProgressMonitor());
      if (e != null) {
        element=e;
      }
    }
 catch (    JavaModelException e) {
      Util.log(e);
    }
  }
  return new TypeReferenceMatch(element,getAccuracy(result.confidence),start,end - start,false,participant,element.getResource());
}