nus-yam/ex-repair huggingface dataset:
Program: 34327
Project: 34327
Buggy source:
@Override public NullnessHint onDataflowVisitMethodInvocation(MethodInvocationNode node,Types types,AccessPathNullnessPropagation.SubNodeValues inputs,AccessPathNullnessPropagation.Updates thenUpdates,AccessPathNullnessPropagation.Updates elseUpdates,AccessPathNullnessPropagation.Updates bothUpdates){
  Symbol.MethodSymbol symbol=ASTHelpers.getSymbol(node.getTree());
  if (thriftIsSetCall(symbol,types)) {
    String methodName=symbol.getSimpleName().toString();
    String capPropName=methodName.substring(5);
    Pair<Element,Element> fieldAndGetter=getFieldAndSetterForProperty(symbol,capPropName);
    Node base=node.getTarget().getReceiver();
    thenUpdates.set(AccessPath.fromBaseAndElement(base,fieldAndGetter.first),Nullness.NONNULL);
    thenUpdates.set(AccessPath.fromBaseAndElement(base,fieldAndGetter.second),Nullness.NONNULL);
  }
  return NullnessHint.UNKNOWN;
}

Fixed version (ground truth):
@Override public NullnessHint onDataflowVisitMethodInvocation(MethodInvocationNode node,Types types,AccessPathNullnessPropagation.SubNodeValues inputs,AccessPathNullnessPropagation.Updates thenUpdates,AccessPathNullnessPropagation.Updates elseUpdates,AccessPathNullnessPropagation.Updates bothUpdates){
  Symbol.MethodSymbol symbol=ASTHelpers.getSymbol(node.getTree());
  if (thriftIsSetCall(symbol,types)) {
    String methodName=symbol.getSimpleName().toString();
    String capPropName=methodName.substring(5);
    Pair<Element,Element> fieldAndGetter=getFieldAndSetterForProperty(symbol,capPropName);
    Node base=node.getTarget().getReceiver();
    if (fieldAndGetter.first != null) {
      thenUpdates.set(AccessPath.fromBaseAndElement(base,fieldAndGetter.first),Nullness.NONNULL);
    }
    thenUpdates.set(AccessPath.fromBaseAndElement(base,fieldAndGetter.second),Nullness.NONNULL);
  }
  return NullnessHint.UNKNOWN;
}
Program: 34328
Project: 34328
Buggy source:
/** 
 * Copy Jar Input Stream to Jar Output Stream and add nullability model.
 * @param zis Jar Input Stream.
 * @param zos Jar Output Stream.
 */
private static void writeModelToJarStream(ZipInputStream zis,ZipOutputStream zos) throws IOException {
  for (ZipEntry ze; (ze=zis.getNextEntry()) != null; ) {
    zos.putNextEntry(ze);
    IOUtils.copy(zis,zos);
    zos.closeEntry();
  }
  zis.close();
  if (!map_result.isEmpty()) {
    zos.putNextEntry(new ZipEntry(DEFAULT_ASTUBX_LOCATION));
    writeModel(new DataOutputStream(zos));
    zos.closeEntry();
  }
  zos.finish();
}

Fixed version (ground truth):
/** 
 * Copy Jar Input Stream to Jar Output Stream and add nullability model.
 * @param zis Jar Input Stream.
 * @param zos Jar Output Stream.
 */
private static void writeModelToJarStream(ZipInputStream zis,ZipOutputStream zos) throws IOException {
  for (ZipEntry ze; (ze=zis.getNextEntry()) != null; ) {
    zos.putNextEntry(new ZipEntry(ze.getName()));
    IOUtils.copy(zis,zos);
    zos.closeEntry();
  }
  zis.close();
  if (!map_result.isEmpty()) {
    zos.putNextEntry(new ZipEntry(DEFAULT_ASTUBX_LOCATION));
    writeModel(new DataOutputStream(zos));
    zos.closeEntry();
  }
  zos.finish();
}
Program: 34329
Project: 34329
Buggy source:
private static boolean hasSameArgTypes(Symbol.MethodSymbol method1,Symbol.MethodSymbol method2,Types types){
  com.sun.tools.javac.util.List<VarSymbol> method1params=method1.getParameters();
  com.sun.tools.javac.util.List<VarSymbol> method2params=method2.getParameters();
  if (method1params.size() != method2params.size()) {
    return false;
  }
  for (int i=0; i < method1params.size(); i++) {
    if (!types.isSameType(method1params.get(i).type,method2params.get(i).type)) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
private static boolean hasSameArgTypes(Symbol.MethodSymbol method1,Symbol.MethodSymbol method2,Types types){
  com.sun.tools.javac.util.List<Type> method1ArgTypes=method1.type.asMethodType().argtypes;
  com.sun.tools.javac.util.List<Type> method2ArgTypes=method2.type.asMethodType().argtypes;
  return types.isSameTypes(types.erasure(method1ArgTypes),types.erasure(method2ArgTypes));
}
Program: 34330
Project: 34330
Buggy source:
private boolean mayBeNullFieldAccess(VisitorState state,ExpressionTree expr,Symbol exprSymbol){
  if (exprSymbol != null && !Nullness.hasNullableAnnotation(exprSymbol)) {
    return false;
  }
  return nullnessFromDataflow(state,expr);
}

Fixed version (ground truth):
private boolean mayBeNullFieldAccess(VisitorState state,ExpressionTree expr,Symbol exprSymbol){
  if (exprSymbol != null && (fromUnannotatedPackage(exprSymbol) || !Nullness.hasNullableAnnotation(exprSymbol))) {
    return false;
  }
  return nullnessFromDataflow(state,expr);
}
Program: 34331
Project: 34331
Buggy source:
@Test public void coreNullabilityNegativeCases(){
  compilationHelper.addSourceFile("String_Node_Str").addSourceFile("String_Node_Str").addSourceFile("String_Node_Str").doTest();
}

Fixed version (ground truth):
@Test public void coreNullabilityNegativeCases(){
  compilationHelper.addSourceFile("String_Node_Str").addSourceFile("String_Node_Str").addSourceFile("String_Node_Str").addSourceFile("String_Node_Str").doTest();
}
Program: 34332
Project: 34332
Buggy source:
UnannotatedClass(){
}

Fixed version (ground truth):
public UnannotatedClass(){
}
Program: 34333
Project: 34333
Buggy source:
public NullAway(ErrorProneFlags flags){
  config=new ErrorProneCLIFlagsConfig(flags);
  AnnotationUtils.clear();
}

Fixed version (ground truth):
public NullAway(ErrorProneFlags flags){
  config=new ErrorProneCLIFlagsConfig(flags);
  nonAnnotatedMethod=nonAnnotatedMethodCheck();
  AnnotationUtils.clear();
}
Program: 34334
Project: 34334
Buggy source:
private boolean mayBeNullFieldAccess(VisitorState state,ExpressionTree expr,Symbol exprSymbol){
  if (exprSymbol != null && (fromUnannotatedPackage(exprSymbol) || !Nullness.hasNullableAnnotation(exprSymbol))) {
    return false;
  }
  return nullnessFromDataflow(state,expr);
}

Fixed version (ground truth):
private boolean mayBeNullFieldAccess(VisitorState state,ExpressionTree expr,Symbol exprSymbol){
  if (!NullabilityUtil.mayBeNullFieldFromType(exprSymbol,config)) {
    return false;
  }
  return nullnessFromDataflow(state,expr);
}
Program: 34335
Project: 34335
Buggy source:
private boolean mayBeNullMethodCall(VisitorState state,ExpressionTree expr,Symbol.MethodSymbol exprSymbol){
  if (fromUnannotatedPackage(exprSymbol)) {
    return false;
  }
  if (!Nullness.hasNullableAnnotation(exprSymbol)) {
    return false;
  }
  return nullnessFromDataflow(state,expr);
}

Fixed version (ground truth):
private boolean mayBeNullMethodCall(VisitorState state,ExpressionTree expr,Symbol.MethodSymbol exprSymbol){
  if (NullabilityUtil.fromUnannotatedPackage(exprSymbol,config)) {
    return false;
  }
  if (!Nullness.hasNullableAnnotation(exprSymbol)) {
    return false;
  }
  return nullnessFromDataflow(state,expr);
}
Program: 34337
Project: 34337
Buggy source:
private Description checkReturnExpression(Tree tree,ExpressionTree retExpr,Symbol.MethodSymbol methodSymbol,VisitorState state){
  Type returnType=methodSymbol.getReturnType();
  if (returnType.isPrimitive()) {
    return doUnboxingCheck(state,retExpr);
  }
  if (returnType.toString().equals("String_Node_Str")) {
    return Description.NO_MATCH;
  }
  if (fromUnannotatedPackage(methodSymbol) || Nullness.hasNullableAnnotation(methodSymbol)) {
    return Description.NO_MATCH;
  }
  if (mayBeNullExpr(state,retExpr)) {
    String message="String_Node_Str";
    return createErrorDescriptionForNullAssignment(MessageTypes.RETURN_NULLABLE,tree,message,retExpr,state.getPath());
  }
  return Description.NO_MATCH;
}

Fixed version (ground truth):
private Description checkReturnExpression(Tree tree,ExpressionTree retExpr,Symbol.MethodSymbol methodSymbol,VisitorState state){
  Type returnType=methodSymbol.getReturnType();
  if (returnType.isPrimitive()) {
    return doUnboxingCheck(state,retExpr);
  }
  if (returnType.toString().equals("String_Node_Str")) {
    return Description.NO_MATCH;
  }
  if (NullabilityUtil.fromUnannotatedPackage(methodSymbol,config) || Nullness.hasNullableAnnotation(methodSymbol)) {
    return Description.NO_MATCH;
  }
  if (mayBeNullExpr(state,retExpr)) {
    String message="String_Node_Str";
    return createErrorDescriptionForNullAssignment(MessageTypes.RETURN_NULLABLE,tree,message,retExpr,state.getPath());
  }
  return Description.NO_MATCH;
}
Program: 34338
Project: 34338
Buggy source:
@Override public Description matchMethod(MethodTree tree,VisitorState state){
  if (!matchWithinClass) {
    return Description.NO_MATCH;
  }
  Symbol.MethodSymbol methodSymbol=ASTHelpers.getSymbol(tree);
  if (initializerErrors.containsKey(methodSymbol)) {
    return reportInitializerError(methodSymbol,tree);
  }
  handler.onMatchMethod(this,tree,state,methodSymbol);
  boolean isOverriding=ASTHelpers.hasAnnotation(methodSymbol,Override.class,state);
  boolean exhaustiveOverride=config.exhaustiveOverride();
  if (isOverriding || !exhaustiveOverride) {
    Symbol.MethodSymbol closestOverriddenMethod=getClosestOverriddenMethod(methodSymbol,state.getTypes());
    if (closestOverriddenMethod == null) {
      return Description.NO_MATCH;
    }
    if (fromUnannotatedPackage(closestOverriddenMethod)) {
      return Description.NO_MATCH;
    }
    if (!Nullness.hasNullableAnnotation(closestOverriddenMethod)) {
      if (Nullness.hasNullableAnnotation(methodSymbol)) {
        String message="String_Node_Str" + ASTHelpers.enclosingClass(closestOverriddenMethod) + "String_Node_Str"+ closestOverriddenMethod.toString()+ "String_Node_Str";
        return createErrorDescription(MessageTypes.WRONG_OVERRIDE_RETURN,tree,message,tree);
      }
    }
    return checkParamOverriding(tree,tree.getParameters(),closestOverriddenMethod,false);
  }
  return Description.NO_MATCH;
}

Fixed version (ground truth):
@Override public Description matchMethod(MethodTree tree,VisitorState state){
  if (!matchWithinClass) {
    return Description.NO_MATCH;
  }
  Symbol.MethodSymbol methodSymbol=ASTHelpers.getSymbol(tree);
  if (initializerErrors.containsKey(methodSymbol)) {
    return reportInitializerError(methodSymbol,tree);
  }
  handler.onMatchMethod(this,tree,state,methodSymbol);
  boolean isOverriding=ASTHelpers.hasAnnotation(methodSymbol,Override.class,state);
  boolean exhaustiveOverride=config.exhaustiveOverride();
  if (isOverriding || !exhaustiveOverride) {
    Symbol.MethodSymbol closestOverriddenMethod=getClosestOverriddenMethod(methodSymbol,state.getTypes());
    if (closestOverriddenMethod == null) {
      return Description.NO_MATCH;
    }
    if (NullabilityUtil.fromUnannotatedPackage(closestOverriddenMethod,config)) {
      return Description.NO_MATCH;
    }
    if (!Nullness.hasNullableAnnotation(closestOverriddenMethod)) {
      if (Nullness.hasNullableAnnotation(methodSymbol)) {
        String message="String_Node_Str" + ASTHelpers.enclosingClass(closestOverriddenMethod) + "String_Node_Str"+ closestOverriddenMethod.toString()+ "String_Node_Str";
        return createErrorDescription(MessageTypes.WRONG_OVERRIDE_RETURN,tree,message,tree);
      }
    }
    return checkParamOverriding(tree,tree.getParameters(),closestOverriddenMethod,false);
  }
  return Description.NO_MATCH;
}
Program: 34339
Project: 34339
Buggy source:
@Override public TransferResult<Nullness,NullnessStore<Nullness>> visitFieldAccess(FieldAccessNode fieldAccessNode,TransferInput<Nullness,NullnessStore<Nullness>> input){
  ReadableUpdates updates=new ReadableUpdates();
  setReceiverNonnull(updates,fieldAccessNode.getReceiver(),ASTHelpers.getSymbol(fieldAccessNode.getTree()));
  VariableElement element=fieldAccessNode.getElement();
  Nullness nullness=Nullness.NULLABLE;
  if (!Nullness.hasNullableAnnotation(element)) {
    nullness=NONNULL;
  }
 else {
    nullness=input.getRegularStore().valueOfField(fieldAccessNode,nullness);
  }
  return updateRegularStore(nullness,input,updates);
}

Fixed version (ground truth):
@Override public TransferResult<Nullness,NullnessStore<Nullness>> visitFieldAccess(FieldAccessNode fieldAccessNode,TransferInput<Nullness,NullnessStore<Nullness>> input){
  ReadableUpdates updates=new ReadableUpdates();
  Symbol symbol=ASTHelpers.getSymbol(fieldAccessNode.getTree());
  setReceiverNonnull(updates,fieldAccessNode.getReceiver(),symbol);
  VariableElement element=fieldAccessNode.getElement();
  Nullness nullness=Nullness.NULLABLE;
  if (!NullabilityUtil.mayBeNullFieldFromType(symbol,config)) {
    nullness=NONNULL;
  }
 else {
    nullness=input.getRegularStore().valueOfField(fieldAccessNode,nullness);
  }
  return updateRegularStore(nullness,input,updates);
}
Program: 34340
Project: 34340
Buggy source:
void foo(){
  UnannotatedClass e=new UnannotatedClass();
  e.maybeNull.hashCode();
}

Fixed version (ground truth):
void foo(){
  UnannotatedClass e=new UnannotatedClass();
  e.maybeNull.hashCode();
  UnannotatedClass f=new UnannotatedClass();
  Object y=f.maybeNull;
  y.hashCode();
}
Program: 34341
Project: 34341
Buggy source:
/** 
 * 初始化的时候，layout子View
 */
private void layoutItemsOnScroll(RecyclerView.Recycler recycler,RecyclerView.State state,int dy){
  int childCount=getChildCount();
  if (state.isPreLayout() || childCount == 0) {
    return;
  }
  int itemCount=getItemCount();
  Rect displayRect=new Rect(0,scroll,getWidth(),getHeight() + scroll);
  for (int i=0; i < childCount; i++) {
    View child=getChildAt(i);
    if (child == null) {
      continue;
    }
    int position=getPosition(child);
    if (!Rect.intersects(displayRect,locationRects.get(position))) {
      removeAndRecycleView(child,recycler);
      attachedItems.put(position,false);
    }
 else {
      layoutItem(child,locationRects.get(position));
    }
  }
  for (int i=0; i < itemCount; i++) {
    if (Rect.intersects(displayRect,locationRects.get(i)) && !attachedItems.get(i)) {
      View scrap=recycler.getViewForPosition(i);
      measureChildWithMargins(scrap,0,0);
      scrap.setPivotY(0);
      scrap.setPivotX(scrap.getMeasuredWidth() / 2);
      if (dy > 0) {
        addView(scrap);
      }
 else {
        addView(scrap,0);
      }
      layoutItem(scrap,locationRects.get(i));
      attachedItems.put(i,true);
    }
  }
}

Fixed version (ground truth):
/** 
 * 初始化的时候，layout子View
 */
private void layoutItemsOnScroll(){
  int childCount=getChildCount();
  int itemCount=getItemCount();
  Rect displayRect=new Rect(0,scroll,getWidth(),getHeight() + scroll);
  int firstVisiblePosition=-1;
  int lastVisiblePosition=-1;
  for (int i=childCount - 1; i >= 0; i--) {
    View child=getChildAt(i);
    if (child == null) {
      continue;
    }
    int position=getPosition(child);
    if (!Rect.intersects(displayRect,locationRects.get(position))) {
      removeAndRecycleView(child,recycler);
      attachedItems.put(position,false);
    }
 else {
      if (lastVisiblePosition < 0) {
        lastVisiblePosition=position;
      }
      if (firstVisiblePosition < 0) {
        firstVisiblePosition=position;
      }
 else {
        firstVisiblePosition=Math.min(firstVisiblePosition,position);
      }
      layoutItem(child,locationRects.get(position));
    }
  }
  if (firstVisiblePosition > 0) {
    for (int i=firstVisiblePosition - 1; i >= 0; i--) {
      if (Rect.intersects(displayRect,locationRects.get(i)) && !attachedItems.get(i)) {
        reuseItemOnSroll(i,true);
      }
 else {
        break;
      }
    }
  }
  for (int i=lastVisiblePosition + 1; i < itemCount; i++) {
    if (Rect.intersects(displayRect,locationRects.get(i)) && !attachedItems.get(i)) {
      reuseItemOnSroll(i,false);
    }
 else {
      break;
    }
  }
}
Program: 34342
Project: 34342
Buggy source:
private void layoutItem(View child,Rect rect){
  int topDistance=scroll - rect.top;
  int layoutTop, layoutBottom;
  if (topDistance < mDecoratedMeasuredHeight && topDistance >= 0) {
    float rate1=(float)topDistance / mDecoratedMeasuredHeight;
    float rate2=1 - rate1 * rate1 / 3;
    float rate3=1 - rate1 * rate1;
    child.setScaleX(rate2);
    child.setScaleY(rate2);
    child.setAlpha(rate3);
    layoutTop=0;
    layoutBottom=mDecoratedMeasuredHeight;
  }
 else {
    child.setScaleX(1);
    child.setScaleY(1);
    child.setAlpha(1);
    layoutTop=rect.top - scroll;
    layoutBottom=rect.bottom - scroll;
  }
  layoutDecorated(child,rect.left,layoutTop,rect.right,layoutBottom);
}

Fixed version (ground truth):
private void layoutItem(View child,Rect rect){
  int topDistance=scroll - rect.top;
  int layoutTop, layoutBottom;
  int itemHeight=rect.bottom - rect.top;
  if (topDistance < itemHeight && topDistance >= 0) {
    float rate1=(float)topDistance / itemHeight;
    float rate2=1 - rate1 * rate1 / 3;
    float rate3=1 - rate1 * rate1;
    child.setScaleX(rate2);
    child.setScaleY(rate2);
    child.setAlpha(rate3);
    layoutTop=0;
    layoutBottom=itemHeight;
  }
 else {
    child.setScaleX(1);
    child.setScaleY(1);
    child.setAlpha(1);
    layoutTop=rect.top - scroll;
    layoutBottom=rect.bottom - scroll;
  }
  layoutDecorated(child,rect.left,layoutTop,rect.right,layoutBottom);
}
Program: 34343
Project: 34343
Buggy source:
/** 
 * 计算可滑动的最大值
 */
private void computeMaxScroll(){
  maxScroll=locationRects.get(locationRects.size() - 1).bottom - getHeight();
  if (maxScroll < 0) {
    maxScroll=0;
    return;
  }
  int childCount=getChildCount();
  int screenFilledHeight=0;
  for (int i=childCount - 1; i >= 0; i--) {
    Rect rect=locationRects.get(i);
    screenFilledHeight=screenFilledHeight + (rect.bottom - rect.top);
    if (screenFilledHeight > getHeight()) {
      int extraSnapHeight=getHeight() - (screenFilledHeight - (rect.bottom - rect.top));
      maxScroll=maxScroll + extraSnapHeight;
      break;
    }
  }
}

Fixed version (ground truth):
/** 
 * 计算可滑动的最大值
 */
private void computeMaxScroll(){
  maxScroll=locationRects.get(locationRects.size() - 1).bottom - getHeight();
  if (maxScroll < 0) {
    maxScroll=0;
    return;
  }
  int itemCount=getItemCount();
  int screenFilledHeight=0;
  for (int i=itemCount - 1; i >= 0; i--) {
    Rect rect=locationRects.get(i);
    screenFilledHeight=screenFilledHeight + (rect.bottom - rect.top);
    if (screenFilledHeight > getHeight()) {
      int extraSnapHeight=getHeight() - (screenFilledHeight - (rect.bottom - rect.top));
      maxScroll=maxScroll + extraSnapHeight;
      break;
    }
  }
}
Program: 34344
Project: 34344
Buggy source:
@Override public int scrollVerticallyBy(int dy,RecyclerView.Recycler recycler,RecyclerView.State state){
  if (getItemCount() == 0 || dy == 0) {
    return 0;
  }
  int travel=dy;
  if (dy + scroll < 0) {
    travel=-scroll;
  }
 else   if (dy + scroll > maxScroll) {
    travel=maxScroll - scroll;
  }
  scroll+=travel;
  lastDy=dy;
  layoutItemsOnScroll(recycler,state,dy);
  return travel;
}

Fixed version (ground truth):
@Override public int scrollVerticallyBy(int dy,RecyclerView.Recycler recycler,RecyclerView.State state){
  if (getItemCount() == 0 || dy == 0) {
    return 0;
  }
  int travel=dy;
  if (dy + scroll < 0) {
    travel=-scroll;
  }
 else   if (dy + scroll > maxScroll) {
    travel=maxScroll - scroll;
  }
  scroll+=travel;
  lastDy=dy;
  if (!state.isPreLayout() && getChildCount() > 0) {
    layoutItemsOnScroll();
  }
  return travel;
}
Program: 34345
Project: 34345
Buggy source:
@Override public void onLayoutChildren(RecyclerView.Recycler recycler,RecyclerView.State state){
  if (!firstLayoutChildren) {
    return;
  }
  firstLayoutChildren=false;
  int itemCount=getItemCount();
  if (itemCount <= 0 || state.isPreLayout()) {
    return;
  }
  if (getChildCount() == 0) {
    View itemView=recycler.getViewForPosition(0);
    addView(itemView);
    measureChildWithMargins(itemView,0,0);
    mDecoratedMeasuredWidth=getDecoratedMeasuredWidth(itemView);
    mDecoratedMeasuredHeight=getDecoratedMeasuredHeight(itemView);
  }
  int tempPosition=getPaddingTop();
  for (int i=0; i < itemCount; i++) {
    Rect rect=new Rect();
    rect.left=getPaddingLeft();
    rect.top=tempPosition;
    rect.right=mDecoratedMeasuredWidth - getPaddingRight();
    rect.bottom=rect.top + mDecoratedMeasuredHeight;
    locationRects.put(i,rect);
    attachedItems.put(i,false);
    tempPosition=tempPosition + mDecoratedMeasuredHeight;
  }
  detachAndScrapAttachedViews(recycler);
  layoutItemsOnCreate(recycler);
  computeMaxScroll();
}

Fixed version (ground truth):
@Override public void onLayoutChildren(RecyclerView.Recycler recycler,RecyclerView.State state){
  this.recycler=recycler;
  if (!firstLayoutChildren || adapter == null || getItemCount() <= 0 || state.isPreLayout()) {
    return;
  }
  firstLayoutChildren=false;
  buildLocationRects();
  detachAndScrapAttachedViews(recycler);
  layoutItemsOnCreate(recycler);
}
Program: 34346
Project: 34346
Buggy source:
/** 
 * 初始化的时候，layout子View
 */
private void layoutItemsOnCreate(RecyclerView.Recycler recycler){
  int itemCount=getItemCount();
  for (int i=0; i < itemCount; i++) {
    View childView=recycler.getViewForPosition(i);
    addView(childView);
    measureChildWithMargins(childView,0,0);
    layoutItem(childView,locationRects.get(i));
    attachedItems.put(i,true);
    childView.setPivotY(0);
    childView.setPivotX(childView.getMeasuredWidth() / 2);
    if (locationRects.get(i).top > getHeight()) {
      break;
    }
  }
}

Fixed version (ground truth):
/** 
 * 初始化的时候，layout子View
 */
private void layoutItemsOnCreate(RecyclerView.Recycler recycler){
  int itemCount=getItemCount();
  for (int i=0; i < itemCount; i++) {
    View childView=recycler.getViewForPosition(i);
    addView(childView);
    measureChildWithMargins(childView,View.MeasureSpec.UNSPECIFIED,View.MeasureSpec.UNSPECIFIED);
    layoutItem(childView,locationRects.get(i));
    attachedItems.put(i,true);
    childView.setPivotY(0);
    childView.setPivotX(childView.getMeasuredWidth() / 2);
    if (locationRects.get(i).top > getHeight()) {
      break;
    }
  }
}
Program: 34347
Project: 34347
Buggy source:
/** 
 * notifyDataSetChanged时会调用此方法
 */
@Override public void onItemsChanged(RecyclerView recyclerView){
  super.onItemsChanged(recyclerView);
  buildLocationRects();
  layoutItemsOnScroll();
}

Fixed version (ground truth):
/** 
 * notifyDataSetChanged时会调用此方法
 */
@Override public void onItemsChanged(RecyclerView recyclerView){
  super.onItemsChanged(recyclerView);
  if (null != recycler) {
    buildLocationRects();
    layoutItemsOnScroll();
  }
}
Program: 34348
Project: 34348
Buggy source:
private void buildLocationRects(){
  viewTypeHeightMap.clear();
  locationRects.clear();
  attachedItems.clear();
  int tempPosition=getPaddingTop();
  int itemCount=getItemCount();
  for (int i=0; i < itemCount; i++) {
    int viewType=adapter.getItemViewType(i);
    int itemHeight;
    if (viewTypeHeightMap.containsKey(viewType)) {
      itemHeight=viewTypeHeightMap.get(viewType);
    }
 else {
      View itemView=recycler.getViewForPosition(i);
      addView(itemView);
      measureChildWithMargins(itemView,View.MeasureSpec.UNSPECIFIED,View.MeasureSpec.UNSPECIFIED);
      itemHeight=getDecoratedMeasuredHeight(itemView);
      viewTypeHeightMap.put(viewType,itemHeight);
    }
    Rect rect=new Rect();
    rect.left=getPaddingLeft();
    rect.top=tempPosition;
    rect.right=getWidth() - getPaddingRight();
    rect.bottom=rect.top + itemHeight;
    locationRects.put(i,rect);
    attachedItems.put(i,false);
    tempPosition=tempPosition + itemHeight;
  }
  computeMaxScroll();
}

Fixed version (ground truth):
private void buildLocationRects(){
  viewTypeHeightMap.clear();
  locationRects.clear();
  attachedItems.clear();
  int tempPosition=getPaddingTop();
  int itemCount=getItemCount();
  for (int i=0; i < itemCount; i++) {
    int viewType=adapter.getItemViewType(i);
    int itemHeight;
    if (viewTypeHeightMap.containsKey(viewType)) {
      itemHeight=viewTypeHeightMap.get(viewType);
    }
 else {
      View itemView=recycler.getViewForPosition(i);
      addView(itemView);
      measureChildWithMargins(itemView,View.MeasureSpec.UNSPECIFIED,View.MeasureSpec.UNSPECIFIED);
      itemHeight=getDecoratedMeasuredHeight(itemView);
      viewTypeHeightMap.put(viewType,itemHeight);
    }
    Rect rect=new Rect();
    rect.left=getPaddingLeft();
    rect.top=tempPosition;
    rect.right=getWidth() - getPaddingRight();
    rect.bottom=rect.top + itemHeight;
    locationRects.put(i,rect);
    attachedItems.put(i,false);
    tempPosition=tempPosition + itemHeight;
  }
  if (itemCount == 0) {
    maxScroll=0;
  }
 else {
    computeMaxScroll();
  }
}
Program: 34349
Project: 34349
Buggy source:
@Override public void onLayoutChildren(RecyclerView.Recycler recycler,RecyclerView.State state){
  this.recycler=recycler;
  if (!firstLayoutChildren || adapter == null || getItemCount() <= 0 || state.isPreLayout()) {
    return;
  }
  firstLayoutChildren=false;
  buildLocationRects();
  detachAndScrapAttachedViews(recycler);
  layoutItemsOnCreate(recycler);
}

Fixed version (ground truth):
@Override public void onLayoutChildren(RecyclerView.Recycler recycler,RecyclerView.State state){
  this.recycler=recycler;
  if (state.isPreLayout()) {
    return;
  }
  buildLocationRects();
  detachAndScrapAttachedViews(recycler);
  layoutItemsOnCreate(recycler);
}
Program: 34350
Project: 34350
Buggy source:
/** 
 * Returns all selected days
 * @return
 */
public List<Day> getSelectedDays(){
  List<Day> selectedDays=new ArrayList<>();
  for (Iterator<Month> monthIterator=monthAdapter.getData().iterator(); monthIterator.hasNext(); ) {
    Month month=monthIterator.next();
    for (Iterator<Day> dayIterator=month.getDaysWithoutTitlesAndOnlyCurrent().iterator(); dayIterator.hasNext(); ) {
      Day day=dayIterator.next();
      selectedDays.add(day);
    }
  }
  return selectedDays;
}

Fixed version (ground truth):
/** 
 * Returns all selected days
 * @return
 */
public List<Day> getSelectedDays(){
  List<Day> selectedDays=new ArrayList<>();
  for (Iterator<Month> monthIterator=monthAdapter.getData().iterator(); monthIterator.hasNext(); ) {
    Month month=monthIterator.next();
    for (Iterator<Day> dayIterator=month.getDaysWithoutTitlesAndOnlyCurrent().iterator(); dayIterator.hasNext(); ) {
      Day day=dayIterator.next();
      if (selectionManager.isDaySelected(day)) {
        selectedDays.add(day);
      }
    }
  }
  return selectedDays;
}
Program: 34351
Project: 34351
Buggy source:
@Override protected void onDestroy(){
  super.onDestroy();
  mViewModel.detachView();
}

Fixed version (ground truth):
@Override protected void onDestroy(){
  super.onDestroy();
  if (mViewModel != null) {
    mViewModel.detachView();
  }
}
Program: 34352
Project: 34352
Buggy source:
/** 
 * 退出登录相关操作
 */
private void logout(){
  PreferencesUtils.clear(getContext());
  JMessageClient.logout();
  JPushInterface.setAlias(getContext(),2,"String_Node_Str");
  getView().finish();
}

Fixed version (ground truth):
/** 
 * 退出登录相关操作
 */
private void logout(){
  PreferencesUtils.clear(getContext());
  JMessageClient.logout();
  JPushInterface.setAlias(getContext(),2,"String_Node_Str");
  Intent intent=new Intent();
  intent.setClassName(getContext(),"String_Node_Str");
  getContext().startActivity(intent);
}
Program: 34353
Project: 34353
Buggy source:
@Override public void onPause(){
  super.onPause();
  MobclickAgent.onPageEnd(getClass().getSimpleName());
}

Fixed version (ground truth):
@Override public void onPause(){
  super.onPause();
}
Program: 34354
Project: 34354
Buggy source:
@Override public void onResume(){
  super.onResume();
  MobclickAgent.onPageStart(getClass().getSimpleName());
}

Fixed version (ground truth):
@Override public void onResume(){
  super.onResume();
  MobclickAgent.onEvent(getActivity(),getClass().getSimpleName());
}
Program: 34355
Project: 34355
Buggy source:
/** 
 * 接收消息事件 目前只支持文字消息，后面再进行优化
 * @param event 消息事件
 */
public void onEventMainThread(MessageEvent event){
  getViewModel().updateOfficeData();
}

Fixed version (ground truth):
/** 
 * 接收消息事件 目前只支持文字消息，后面再进行优化
 * @param event 消息事件
 */
public void onEventMainThread(MessageEvent event){
  getViewModel().updateOfficeData(((TextContent)event.getMessage().getContent()).getText());
}
Program: 34356
Project: 34356
Buggy source:
public void updateOfficeData(){
  setServiceRedVisible(View.VISIBLE);
  setOfficeNum(++officeNum);
}

Fixed version (ground truth):
public void updateOfficeData(String content){
  setServiceRedVisible(View.VISIBLE);
  setOfficeNum(++officeNum);
  setServiceContent(content);
}
Program: 34357
Project: 34357
Buggy source:
/** 
 * 官方服务点击事件处理
 * @param view
 */
public void onServiceClick(View view){
  setOfficeNum(0);
  setServiceRedVisible(View.GONE);
  PublicActivity.startActivity((Activity)getContext(),"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * 官方服务点击事件处理
 * @param view
 */
public void onServiceClick(View view){
  setOfficeNum(0);
  setServiceRedVisible(View.GONE);
  setServiceContent("String_Node_Str");
  if (JMessageClient.getMyInfo() == null) {
    PublicActivity.startActivity((Activity)getContext(),"String_Node_Str");
  }
 else {
    PublicActivity.startActivity((Activity)getContext(),"String_Node_Str");
  }
}
Program: 34358
Project: 34358
Buggy source:
@Override public void onClick(View view){
  getActivity().finish();
}

Fixed version (ground truth):
@Override public void onClick(DialogInterface dialog,int which){
  getViewModel().deleteAllMessage();
}
Program: 34359
Project: 34359
Buggy source:
/** 
 * 给官方客服发送文本消息
 */
public void sendMessageToOffice(View view){
  if (TextUtils.isEmpty(sendContent)) {
    Toast.makeText(getContext(),"String_Node_Str",Toast.LENGTH_SHORT).show();
    return;
  }
  LogUtils.i("String_Node_Str","String_Node_Str" + sendContent);
  Message message=mConversation.createSendTextMessage(sendContent);
  message.setOnSendCompleteCallback(new BasicCallback(){
    @Override public void gotResult(    int status,    String desc){
      if (status == 0) {
        MessageItemViewModel send=new MessageItemViewModel();
        send.type=MessageItemViewModel.MSG_SEND;
        send.content=sendContent;
        items.add(send);
        setSendContent("String_Node_Str");
        getView().scrollToPosition(items.size() - 1);
      }
 else {
        Toast.makeText(getContext(),desc,Toast.LENGTH_SHORT).show();
      }
    }
  }
);
  JMessageClient.sendMessage(message);
}

Fixed version (ground truth):
/** 
 * 给官方客服发送文本消息
 */
public void sendMessageToOffice(View view){
  if (TextUtils.isEmpty(sendContent)) {
    Toast.makeText(getContext(),"String_Node_Str",Toast.LENGTH_SHORT).show();
    return;
  }
  LogUtils.i("String_Node_Str","String_Node_Str" + sendContent);
  Message message=mConversation.createSendTextMessage(sendContent);
  message.setOnSendCompleteCallback(new BasicCallback(){
    @Override public void gotResult(    int status,    String desc){
      if (status == 0) {
        MessageItemViewModel send=new MessageItemViewModel();
        send.type=MessageItemViewModel.MSG_SEND;
        send.content=sendContent;
        items.add(send);
        ++curCount;
        setSendContent("String_Node_Str");
        getView().scrollToPosition(items.size() - 1);
      }
 else {
        Toast.makeText(getContext(),desc,Toast.LENGTH_SHORT).show();
      }
    }
  }
);
  JMessageClient.sendMessage(message);
}
Program: 34360
Project: 34360
Buggy source:
@Override public void gotResult(int status,String desc){
  if (status == 0) {
    MessageItemViewModel send=new MessageItemViewModel();
    send.type=MessageItemViewModel.MSG_SEND;
    send.content=sendContent;
    items.add(send);
    setSendContent("String_Node_Str");
    getView().scrollToPosition(items.size() - 1);
  }
 else {
    Toast.makeText(getContext(),desc,Toast.LENGTH_SHORT).show();
  }
}

Fixed version (ground truth):
@Override public void gotResult(int status,String desc){
  if (status == 0) {
    MessageItemViewModel send=new MessageItemViewModel();
    send.type=MessageItemViewModel.MSG_SEND;
    send.content=sendContent;
    items.add(send);
    ++curCount;
    setSendContent("String_Node_Str");
    getView().scrollToPosition(items.size() - 1);
  }
 else {
    Toast.makeText(getContext(),desc,Toast.LENGTH_SHORT).show();
  }
}
Program: 34361
Project: 34361
Buggy source:
@Override public int getBR(){
  return BR.messageModel;
}

Fixed version (ground truth):
@Override public int getBR(){
  return com.weapon.joker.app.message.BR.messageModel;
}
Program: 34362
Project: 34362
Buggy source:
/** 
 * 登陆
 */
private void login(){
  String userName=mTilUserName.getEditText().getText().toString().trim();
  String password=mTilPassword.getEditText().getText().toString().trim();
  if (TextUtils.isEmpty(userName)) {
    mTilUserName.setError("String_Node_Str");
    return;
  }
  if (TextUtils.isEmpty(password)) {
    mTilPassword.setError("String_Node_Str");
    return;
  }
  mTilPassword.setErrorEnabled(false);
  mTilUserName.setErrorEnabled(false);
  Api.getDefault(HostType.MINE).login(userName,password).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new BaseObserver<LoginModel>(){
    @Override protected void onSuccess(    LoginModel entry) throws Exception {
      if (entry.status == 1000 && entry != null && entry.data != null) {
        Toast.makeText(LoginActivity.this,"String_Node_Str",Toast.LENGTH_SHORT).show();
        LogUtils.logi("String_Node_Str" + entry.data.toString());
      }
 else {
        Toast.makeText(LoginActivity.this,"String_Node_Str" + entry.desc,Toast.LENGTH_SHORT).show();
        LogUtils.logi("String_Node_Str" + entry.desc);
      }
    }
    @Override protected void onFailure(    Throwable e,    boolean isNetWorkError) throws Exception {
      Toast.makeText(LoginActivity.this,"String_Node_Str" + e.getMessage(),Toast.LENGTH_SHORT).show();
      LogUtils.logi("String_Node_Str" + e.getMessage());
    }
  }
);
}

Fixed version (ground truth):
/** 
 * 登陆
 */
private void login(){
  String userName=mTilUserName.getEditText().getText().toString().trim();
  String password=mTilPassword.getEditText().getText().toString().trim();
  mTilPassword.setErrorEnabled(false);
  mTilUserName.setErrorEnabled(false);
  if (TextUtils.isEmpty(userName)) {
    mTilUserName.setError("String_Node_Str");
    return;
  }
  if (TextUtils.isEmpty(password)) {
    mTilPassword.setError("String_Node_Str");
    return;
  }
  Api.getDefault(HostType.MINE).login(userName,password).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new BaseObserver<LoginModel>(){
    @Override protected void onSuccess(    LoginModel entry) throws Exception {
      if (entry.status == 1000 && entry != null && entry.data != null) {
        Toast.makeText(LoginActivity.this,"String_Node_Str",Toast.LENGTH_SHORT).show();
        LogUtils.logi("String_Node_Str" + entry.data.toString());
      }
 else {
        Toast.makeText(LoginActivity.this,"String_Node_Str" + entry.desc,Toast.LENGTH_SHORT).show();
        LogUtils.logi("String_Node_Str" + entry.desc);
      }
    }
    @Override protected void onFailure(    Throwable e,    boolean isNetWorkError) throws Exception {
      Toast.makeText(LoginActivity.this,"String_Node_Str" + e.getMessage(),Toast.LENGTH_SHORT).show();
      LogUtils.logi("String_Node_Str" + e.getMessage());
    }
  }
);
}
Program: 34363
Project: 34363
Buggy source:
/** 
 * 登陆
 */
private void login(){
  String userName=mTilUserName.getEditText().getText().toString().trim();
  String password=mTilPassword.getEditText().getText().toString().trim();
  if (TextUtils.isEmpty(userName)) {
    mTilUserName.getEditText().setError("String_Node_Str");
    return;
  }
  if (TextUtils.isEmpty(password)) {
    mTilPassword.getEditText().setError("String_Node_Str");
    return;
  }
  Api.getDefault(HostType.MINE).login(userName,password).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new BaseObserver<LoginModel>(){
    @Override protected void onSuccess(    LoginModel entry) throws Exception {
      if (entry.status == 1000 && entry != null && entry.data != null) {
        Toast.makeText(LoginActivity.this,"String_Node_Str",Toast.LENGTH_SHORT).show();
        LogUtils.logi("String_Node_Str" + entry.data.toString());
      }
 else {
        Toast.makeText(LoginActivity.this,"String_Node_Str" + entry.desc,Toast.LENGTH_SHORT).show();
        LogUtils.logi("String_Node_Str" + entry.desc);
      }
    }
    @Override protected void onFailure(    Throwable e,    boolean isNetWorkError) throws Exception {
      Toast.makeText(LoginActivity.this,"String_Node_Str" + e.getMessage(),Toast.LENGTH_SHORT).show();
      LogUtils.logi("String_Node_Str" + e.getMessage());
    }
  }
);
}

Fixed version (ground truth):
/** 
 * 登陆
 */
private void login(){
  String userName=mTilUserName.getEditText().getText().toString().trim();
  String password=mTilPassword.getEditText().getText().toString().trim();
  if (TextUtils.isEmpty(userName)) {
    mTilUserName.setError("String_Node_Str");
    return;
  }
  if (TextUtils.isEmpty(password)) {
    mTilPassword.setError("String_Node_Str");
    return;
  }
  mTilPassword.setErrorEnabled(false);
  mTilUserName.setErrorEnabled(false);
  Api.getDefault(HostType.MINE).login(userName,password).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new BaseObserver<LoginModel>(){
    @Override protected void onSuccess(    LoginModel entry) throws Exception {
      if (entry.status == 1000 && entry != null && entry.data != null) {
        Toast.makeText(LoginActivity.this,"String_Node_Str",Toast.LENGTH_SHORT).show();
        LogUtils.logi("String_Node_Str" + entry.data.toString());
      }
 else {
        Toast.makeText(LoginActivity.this,"String_Node_Str" + entry.desc,Toast.LENGTH_SHORT).show();
        LogUtils.logi("String_Node_Str" + entry.desc);
      }
    }
    @Override protected void onFailure(    Throwable e,    boolean isNetWorkError) throws Exception {
      Toast.makeText(LoginActivity.this,"String_Node_Str" + e.getMessage(),Toast.LENGTH_SHORT).show();
      LogUtils.logi("String_Node_Str" + e.getMessage());
    }
  }
);
}
Program: 34364
Project: 34364
Buggy source:
/** 
 * {@link MineFragment 我的 Fragment}
 */
void fragment();

Fixed version (ground truth):
/** 
 * {@link MainFragment 我的 Fragment}
 */
void fragment();
Program: 34365
Project: 34365
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_mine);
  getSupportFragmentManager().beginTransaction().replace(R.id.fl_mine_content,new MineFragment()).commit();
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_mine);
  getSupportFragmentManager().beginTransaction().replace(R.id.fl_mine_content,new MainFragment()).commit();
}
Program: 34366
Project: 34366
Buggy source:
private View initFragment(LayoutInflater inflater,ViewGroup container){
  if (mViewDataBinding == null) {
    mContext=getActivity();
    mViewDataBinding=DataBindingUtil.inflate(inflater,getLayoutId(),container,false);
    mViewModel=TUtil.getT(this,0);
    M model=TUtil.getT(this,1);
    if (mViewModel != null) {
      mViewModel.setContext(mContext);
      try {
        Method setModel=mViewModel.getClass().getDeclaredMethod("String_Node_Str",model.getClass().getSuperclass());
        Method attachView=mViewModel.getClass().getDeclaredMethod("String_Node_Str",this.getClass().getInterfaces());
        setModel.invoke(mViewModel,model);
        attachView.invoke(mViewModel,this);
      }
 catch (      Exception e) {
      }
    }
    if (model != null) {
      model.attachViewModel(mViewModel);
    }
    mViewDataBinding.setVariable(getBR(),mViewModel);
    initView();
  }
 else {
    if (mViewDataBinding.getRoot().getParent() != null) {
      ((ViewGroup)mViewDataBinding.getRoot().getParent()).removeView(mViewDataBinding.getRoot());
    }
  }
  return mViewDataBinding.getRoot();
}

Fixed version (ground truth):
private View initFragment(LayoutInflater inflater,ViewGroup container){
  if (mViewDataBinding == null) {
    mContext=getActivity();
    mViewDataBinding=DataBindingUtil.inflate(inflater,getLayoutId(),container,false);
    mViewModel=TUtil.getT(this,0);
    M model=TUtil.getT(this,1);
    if (mViewModel != null) {
      mViewModel.setContext(mContext);
      mViewModel.setModel(model);
      mViewModel.attachView(this);
    }
    if (model != null) {
      model.attachViewModel(mViewModel);
    }
    mViewDataBinding.setVariable(getBR(),mViewModel);
    initView();
  }
 else {
    if (mViewDataBinding.getRoot().getParent() != null) {
      ((ViewGroup)mViewDataBinding.getRoot().getParent()).removeView(mViewDataBinding.getRoot());
    }
  }
  return mViewDataBinding.getRoot();
}
Program: 34367
Project: 34367
Buggy source:
private View initFragment(LayoutInflater inflater,ViewGroup container){
  if (mViewDataBinding == null) {
    mContext=getActivity();
    mViewDataBinding=DataBindingUtil.inflate(inflater,getLayoutId(),container,false);
    mViewModel=TUtil.getT(this,0);
    M model=TUtil.getT(this,1);
    if (mViewModel != null) {
      mViewModel.setModel(model);
      mViewModel.setContext(mContext);
      mViewModel.attachView(this);
    }
    if (model != null) {
      model.attachViewModel(mViewModel);
    }
    mViewDataBinding.setVariable(getBR(),mViewModel);
    initView();
  }
 else {
    if (mViewDataBinding.getRoot().getParent() != null) {
      ((ViewGroup)mViewDataBinding.getRoot().getParent()).removeView(mViewDataBinding.getRoot());
    }
  }
  return mViewDataBinding.getRoot();
}

Fixed version (ground truth):
private View initFragment(LayoutInflater inflater,ViewGroup container){
  if (mViewDataBinding == null) {
    mContext=getActivity();
    mViewDataBinding=DataBindingUtil.inflate(inflater,getLayoutId(),container,false);
    mViewModel=TUtil.getT(this,0);
    M model=TUtil.getT(this,1);
    if (mViewModel != null) {
      mViewModel.setContext(mContext);
      try {
        Method setModel=mViewModel.getClass().getDeclaredMethod("String_Node_Str",model.getClass().getSuperclass());
        Method attachView=mViewModel.getClass().getDeclaredMethod("String_Node_Str",this.getClass().getInterfaces());
        setModel.invoke(mViewModel,model);
        attachView.invoke(mViewModel,this);
      }
 catch (      Exception e) {
      }
    }
    if (model != null) {
      model.attachViewModel(mViewModel);
    }
    mViewDataBinding.setVariable(getBR(),mViewModel);
    initView();
  }
 else {
    if (mViewDataBinding.getRoot().getParent() != null) {
      ((ViewGroup)mViewDataBinding.getRoot().getParent()).removeView(mViewDataBinding.getRoot());
    }
  }
  return mViewDataBinding.getRoot();
}
Program: 34372
Project: 34372
Buggy source:
protected int diffUnionType(JCTypeUnion oldT,JCTypeUnion newT,int[] bounds){
  int localPointer=bounds[0];
  return diffParameterList(oldT.alternatives,newT.alternatives,null,localPointer,Measure.MEMBER,diffContext.style.spaceAroundBinaryOps(),diffContext.style.spaceAroundBinaryOps(),false,"String_Node_Str");
}

Fixed version (ground truth):
protected int diffUnionType(JCTypeUnion oldT,JCTypeUnion newT,int[] bounds){
  int localPointer=bounds[0];
  int pos=diffParameterList(oldT.alternatives,newT.alternatives,null,localPointer,Measure.MEMBER,diffContext.style.spaceAroundBinaryOps(),diffContext.style.spaceAroundBinaryOps(),false,"String_Node_Str");
  return Math.min(pos,bounds[1]);
}
Program: 34374
Project: 34374
Buggy source:
public void run(final WorkingCopy workingCopy) throws IOException {
  workingCopy.toPhase(Phase.RESOLVED);
  final TreeMaker make=workingCopy.getTreeMaker();
  new ErrorAwareTreeScanner<Void,Void>(){
    @Override public Void visitUnionType(    UnionTypeTree node,    Void p){
      List<Tree> alternatives=new ArrayList<Tree>(node.getTypeAlternatives());
      alternatives.add(1,make.Identifier("String_Node_Str"));
      workingCopy.rewrite(node,make.UnionType(alternatives));
      return null;
    }
  }
.scan(workingCopy.getCompilationUnit(),null);
}

Fixed version (ground truth):
public void run(final WorkingCopy workingCopy) throws IOException {
  workingCopy.toPhase(Phase.RESOLVED);
  final TreeMaker make=workingCopy.getTreeMaker();
  new ErrorAwareTreeScanner<Void,Void>(){
    @Override public Void visitUnionType(    UnionTypeTree node,    Void p){
      List<Tree> alternatives=new ArrayList<Tree>(node.getTypeAlternatives());
      alternatives.remove(0);
      alternatives.remove(0);
      alternatives.add(0,make.Identifier("String_Node_Str"));
      alternatives.add(1,make.Identifier("String_Node_Str"));
      workingCopy.rewrite(node,make.UnionType(alternatives));
      return null;
    }
  }
.scan(workingCopy.getCompilationUnit(),null);
}
Program: 34375
Project: 34375
Buggy source:
@Override public Void visitUnionType(UnionTypeTree node,Void p){
  List<Tree> alternatives=new ArrayList<Tree>(node.getTypeAlternatives());
  alternatives.add(1,make.Identifier("String_Node_Str"));
  workingCopy.rewrite(node,make.UnionType(alternatives));
  return null;
}

Fixed version (ground truth):
@Override public Void visitUnionType(UnionTypeTree node,Void p){
  List<Tree> alternatives=new ArrayList<Tree>(node.getTypeAlternatives());
  alternatives.remove(0);
  alternatives.remove(0);
  alternatives.add(0,make.Identifier("String_Node_Str"));
  alternatives.add(1,make.Identifier("String_Node_Str"));
  workingCopy.rewrite(node,make.UnionType(alternatives));
  return null;
}
Program: 34377
Project: 34377
Buggy source:
@Override public String visitType(TypeMirror t,Object p){
  return t.toString();
}

Fixed version (ground truth):
@Override public String visitType(TypeMirror t,Object p){
  if (t.getKind() == TypeKind.DECLARED) {
    return processingEnv.getElementUtils().getBinaryName((TypeElement)processingEnv.getTypeUtils().asElement(t)).toString();
  }
  return t.toString();
}
Program: 34378
Project: 34378
Buggy source:
public void testPERegistered(){
  NodeOp.registerPropertyEditors();
  PropertyEditor pEditor=PropertyEditorManager.findEditor(Double[].class);
  assertEquals("String_Node_Str",pEditor.getClass().getName());
  pEditor=PropertyEditorManager.findEditor(Integer.class);
  assertEquals("String_Node_Str",pEditor.getClass().getName());
  pEditor=PropertyEditorManager.findEditor(char[][].class);
  assertEquals("String_Node_Str",pEditor.getClass().getName());
  pEditor=PropertyEditorManager.findEditor(short.class);
  assertEquals("String_Node_Str",pEditor.getClass().getName());
}

Fixed version (ground truth):
public void testPERegistered(){
  NodeOp.registerPropertyEditors();
  PropertyEditor pEditor=PropertyEditorManager.findEditor(Double[].class);
  assertEquals("String_Node_Str",pEditor.getClass().getName());
  pEditor=PropertyEditorManager.findEditor(Integer.class);
  assertEquals("String_Node_Str",pEditor.getClass().getName());
  pEditor=PropertyEditorManager.findEditor(char[][].class);
  assertEquals("String_Node_Str",pEditor.getClass().getName());
  pEditor=PropertyEditorManager.findEditor(short.class);
  assertEquals("String_Node_Str",pEditor.getClass().getName());
  pEditor=PropertyEditorManager.findEditor(CustomData.Inner.class);
  assertEquals("String_Node_Str",pEditor.getClass().getName());
}
Program: 34379
Project: 34379
Buggy source:
@Override public void setModified(boolean modif){
  super.setModified(modif);
  if (!modif) {
    GenericEditorSupport ges=getLookup().lookup(GenericEditorSupport.class);
    if (ges != null) {
      ges.removeSaveCookie();
    }
  }
}

Fixed version (ground truth):
@Override public void setModified(boolean modif){
  super.setModified(modif);
  if (!isModified()) {
    GenericEditorSupport ges=getLookup().lookup(GenericEditorSupport.class);
    if (ges != null) {
      ges.removeSaveCookie();
    }
  }
}
Program: 34380
Project: 34380
Buggy source:
@Override public void setModified(boolean modif){
  super.setModified(modif);
  if (!modif) {
    HtmlEditorSupport support=getLookup().lookup(HtmlEditorSupport.class);
    support.removeSaveCookie();
  }
}

Fixed version (ground truth):
@Override public void setModified(boolean modif){
  super.setModified(modif);
  if (!isModified()) {
    HtmlEditorSupport support=getLookup().lookup(HtmlEditorSupport.class);
    support.removeSaveCookie();
  }
}