Program: 34373
Project: 34373
Buggy source:
private int diffVarDef(JCVariableDecl oldT,JCVariableDecl newT,int[] bounds){
  int localPointer=bounds[0];
  if ((oldT.mods.flags & Flags.ENUM) != 0) {
    if (nameChanged(oldT.name,newT.name)) {
      copyTo(localPointer,oldT.pos);
      printer.print(newT.name);
      diffInfo.put(oldT.pos,NbBundle.getMessage(CasualDiff.class,"String_Node_Str",oldT.name));
      localPointer=oldT.pos + oldT.name.length();
    }
    JCNewClass oldInit=(JCNewClass)oldT.init;
    JCNewClass newInit=(JCNewClass)newT.init;
    if (oldInit.args.nonEmpty() && newInit.args.nonEmpty()) {
      copyTo(localPointer,localPointer=getOldPos(oldInit.args.head));
      localPointer=diffParameterList(oldInit.args,newInit.args,null,localPointer,Measure.ARGUMENT);
    }
    if (oldInit.def != null && newInit.def != null) {
      anonClass=true;
      int[] defBounds=new int[]{localPointer,endPos(oldInit.def)};
      localPointer=diffTree(oldInit.def,newInit.def,defBounds);
      anonClass=false;
    }
    copyTo(localPointer,bounds[1]);
    return bounds[1];
  }
  if (!matchModifiers(oldT.mods,newT.mods)) {
    if (hasModifiers(newT.mods)) {
      localPointer=diffModifiers(oldT.mods,newT.mods,oldT,localPointer);
    }
 else {
      if (hasModifiers(oldT.mods)) {
        int oldPos=getOldPos(oldT.mods);
        copyTo(localPointer,oldPos);
        localPointer=getOldPos(oldT.vartype);
      }
    }
  }
  boolean cLikeArray=false, cLikeArrayChange=false;
  int addDimensions=0;
  if (diffContext.syntheticTrees.contains(oldT.vartype)) {
    if (!diffContext.syntheticTrees.contains(newT.vartype)) {
      int varOffset=skipExtraVarKeywordIfPresent(localPointer,oldT.pos);
      if (varOffset == -1) {
        copyTo(localPointer,oldT.pos);
      }
      localPointer=oldT.pos;
      printer.suppressVariableType=suppressParameterTypes;
      int l=printer.out.length();
      printer.print(newT.vartype);
      printer.suppressVariableType=false;
      if (l < printer.out.length()) {
        printer.print("String_Node_Str");
      }
    }
  }
 else {
    if (suppressParameterTypes) {
      int[] vartypeBounds=getBounds(oldT.vartype);
      localPointer=vartypeBounds[1];
    }
 else     if (newT.vartype == null) {
      throw new UnsupportedOperationException();
    }
 else {
      int[] vartypeBounds=getBounds(oldT.vartype);
      addDimensions=dimension(newT.vartype,-1);
      cLikeArray=vartypeBounds[1] > oldT.pos;
      cLikeArrayChange=cLikeArray && dimension(oldT.vartype,oldT.pos) > addDimensions;
      if (oldT.type.getKind() == TypeKind.ERROR && vartypeBounds[1] == -1) {
        int modsUpperBound=getCommentCorrectedEndPos(oldT.mods);
        if (modsUpperBound > -1) {
          tokenSequence.move(modsUpperBound);
          if (tokenSequence.moveNext()) {
            copyTo(localPointer,localPointer=modsUpperBound);
          }
        }
        int offset=localPointer;
        JavaTokenId tokenId=null;
        tokenSequence.move(localPointer);
        while (tokenSequence.moveNext()) {
          offset=tokenSequence.offset();
          tokenId=tokenSequence.token().id();
          if (!((tokenId == JavaTokenId.WHITESPACE || tokenId == JavaTokenId.BLOCK_COMMENT || tokenId == JavaTokenId.JAVADOC_COMMENT) && offset < oldT.sym.pos)) {
            break;
          }
        }
        copyTo(localPointer,localPointer=offset);
        vartypeBounds[1]=oldT.sym.pos;
        vartypeBounds[0]=offset;
      }
 else {
        copyTo(localPointer,vartypeBounds[0]);
      }
      localPointer=diffTree(oldT.vartype,newT.vartype,vartypeBounds);
      if (oldT.type.getKind() == TypeKind.ERROR && localPointer == -1) {
        tokenSequence.move(vartypeBounds[0]);
        tokenSequence.moveNext();
        if (tokenSequence.moveNext()) {
          int offset=tokenSequence.offset();
          copyTo(offset,localPointer=vartypeBounds[1]);
        }
      }
    }
  }
  if (nameChanged(oldT.name,newT.name)) {
    boolean isOldError=oldT.name == Names.instance(context).error;
    if (!isOldError) {
      copyTo(localPointer,oldT.pos);
    }
 else {
      printer.print("String_Node_Str");
    }
    if (cLikeArray) {
      printer.eatChars(1);
      for (int i=0; i < addDimensions; i++) {
        printer.print("String_Node_Str");
      }
      printer.print("String_Node_Str");
    }
    printer.print(newT.name);
    diffInfo.put(oldT.pos,NbBundle.getMessage(CasualDiff.class,"String_Node_Str",oldT.name));
    if (!isOldError) {
      if (cLikeArray) {
        int[] clab=getBounds(oldT.vartype);
        localPointer=clab[1];
      }
 else {
        localPointer=oldT.pos + oldT.name.length();
      }
    }
  }
 else   if (cLikeArrayChange) {
    for (int i=0; i < addDimensions; i++) {
      printer.print("String_Node_Str");
    }
    printer.print("String_Node_Str");
    printer.print(newT.name);
  }
  if (newT.init != null && oldT.init != null) {
    copyTo(localPointer,localPointer=getCommentCorrectedOldPos(oldT.init));
    localPointer=diffTree(oldT.init,newT.init,new int[]{localPointer,endPos(oldT.init)});
  }
 else {
    if (oldT.init != null && newT.init == null) {
      int pos=getOldPos(oldT.init);
      tokenSequence.move(pos);
      moveToSrcRelevant(tokenSequence,Direction.BACKWARD);
      moveToSrcRelevant(tokenSequence,Direction.BACKWARD);
      tokenSequence.moveNext();
      int to=tokenSequence.offset();
      copyTo(localPointer,to);
      localPointer=endPos(oldT.init);
    }
    if (oldT.init == null && newT.init != null) {
      int end=endPos(oldT);
      tokenSequence.move(end);
      tokenSequence.moveNext();
      if (!JavaTokenId.COMMA.equals(tokenSequence.token().id()) && !JavaTokenId.SEMICOLON.equals(tokenSequence.token().id())) {
        tokenSequence.movePrevious();
      }
      moveToSrcRelevant(tokenSequence,Direction.BACKWARD);
      tokenSequence.moveNext();
      copyTo(localPointer,localPointer=tokenSequence.offset());
      printer.printVarInit(newT);
    }
  }
  copyTo(localPointer,bounds[1]);
  return bounds[1];
}

Fixed version (ground truth):
private int diffVarDef(JCVariableDecl oldT,JCVariableDecl newT,int[] bounds){
  int localPointer=bounds[0];
  if ((oldT.mods.flags & Flags.ENUM) != 0) {
    if (nameChanged(oldT.name,newT.name)) {
      copyTo(localPointer,oldT.pos);
      printer.print(newT.name);
      diffInfo.put(oldT.pos,NbBundle.getMessage(CasualDiff.class,"String_Node_Str",oldT.name));
      localPointer=oldT.pos + oldT.name.length();
    }
    JCNewClass oldInit=(JCNewClass)oldT.init;
    JCNewClass newInit=(JCNewClass)newT.init;
    if (oldInit.args.nonEmpty() && newInit.args.nonEmpty()) {
      copyTo(localPointer,localPointer=getOldPos(oldInit.args.head));
      localPointer=diffParameterList(oldInit.args,newInit.args,null,localPointer,Measure.ARGUMENT);
    }
    if (oldInit.def != null && newInit.def != null) {
      anonClass=true;
      int[] defBounds=new int[]{localPointer,endPos(oldInit.def)};
      localPointer=diffTree(oldInit.def,newInit.def,defBounds);
      anonClass=false;
    }
    copyTo(localPointer,bounds[1]);
    return bounds[1];
  }
  if (!matchModifiers(oldT.mods,newT.mods)) {
    if (hasModifiers(newT.mods)) {
      localPointer=diffModifiers(oldT.mods,newT.mods,oldT,localPointer);
    }
 else {
      if (hasModifiers(oldT.mods)) {
        int oldPos=getOldPos(oldT.mods);
        copyTo(localPointer,oldPos);
        localPointer=getOldPos(oldT.vartype);
      }
    }
  }
  boolean cLikeArray=false, cLikeArrayChange=false;
  int addDimensions=0;
  if (diffContext.syntheticTrees.contains(oldT.vartype)) {
    if (!diffContext.syntheticTrees.contains(newT.vartype)) {
      int varOffset=skipExtraVarKeywordIfPresent(localPointer,oldT.pos);
      if (varOffset == -1) {
        copyTo(localPointer,oldT.pos);
      }
      localPointer=oldT.pos;
      printer.suppressVariableType=suppressParameterTypes;
      int l=printer.out.length();
      if (!suppressParameterTypes) {
        printer.print(newT.vartype);
        if (l < printer.out.length()) {
          printer.print("String_Node_Str");
        }
      }
      printer.suppressVariableType=false;
    }
  }
 else {
    if (suppressParameterTypes) {
      int[] vartypeBounds=getBounds(oldT.vartype);
      localPointer=vartypeBounds[1];
    }
 else     if (newT.vartype == null) {
      throw new UnsupportedOperationException();
    }
 else {
      int[] vartypeBounds=getBounds(oldT.vartype);
      addDimensions=dimension(newT.vartype,-1);
      cLikeArray=vartypeBounds[1] > oldT.pos;
      cLikeArrayChange=cLikeArray && dimension(oldT.vartype,oldT.pos) > addDimensions;
      if (oldT.type.getKind() == TypeKind.ERROR && vartypeBounds[1] == -1) {
        int modsUpperBound=getCommentCorrectedEndPos(oldT.mods);
        if (modsUpperBound > -1) {
          tokenSequence.move(modsUpperBound);
          if (tokenSequence.moveNext()) {
            copyTo(localPointer,localPointer=modsUpperBound);
          }
        }
        int offset=localPointer;
        JavaTokenId tokenId=null;
        tokenSequence.move(localPointer);
        while (tokenSequence.moveNext()) {
          offset=tokenSequence.offset();
          tokenId=tokenSequence.token().id();
          if (!((tokenId == JavaTokenId.WHITESPACE || tokenId == JavaTokenId.BLOCK_COMMENT || tokenId == JavaTokenId.JAVADOC_COMMENT) && offset < oldT.sym.pos)) {
            break;
          }
        }
        copyTo(localPointer,localPointer=offset);
        vartypeBounds[1]=oldT.sym.pos;
        vartypeBounds[0]=offset;
      }
 else {
        copyTo(localPointer,vartypeBounds[0]);
      }
      localPointer=diffTree(oldT.vartype,newT.vartype,vartypeBounds);
      if (oldT.type.getKind() == TypeKind.ERROR && localPointer == -1) {
        tokenSequence.move(vartypeBounds[0]);
        tokenSequence.moveNext();
        if (tokenSequence.moveNext()) {
          int offset=tokenSequence.offset();
          copyTo(offset,localPointer=vartypeBounds[1]);
        }
      }
    }
  }
  if (nameChanged(oldT.name,newT.name)) {
    boolean isOldError=oldT.name == Names.instance(context).error;
    if (!isOldError) {
      copyTo(localPointer,oldT.pos);
    }
 else {
      printer.print("String_Node_Str");
    }
    if (cLikeArray) {
      printer.eatChars(1);
      for (int i=0; i < addDimensions; i++) {
        printer.print("String_Node_Str");
      }
      printer.print("String_Node_Str");
    }
    printer.print(newT.name);
    diffInfo.put(oldT.pos,NbBundle.getMessage(CasualDiff.class,"String_Node_Str",oldT.name));
    if (!isOldError) {
      if (cLikeArray) {
        int[] clab=getBounds(oldT.vartype);
        localPointer=clab[1];
      }
 else {
        localPointer=oldT.pos + oldT.name.length();
      }
    }
  }
 else   if (cLikeArrayChange) {
    for (int i=0; i < addDimensions; i++) {
      printer.print("String_Node_Str");
    }
    printer.print("String_Node_Str");
    printer.print(newT.name);
  }
  if (newT.init != null && oldT.init != null) {
    copyTo(localPointer,localPointer=getCommentCorrectedOldPos(oldT.init));
    localPointer=diffTree(oldT.init,newT.init,new int[]{localPointer,endPos(oldT.init)});
  }
 else {
    if (oldT.init != null && newT.init == null) {
      int pos=getOldPos(oldT.init);
      tokenSequence.move(pos);
      moveToSrcRelevant(tokenSequence,Direction.BACKWARD);
      moveToSrcRelevant(tokenSequence,Direction.BACKWARD);
      tokenSequence.moveNext();
      int to=tokenSequence.offset();
      copyTo(localPointer,to);
      localPointer=endPos(oldT.init);
    }
    if (oldT.init == null && newT.init != null) {
      int end=endPos(oldT);
      tokenSequence.move(end);
      tokenSequence.moveNext();
      if (!JavaTokenId.COMMA.equals(tokenSequence.token().id()) && !JavaTokenId.SEMICOLON.equals(tokenSequence.token().id())) {
        tokenSequence.movePrevious();
      }
      moveToSrcRelevant(tokenSequence,Direction.BACKWARD);
      tokenSequence.moveNext();
      copyTo(localPointer,localPointer=tokenSequence.offset());
      printer.printVarInit(newT);
    }
  }
  copyTo(localPointer,bounds[1]);
  return bounds[1];
}