Program: 83516
Project: 83516
Buggy source:
/** 
 * Invoked by   {@link HtmlGenerator}'s constructor to complete the initialization. <p> This is where the actual annotation of the source code happens.
 */
protected void configure(final CompilationUnitTree cu,final HtmlGenerator gen) throws IOException {
  final LineMap lineMap=cu.getLineMap();
  final LinkResolver linkResolver=linkResolverFactory.create(cu,this);
  JavaLexer lexer=new JavaLexer(new StringReader(gen.sourceFile));
  lexer.setTabSize(tabWidth);
  try {
    while (true) {
      Token token=lexer.nextToken();
      int type=token.getType();
      if (type == JavaTokenTypes.EOF)       break;
      if (type == JavaTokenTypes.IDENT && ReservedWords.LIST.contains(token.getText()))       gen.add(new SpanMarker(lineMap,token,"String_Node_Str"));
      if (type == JavaTokenTypes.ML_COMMENT || type == JavaTokenTypes.SL_COMMENT)       gen.add(new CommentMarker(lineMap,token));
    }
  }
 catch (  TokenStreamException e) {
  }
  new TreeScanner<Void,Void>(){
    private String buildId(    Element e){
      String buf=linkResolver.href(e);
      if (buf.length() == 0)       return null;
      if (buf.charAt(0) != '#')       throw new IllegalStateException("String_Node_Str" + e + "String_Node_Str"+ buf);
      return buf.substring(1);
    }
    /** 
 * primitive types like int, long, void, etc.
 */
    public Void visitPrimitiveType(    PrimitiveTypeTree pt,    Void _){
      gen.add(new SpanMarker(cu,srcPos,pt,"String_Node_Str"));
      return super.visitPrimitiveType(pt,_);
    }
    /** 
 * literal string, int, etc. Null.
 */
    public Void visitLiteral(    LiteralTree lit,    Void _){
      gen.add(new SpanMarker(cu,srcPos,lit,"String_Node_Str"));
      return super.visitLiteral(lit,_);
    }
    /** 
 * Definition of a variable, such as parameter, field, and local variables.
 */
    public Void visitVariable(    VariableTree vt,    Void _){
      Element e=TreeUtil.getElement(vt);
      if (e != null) {
        if (e.getKind() != ElementKind.ENUM_CONSTANT) {
          Token t=gen.findTokenAfter(vt.getType());
          if (t != null) {
            gen.add(new SpanMarker(lineMap,t,getCssClass(e,"String_Node_Str"),buildId(e)));
          }
        }
 else {
          gen.add(new SpanMarker(cu,srcPos,vt,getCssClass(e,"String_Node_Str"),buildId(e)));
        }
      }
      return super.visitVariable(vt,_);
    }
    private void addBookmark(    Tree t,    Bookmark bookmark){
      gen.add(lineMap.getLineNumber(srcPos.getStartPosition(cu,t)),bookmark);
    }
    /** 
 * Method declaration.
 */
    public Void visitMethod(    MethodTree mt,    Void _){
      ExecutableElement e=(ExecutableElement)TreeUtil.getElement(mt);
      if (e != null) {
        gen.add(new SpanMarker(cu,srcPos,mt,getCssClass(e,"String_Node_Str"),buildId(e)));
        ParsedType pt=getParsedType((TypeElement)e.getEnclosingElement());
        Set<Match> r=pt.findOverriddenMethods(elements,e);
        if (!r.isEmpty()) {
          addBookmark(mt,new OverriddenMethodsBookmark(r,linkResolver));
        }
        r=pt.findOverridingMethods(elements,e);
        if (!r.isEmpty()) {
          addBookmark(mt,new OverridingMethodsBookmark(r,linkResolver));
        }
      }
      return super.visitMethod(mt,_);
    }
    /** 
 * Class declaration.
 */
    public Void visitClass(    ClassTree ct,    Void _){
      TypeElement e=(TypeElement)TreeUtil.getElement(ct);
      if (e != null) {
        gen.add(new SpanMarker(cu,srcPos,ct,getCssClass(e,"String_Node_Str"),buildId(e)));
        List<ParsedType> descendants=getParsedType(e).descendants;
        if (!descendants.isEmpty()) {
          addBookmark(ct,new SubClassBookmark(descendants,linkResolver));
        }
        if (e.getNestingKind() == NestingKind.ANONYMOUS) {
          scan(ct.getMembers());
          return _;
        }
      }
      return super.visitClass(ct,_);
    }
    /** 
 * All the symbols found in the source code.
 */
    public Void visitIdentifier(    IdentifierTree id,    Void _){
      if (!ReservedWords.LIST.contains(id.getName().toString())) {
        Element e=TreeUtil.getElement(id);
        if (e != null) {
          gen.add(new LinkMarker(cu,srcPos,id,linkResolver.href(e),getCssClass(e,"String_Node_Str")));
        }
      }
      return super.visitIdentifier(id,_);
    }
    /** 
 * "exp.token"
 */
    public Void visitMemberSelect(    MemberSelectTree mst,    Void _){
      long ep=srcPos.getEndPosition(cu,mst);
      long sp=ep - mst.getIdentifier().length();
      Element e=TreeUtil.getElement(mst);
      if (e != null) {
        gen.add(new LinkMarker(sp,ep,linkResolver.href(e),getCssClass(e,"String_Node_Str")));
      }
      return super.visitMemberSelect(mst,_);
    }
    public Void visitNewClass(    NewClassTree nt,    Void _){
      long ep=srcPos.getEndPosition(cu,nt.getIdentifier());
      long sp=srcPos.getStartPosition(cu,nt.getIdentifier());
      Element e=TreeUtil.getElement(nt);
      if (e != null) {
        gen.add(new LinkMarker(sp,ep,linkResolver.href(e),getCssClass(e,"String_Node_Str")));
      }
      scan(nt.getEnclosingExpression());
      scan(nt.getArguments());
      scan(nt.getTypeArguments());
      scan(nt.getClassBody());
      return _;
    }
    /** 
 * Method invocation of the form "exp.method()"
 */
    public Void visitMethodInvocation(    MethodInvocationTree mi,    Void _){
      ExpressionTree ms=mi.getMethodSelect();
      Element e=TreeUtil.getElement(mi);
      if (e != null) {
        Name methodName=e.getSimpleName();
        long ep=srcPos.getEndPosition(cu,ms);
        if (ep >= 0) {
          gen.add(new LinkMarker(ep - methodName.length(),ep,linkResolver.href(e),getCssClass(e,"String_Node_Str")));
        }
      }
      return super.visitMethodInvocation(mi,_);
    }
    private void scan(    List<? extends Tree> list){
      for (      Tree t : list)       scan(t);
    }
    private void scan(    Tree t){
      scan(t,null);
    }
  }
.scan(cu,null);
  ExpressionTree packageName=cu.getPackageName();
  if (packageName != null) {
    new TreePathScanner<String,Void>(){
      /** 
 * For "a" of "a.b.c"
 */
      public String visitIdentifier(      IdentifierTree id,      Void _){
        String name=id.getName().toString();
        PackageElement pe=elements.getPackageElement(name);
        gen.add(new LinkMarker(cu,srcPos,id,linkResolver.href(pe),getCssClass(pe,"String_Node_Str")));
        return name;
      }
      public String visitMemberSelect(      MemberSelectTree mst,      Void _){
        String baseName=scan(mst.getExpression(),_);
        String name=mst.getIdentifier().toString();
        if (baseName.length() > 0)         name=baseName + '.' + name;
        PackageElement pe=elements.getPackageElement(name);
        long ep=srcPos.getEndPosition(cu,mst);
        long sp=ep - mst.getIdentifier().length();
        gen.add(new LinkMarker(sp,ep,linkResolver.href(pe),getCssClass(pe,"String_Node_Str")));
        return name;
      }
    }
.scan(new TreePath(new TreePath(cu),packageName),null);
  }
}

Fixed version (ground truth):
/** 
 * Invoked by   {@link HtmlGenerator}'s constructor to complete the initialization. <p> This is where the actual annotation of the source code happens.
 */
protected void configure(final CompilationUnitTree cu,final HtmlGenerator gen) throws IOException {
  final LineMap lineMap=cu.getLineMap();
  final LinkResolver linkResolver=linkResolverFactory.create(cu,this);
  JavaLexer lexer=new JavaLexer(new StringReader(gen.sourceFile));
  lexer.setTabSize(tabWidth);
  try {
    while (true) {
      Token token=lexer.nextToken();
      int type=token.getType();
      if (type == JavaTokenTypes.EOF)       break;
      if (type == JavaTokenTypes.IDENT && ReservedWords.LIST.contains(token.getText()))       gen.add(new SpanMarker(lineMap,token,"String_Node_Str"));
      if (type == JavaTokenTypes.ML_COMMENT || type == JavaTokenTypes.SL_COMMENT)       gen.add(new CommentMarker(lineMap,token));
    }
  }
 catch (  TokenStreamException e) {
  }
  new TreeScanner<Void,Void>(){
    private String buildId(    Element e){
      String buf=linkResolver.href(e);
      if (buf.length() == 0)       return null;
      if (buf.charAt(0) != '#')       throw new IllegalStateException("String_Node_Str" + e + "String_Node_Str"+ buf);
      return buf.substring(1);
    }
    /** 
 * primitive types like int, long, void, etc.
 */
    public Void visitPrimitiveType(    PrimitiveTypeTree pt,    Void _){
      gen.add(new SpanMarker(cu,srcPos,pt,"String_Node_Str"));
      return super.visitPrimitiveType(pt,_);
    }
    /** 
 * literal string, int, etc. Null.
 */
    public Void visitLiteral(    LiteralTree lit,    Void _){
      gen.add(new SpanMarker(cu,srcPos,lit,"String_Node_Str"));
      return super.visitLiteral(lit,_);
    }
    /** 
 * Definition of a variable, such as parameter, field, and local variables.
 */
    public Void visitVariable(    VariableTree vt,    Void _){
      Element e=TreeUtil.getElement(vt);
      if (e != null) {
        if (e.getKind() != ElementKind.ENUM_CONSTANT) {
          Token t=gen.findTokenAfter(vt.getType(),vt.getName().toString());
          if (t != null) {
            gen.add(new SpanMarker(lineMap,t,getCssClass(e,"String_Node_Str"),buildId(e)));
          }
        }
 else {
          gen.add(new SpanMarker(cu,srcPos,vt,getCssClass(e,"String_Node_Str"),buildId(e)));
        }
      }
      return super.visitVariable(vt,_);
    }
    private void addBookmark(    Tree t,    Bookmark bookmark){
      gen.add(lineMap.getLineNumber(srcPos.getStartPosition(cu,t)),bookmark);
    }
    /** 
 * Method declaration.
 */
    public Void visitMethod(    MethodTree mt,    Void _){
      ExecutableElement e=(ExecutableElement)TreeUtil.getElement(mt);
      if (e != null) {
        gen.add(new SpanMarker(cu,srcPos,mt,getCssClass(e,"String_Node_Str"),buildId(e)));
        ParsedType pt=getParsedType((TypeElement)e.getEnclosingElement());
        Set<Match> r=pt.findOverriddenMethods(elements,e);
        if (!r.isEmpty()) {
          addBookmark(mt,new OverriddenMethodsBookmark(r,linkResolver));
        }
        r=pt.findOverridingMethods(elements,e);
        if (!r.isEmpty()) {
          addBookmark(mt,new OverridingMethodsBookmark(r,linkResolver));
        }
      }
      return super.visitMethod(mt,_);
    }
    /** 
 * Class declaration.
 */
    public Void visitClass(    ClassTree ct,    Void _){
      TypeElement e=(TypeElement)TreeUtil.getElement(ct);
      if (e != null) {
        gen.add(new SpanMarker(cu,srcPos,ct,getCssClass(e,"String_Node_Str"),buildId(e)));
        List<ParsedType> descendants=getParsedType(e).descendants;
        if (!descendants.isEmpty()) {
          addBookmark(ct,new SubClassBookmark(descendants,linkResolver));
        }
        if (e.getNestingKind() == NestingKind.ANONYMOUS) {
          scan(ct.getMembers());
          return _;
        }
      }
      return super.visitClass(ct,_);
    }
    /** 
 * All the symbols found in the source code.
 */
    public Void visitIdentifier(    IdentifierTree id,    Void _){
      if (!ReservedWords.LIST.contains(id.getName().toString())) {
        Element e=TreeUtil.getElement(id);
        if (e != null) {
          gen.add(new LinkMarker(cu,srcPos,id,linkResolver.href(e),getCssClass(e,"String_Node_Str")));
        }
      }
      return super.visitIdentifier(id,_);
    }
    /** 
 * "exp.token"
 */
    public Void visitMemberSelect(    MemberSelectTree mst,    Void _){
      long ep=srcPos.getEndPosition(cu,mst);
      long sp=ep - mst.getIdentifier().length();
      Element e=TreeUtil.getElement(mst);
      if (e != null) {
        gen.add(new LinkMarker(sp,ep,linkResolver.href(e),getCssClass(e,"String_Node_Str")));
      }
      return super.visitMemberSelect(mst,_);
    }
    public Void visitNewClass(    NewClassTree nt,    Void _){
      long ep=srcPos.getEndPosition(cu,nt.getIdentifier());
      long sp=srcPos.getStartPosition(cu,nt.getIdentifier());
      Element e=TreeUtil.getElement(nt);
      if (e != null) {
        gen.add(new LinkMarker(sp,ep,linkResolver.href(e),getCssClass(e,"String_Node_Str")));
      }
      scan(nt.getEnclosingExpression());
      scan(nt.getArguments());
      scan(nt.getTypeArguments());
      scan(nt.getClassBody());
      return _;
    }
    /** 
 * Method invocation of the form "exp.method()"
 */
    public Void visitMethodInvocation(    MethodInvocationTree mi,    Void _){
      ExpressionTree ms=mi.getMethodSelect();
      Element e=TreeUtil.getElement(mi);
      if (e != null) {
        Name methodName=e.getSimpleName();
        long ep=srcPos.getEndPosition(cu,ms);
        if (ep >= 0) {
          gen.add(new LinkMarker(ep - methodName.length(),ep,linkResolver.href(e),getCssClass(e,"String_Node_Str")));
        }
      }
      return super.visitMethodInvocation(mi,_);
    }
    private void scan(    List<? extends Tree> list){
      for (      Tree t : list)       scan(t);
    }
    private void scan(    Tree t){
      scan(t,null);
    }
  }
.scan(cu,null);
  ExpressionTree packageName=cu.getPackageName();
  if (packageName != null) {
    new TreePathScanner<String,Void>(){
      /** 
 * For "a" of "a.b.c"
 */
      public String visitIdentifier(      IdentifierTree id,      Void _){
        String name=id.getName().toString();
        PackageElement pe=elements.getPackageElement(name);
        gen.add(new LinkMarker(cu,srcPos,id,linkResolver.href(pe),getCssClass(pe,"String_Node_Str")));
        return name;
      }
      public String visitMemberSelect(      MemberSelectTree mst,      Void _){
        String baseName=scan(mst.getExpression(),_);
        String name=mst.getIdentifier().toString();
        if (baseName.length() > 0)         name=baseName + '.' + name;
        PackageElement pe=elements.getPackageElement(name);
        long ep=srcPos.getEndPosition(cu,mst);
        long sp=ep - mst.getIdentifier().length();
        gen.add(new LinkMarker(sp,ep,linkResolver.href(pe),getCssClass(pe,"String_Node_Str")));
        return name;
      }
    }
.scan(new TreePath(new TreePath(cu),packageName),null);
  }
}