nus-yam/ex-repair huggingface dataset:
Program: 2830
Project: 2830
Buggy source:
public void run(){
  RenderScript pRS=RenderScript.create(mCtx);
  ScriptC_alloc s=new ScriptC_alloc(pRS);
  pRS.setMessageHandler(mRsMessage);
  initializeGlobals(pRS,s);
  s.invoke_alloc_test();
  pRS.finish();
  waitForMessage();
  pRS.destroy();
}

Fixed version (ground truth):
public void run(){
  RenderScript pRS=RenderScript.create(mCtx);
  ScriptC_alloc s=new ScriptC_alloc(pRS);
  pRS.setMessageHandler(mRsMessage);
  initializeGlobals(pRS,s);
  s.forEach_root(s.get_aRaw());
  s.invoke_alloc_test();
  pRS.finish();
  waitForMessage();
  pRS.destroy();
}
Program: 2831
Project: 2831
Buggy source:
private void initializeGlobals(RenderScript RS,ScriptC_foreach s){
  Type.Builder typeBuilder=new Type.Builder(RS,Element.I32(RS));
  int X=5;
  int Y=7;
  s.set_dimX(X);
  s.set_dimY(Y);
  typeBuilder.setX(X).setY(Y);
  A=Allocation.createTyped(RS,typeBuilder.create());
  s.bind_a(A);
  return;
}

Fixed version (ground truth):
private void initializeGlobals(RenderScript RS,ScriptC_foreach s){
  Type.Builder typeBuilder=new Type.Builder(RS,Element.I32(RS));
  int X=5;
  int Y=7;
  s.set_dimX(X);
  s.set_dimY(Y);
  typeBuilder.setX(X).setY(Y);
  A=Allocation.createTyped(RS,typeBuilder.create());
  s.set_aRaw(A);
  return;
}
Program: 2832
Project: 2832
Buggy source:
private void initializeGlobals(RenderScript RS,ScriptC_foreach_bounds s){
  Type.Builder typeBuilder=new Type.Builder(RS,Element.I32(RS));
  int X=5;
  int Y=7;
  s.set_dimX(X);
  s.set_dimY(Y);
  typeBuilder.setX(X).setY(Y);
  A=Allocation.createTyped(RS,typeBuilder.create());
  s.bind_a(A);
  s.set_s(s);
  s.set_ain(A);
  s.set_aout(A);
  s.set_xStart(2);
  s.set_xEnd(5);
  s.set_yStart(3);
  s.set_yEnd(6);
  s.forEach_zero(A);
  return;
}

Fixed version (ground truth):
private void initializeGlobals(RenderScript RS,ScriptC_foreach_bounds s){
  Type.Builder typeBuilder=new Type.Builder(RS,Element.I32(RS));
  int X=5;
  int Y=7;
  s.set_dimX(X);
  s.set_dimY(Y);
  typeBuilder.setX(X).setY(Y);
  A=Allocation.createTyped(RS,typeBuilder.create());
  s.set_aRaw(A);
  s.set_s(s);
  s.set_ain(A);
  s.set_aout(A);
  s.set_xStart(2);
  s.set_xEnd(5);
  s.set_yStart(3);
  s.set_yEnd(6);
  s.forEach_zero(A);
  return;
}
Program: 2833
Project: 2833
Buggy source:
private void initializeGlobals(RenderScript RS,ScriptC_noroot s){
  Type.Builder typeBuilder=new Type.Builder(RS,Element.I32(RS));
  int X=5;
  int Y=7;
  s.set_dimX(X);
  s.set_dimY(Y);
  typeBuilder.setX(X).setY(Y);
  A=Allocation.createTyped(RS,typeBuilder.create());
  s.bind_a(A);
  return;
}

Fixed version (ground truth):
private void initializeGlobals(RenderScript RS,ScriptC_noroot s){
  Type.Builder typeBuilder=new Type.Builder(RS,Element.I32(RS));
  int X=5;
  int Y=7;
  s.set_dimX(X);
  s.set_dimY(Y);
  typeBuilder.setX(X).setY(Y);
  A=Allocation.createTyped(RS,typeBuilder.create());
  s.set_aRaw(A);
  return;
}
Program: 2834
Project: 2834
Buggy source:
/** 
 * Called to determine the initial header to be shown.  The default implementation simply returns the fragment of the first header.  Note that the returned Header object does not actually need to exist in your header list -- whatever its fragment is will simply be used to show for the initial UI.
 */
public Header onGetInitialHeader(){
  return mHeaders.get(0);
}

Fixed version (ground truth):
/** 
 * Called to determine the initial header to be shown.  The default implementation simply returns the fragment of the first header.  Note that the returned Header object does not actually need to exist in your header list -- whatever its fragment is will simply be used to show for the initial UI.
 */
public Header onGetInitialHeader(){
  for (int i=0; i < mHeaders.size(); i++) {
    Header h=mHeaders.get(i);
    if (h.fragment != null) {
      return h;
    }
  }
  throw new IllegalStateException("String_Node_Str");
}
Program: 2835
Project: 2835
Buggy source:
/** 
 * When in two-pane mode, switch to the fragment pane to show the given preference fragment.
 * @param header The new header to display.
 */
public void switchToHeader(Header header){
  if (mCurHeader == header) {
    getFragmentManager().popBackStack(BACK_STACK_PREFS,FragmentManager.POP_BACK_STACK_INCLUSIVE);
  }
 else {
    int direction=mHeaders.indexOf(header) - mHeaders.indexOf(mCurHeader);
    switchToHeaderInner(header.fragment,header.fragmentArguments,direction);
    setSelectedHeader(header);
  }
}

Fixed version (ground truth):
/** 
 * When in two-pane mode, switch to the fragment pane to show the given preference fragment.
 * @param header The new header to display.
 */
public void switchToHeader(Header header){
  if (mCurHeader == header) {
    getFragmentManager().popBackStack(BACK_STACK_PREFS,FragmentManager.POP_BACK_STACK_INCLUSIVE);
  }
 else {
    if (header.fragment == null) {
      throw new IllegalStateException("String_Node_Str");
    }
    int direction=mHeaders.indexOf(header) - mHeaders.indexOf(mCurHeader);
    switchToHeaderInner(header.fragment,header.fragmentArguments,direction);
    setSelectedHeader(header);
  }
}
Program: 2836
Project: 2836
Buggy source:
/** 
 * Called to determine the initial header to be shown.  The default implementation simply returns the fragment of the first header.  Note that the returned Header object does not actually need to exist in your header list -- whatever its fragment is will simply be used to show for the initial UI.
 */
public Header onGetInitialHeader(){
  return mHeaders.get(0);
}

Fixed version (ground truth):
/** 
 * Called to determine the initial header to be shown.  The default implementation simply returns the fragment of the first header.  Note that the returned Header object does not actually need to exist in your header list -- whatever its fragment is will simply be used to show for the initial UI.
 */
public Header onGetInitialHeader(){
  for (int i=0; i < mHeaders.size(); i++) {
    Header h=mHeaders.get(i);
    if (h.fragment != null) {
      return h;
    }
  }
  throw new IllegalStateException("String_Node_Str");
}
Program: 2837
Project: 2837
Buggy source:
/** 
 * When in two-pane mode, switch to the fragment pane to show the given preference fragment.
 * @param header The new header to display.
 */
public void switchToHeader(Header header){
  if (mCurHeader == header) {
    getFragmentManager().popBackStack(BACK_STACK_PREFS,FragmentManager.POP_BACK_STACK_INCLUSIVE);
  }
 else {
    int direction=mHeaders.indexOf(header) - mHeaders.indexOf(mCurHeader);
    switchToHeaderInner(header.fragment,header.fragmentArguments,direction);
    setSelectedHeader(header);
  }
}

Fixed version (ground truth):
/** 
 * When in two-pane mode, switch to the fragment pane to show the given preference fragment.
 * @param header The new header to display.
 */
public void switchToHeader(Header header){
  if (mCurHeader == header) {
    getFragmentManager().popBackStack(BACK_STACK_PREFS,FragmentManager.POP_BACK_STACK_INCLUSIVE);
  }
 else {
    if (header.fragment == null) {
      throw new IllegalStateException("String_Node_Str");
    }
    int direction=mHeaders.indexOf(header) - mHeaders.indexOf(mCurHeader);
    switchToHeaderInner(header.fragment,header.fragmentArguments,direction);
    setSelectedHeader(header);
  }
}
Program: 2838
Project: 2838
Buggy source:
private void computeGroupBounds(){
  Bounds[] values=groupBounds.values;
  for (int i=0; i < values.length; i++) {
    values[i].reset();
  }
  for (int i=0, N=getChildCount(); i < N; i++) {
    View c=getChildAt(i);
    LayoutParams lp=getLayoutParams(c);
    Spec spec=horizontal ? lp.columnSpec : lp.rowSpec;
    groupBounds.getValue(i).include(GridLayout.this,c,spec,this);
  }
}

Fixed version (ground truth):
private void computeGroupBounds(){
  Bounds[] values=groupBounds.values;
  for (int i=0; i < values.length; i++) {
    values[i].reset();
  }
  for (int i=0, N=getChildCount(); i < N; i++) {
    View c=getChildAt(i);
    if (c.getVisibility() == View.GONE)     continue;
    LayoutParams lp=getLayoutParams(c);
    Spec spec=horizontal ? lp.columnSpec : lp.rowSpec;
    groupBounds.getValue(i).include(GridLayout.this,c,spec,this);
  }
}
Program: 2839
Project: 2839
Buggy source:
private PackedMap<Spec,Bounds> createGroupBounds(){
  Assoc<Spec,Bounds> assoc=Assoc.of(Spec.class,Bounds.class);
  for (int i=0, N=getChildCount(); i < N; i++) {
    View c=getChildAt(i);
    LayoutParams lp=getLayoutParams(c);
    Spec spec=horizontal ? lp.columnSpec : lp.rowSpec;
    Bounds bounds=getAlignment(spec.alignment,horizontal).getBounds();
    assoc.put(spec,bounds);
  }
  return assoc.pack();
}

Fixed version (ground truth):
private PackedMap<Spec,Bounds> createGroupBounds(){
  Assoc<Spec,Bounds> assoc=Assoc.of(Spec.class,Bounds.class);
  for (int i=0, N=getChildCount(); i < N; i++) {
    View c=getChildAt(i);
    if (c.getVisibility() == View.GONE)     continue;
    LayoutParams lp=getLayoutParams(c);
    Spec spec=horizontal ? lp.columnSpec : lp.rowSpec;
    Bounds bounds=getAlignment(spec.alignment,horizontal).getBounds();
    assoc.put(spec,bounds);
  }
  return assoc.pack();
}
Program: 2840
Project: 2840
Buggy source:
private void initializeGlobals(RenderScript RS,ScriptC_alloc s){
  Type.Builder typeBuilder=new Type.Builder(RS,Element.I32(RS));
  int X=5;
  int Y=7;
  int Z=0;
  s.set_dimX(X);
  s.set_dimY(Y);
  s.set_dimZ(Z);
  typeBuilder.setX(X).setY(Y);
  Allocation A=Allocation.createTyped(RS,typeBuilder.create());
  s.bind_a(A);
  typeBuilder=new Type.Builder(RS,Element.I32(RS));
  typeBuilder.setX(X).setY(Y).setFaces(true);
  Allocation AFaces=Allocation.createTyped(RS,typeBuilder.create());
  s.set_aFaces(AFaces);
  typeBuilder.setFaces(false).setMipmaps(true);
  Allocation ALOD=Allocation.createTyped(RS,typeBuilder.create());
  s.set_aLOD(ALOD);
  typeBuilder.setFaces(true).setMipmaps(true);
  Allocation AFacesLOD=Allocation.createTyped(RS,typeBuilder.create());
  s.set_aFacesLOD(AFacesLOD);
  return;
}

Fixed version (ground truth):
private void initializeGlobals(RenderScript RS,ScriptC_alloc s){
  Type.Builder typeBuilder=new Type.Builder(RS,Element.I32(RS));
  int X=5;
  int Y=7;
  int Z=0;
  s.set_dimX(X);
  s.set_dimY(Y);
  s.set_dimZ(Z);
  typeBuilder.setX(X).setY(Y);
  Allocation A=Allocation.createTyped(RS,typeBuilder.create());
  s.bind_a(A);
  s.set_aRaw(A);
  typeBuilder=new Type.Builder(RS,Element.I32(RS));
  typeBuilder.setX(X).setY(Y).setFaces(true);
  Allocation AFaces=Allocation.createTyped(RS,typeBuilder.create());
  s.set_aFaces(AFaces);
  typeBuilder.setFaces(false).setMipmaps(true);
  Allocation ALOD=Allocation.createTyped(RS,typeBuilder.create());
  s.set_aLOD(ALOD);
  typeBuilder.setFaces(true).setMipmaps(true);
  Allocation AFacesLOD=Allocation.createTyped(RS,typeBuilder.create());
  s.set_aFacesLOD(AFacesLOD);
  return;
}
Program: 2841
Project: 2841
Buggy source:
public void run(){
  RenderScript pRS=RenderScript.create(mCtx);
  ScriptC_alloc s=new ScriptC_alloc(pRS);
  pRS.setMessageHandler(mRsMessage);
  initializeGlobals(pRS,s);
  s.invoke_alloc_test();
  pRS.finish();
  waitForMessage();
  pRS.destroy();
}

Fixed version (ground truth):
public void run(){
  RenderScript pRS=RenderScript.create(mCtx);
  ScriptC_alloc s=new ScriptC_alloc(pRS);
  pRS.setMessageHandler(mRsMessage);
  initializeGlobals(pRS,s);
  s.forEach_root(s.get_aRaw());
  s.invoke_alloc_test();
  pRS.finish();
  waitForMessage();
  pRS.destroy();
}
Program: 2842
Project: 2842
Buggy source:
private void initializeGlobals(RenderScript RS,ScriptC_foreach s){
  Type.Builder typeBuilder=new Type.Builder(RS,Element.I32(RS));
  int X=5;
  int Y=7;
  s.set_dimX(X);
  s.set_dimY(Y);
  typeBuilder.setX(X).setY(Y);
  A=Allocation.createTyped(RS,typeBuilder.create());
  s.bind_a(A);
  return;
}

Fixed version (ground truth):
private void initializeGlobals(RenderScript RS,ScriptC_foreach s){
  Type.Builder typeBuilder=new Type.Builder(RS,Element.I32(RS));
  int X=5;
  int Y=7;
  s.set_dimX(X);
  s.set_dimY(Y);
  typeBuilder.setX(X).setY(Y);
  A=Allocation.createTyped(RS,typeBuilder.create());
  s.set_aRaw(A);
  return;
}
Program: 2843
Project: 2843
Buggy source:
private void initializeGlobals(RenderScript RS,ScriptC_foreach_bounds s){
  Type.Builder typeBuilder=new Type.Builder(RS,Element.I32(RS));
  int X=5;
  int Y=7;
  s.set_dimX(X);
  s.set_dimY(Y);
  typeBuilder.setX(X).setY(Y);
  A=Allocation.createTyped(RS,typeBuilder.create());
  s.bind_a(A);
  s.set_s(s);
  s.set_ain(A);
  s.set_aout(A);
  s.set_xStart(2);
  s.set_xEnd(5);
  s.set_yStart(3);
  s.set_yEnd(6);
  s.forEach_zero(A);
  return;
}

Fixed version (ground truth):
private void initializeGlobals(RenderScript RS,ScriptC_foreach_bounds s){
  Type.Builder typeBuilder=new Type.Builder(RS,Element.I32(RS));
  int X=5;
  int Y=7;
  s.set_dimX(X);
  s.set_dimY(Y);
  typeBuilder.setX(X).setY(Y);
  A=Allocation.createTyped(RS,typeBuilder.create());
  s.set_aRaw(A);
  s.set_s(s);
  s.set_ain(A);
  s.set_aout(A);
  s.set_xStart(2);
  s.set_xEnd(5);
  s.set_yStart(3);
  s.set_yEnd(6);
  s.forEach_zero(A);
  return;
}
Program: 2844
Project: 2844
Buggy source:
private void initializeGlobals(RenderScript RS,ScriptC_noroot s){
  Type.Builder typeBuilder=new Type.Builder(RS,Element.I32(RS));
  int X=5;
  int Y=7;
  s.set_dimX(X);
  s.set_dimY(Y);
  typeBuilder.setX(X).setY(Y);
  A=Allocation.createTyped(RS,typeBuilder.create());
  s.bind_a(A);
  return;
}

Fixed version (ground truth):
private void initializeGlobals(RenderScript RS,ScriptC_noroot s){
  Type.Builder typeBuilder=new Type.Builder(RS,Element.I32(RS));
  int X=5;
  int Y=7;
  s.set_dimX(X);
  s.set_dimY(Y);
  typeBuilder.setX(X).setY(Y);
  A=Allocation.createTyped(RS,typeBuilder.create());
  s.set_aRaw(A);
  return;
}
Program: 2845
Project: 2845
Buggy source:
/** 
 * Called to determine the initial header to be shown.  The default implementation simply returns the fragment of the first header.  Note that the returned Header object does not actually need to exist in your header list -- whatever its fragment is will simply be used to show for the initial UI.
 */
public Header onGetInitialHeader(){
  return mHeaders.get(0);
}

Fixed version (ground truth):
/** 
 * Called to determine the initial header to be shown.  The default implementation simply returns the fragment of the first header.  Note that the returned Header object does not actually need to exist in your header list -- whatever its fragment is will simply be used to show for the initial UI.
 */
public Header onGetInitialHeader(){
  for (int i=0; i < mHeaders.size(); i++) {
    Header h=mHeaders.get(i);
    if (h.fragment != null) {
      return h;
    }
  }
  throw new IllegalStateException("String_Node_Str");
}
Program: 2846
Project: 2846
Buggy source:
/** 
 * When in two-pane mode, switch to the fragment pane to show the given preference fragment.
 * @param header The new header to display.
 */
public void switchToHeader(Header header){
  if (mCurHeader == header) {
    getFragmentManager().popBackStack(BACK_STACK_PREFS,FragmentManager.POP_BACK_STACK_INCLUSIVE);
  }
 else {
    int direction=mHeaders.indexOf(header) - mHeaders.indexOf(mCurHeader);
    switchToHeaderInner(header.fragment,header.fragmentArguments,direction);
    setSelectedHeader(header);
  }
}

Fixed version (ground truth):
/** 
 * When in two-pane mode, switch to the fragment pane to show the given preference fragment.
 * @param header The new header to display.
 */
public void switchToHeader(Header header){
  if (mCurHeader == header) {
    getFragmentManager().popBackStack(BACK_STACK_PREFS,FragmentManager.POP_BACK_STACK_INCLUSIVE);
  }
 else {
    if (header.fragment == null) {
      throw new IllegalStateException("String_Node_Str");
    }
    int direction=mHeaders.indexOf(header) - mHeaders.indexOf(mCurHeader);
    switchToHeaderInner(header.fragment,header.fragmentArguments,direction);
    setSelectedHeader(header);
  }
}
Program: 2847
Project: 2847
Buggy source:
/** 
 * @return true if layout direction has been resolved.
 */
private boolean isLayoutDirectionResolved(){
  return (mPrivateFlags2 & PFLAG2_LAYOUT_DIRECTION_RESOLVED) == PFLAG2_LAYOUT_DIRECTION_RESOLVED;
}

Fixed version (ground truth):
/** 
 * @return true if layout direction has been resolved.
 * @hide
 */
public boolean isLayoutDirectionResolved(){
  return (mPrivateFlags2 & PFLAG2_LAYOUT_DIRECTION_RESOLVED) == PFLAG2_LAYOUT_DIRECTION_RESOLVED;
}
Program: 2849
Project: 2849
Buggy source:
/** 
 * @return true if text alignment is resolved.
 */
private boolean isTextAlignmentResolved(){
  return (mPrivateFlags2 & PFLAG2_TEXT_ALIGNMENT_RESOLVED) == PFLAG2_TEXT_ALIGNMENT_RESOLVED;
}

Fixed version (ground truth):
/** 
 * @return true if text alignment is resolved.
 * @hide
 */
public boolean isTextAlignmentResolved(){
  return (mPrivateFlags2 & PFLAG2_TEXT_ALIGNMENT_RESOLVED) == PFLAG2_TEXT_ALIGNMENT_RESOLVED;
}
Program: 2850
Project: 2850
Buggy source:
/** 
 * Check if text direction resolution can be done.
 * @return true if text direction resolution can be done otherwise return false.
 */
private boolean canResolveTextDirection(){
switch (getRawTextDirection()) {
case TEXT_DIRECTION_INHERIT:
    return (mParent != null) && (mParent instanceof View) && ((View)mParent).canResolveTextDirection();
default :
  return true;
}
}

Fixed version (ground truth):
/** 
 * Check if text direction resolution can be done.
 * @return true if text direction resolution can be done otherwise return false.
 * @hide
 */
public boolean canResolveTextDirection(){
switch (getRawTextDirection()) {
case TEXT_DIRECTION_INHERIT:
    return (mParent != null) && mParent.canResolveTextDirection();
default :
  return true;
}
}
Program: 2851
Project: 2851
Buggy source:
/** 
 * @return true if text direction is resolved.
 */
private boolean isTextDirectionResolved(){
  return (mPrivateFlags2 & PFLAG2_TEXT_DIRECTION_RESOLVED) == PFLAG2_TEXT_DIRECTION_RESOLVED;
}

Fixed version (ground truth):
/** 
 * @return true if text direction is resolved.
 * @hide
 */
public boolean isTextDirectionResolved(){
  return (mPrivateFlags2 & PFLAG2_TEXT_DIRECTION_RESOLVED) == PFLAG2_TEXT_DIRECTION_RESOLVED;
}
Program: 2852
Project: 2852
Buggy source:
/** 
 * Returns the resolved layout direction for this view.
 * @return {@link #LAYOUT_DIRECTION_RTL} if the layout direction is RTL or returns{@link #LAYOUT_DIRECTION_LTR} if the layout direction is not RTL.For compatibility, this will return  {@link #LAYOUT_DIRECTION_LTR} if API versionis lower than  {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}.
 * @attr ref android.R.styleable#View_layoutDirection
 */
@ViewDebug.ExportedProperty(category="String_Node_Str",mapping={@ViewDebug.IntToString(from=LAYOUT_DIRECTION_LTR,to="String_Node_Str"),@ViewDebug.IntToString(from=LAYOUT_DIRECTION_RTL,to="String_Node_Str")}) public int getLayoutDirection(){
  final int targetSdkVersion=getContext().getApplicationInfo().targetSdkVersion;
  if (targetSdkVersion < JELLY_BEAN_MR1) {
    mPrivateFlags2|=PFLAG2_LAYOUT_DIRECTION_RESOLVED;
    return LAYOUT_DIRECTION_LTR;
  }
  return ((mPrivateFlags2 & PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL) == PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL) ? LAYOUT_DIRECTION_RTL : LAYOUT_DIRECTION_LTR;
}

Fixed version (ground truth):
/** 
 * Returns the resolved layout direction for this view.
 * @return {@link #LAYOUT_DIRECTION_RTL} if the layout direction is RTL or returns{@link #LAYOUT_DIRECTION_LTR} if the layout direction is not RTL.For compatibility, this will return  {@link #LAYOUT_DIRECTION_LTR} if API versionis lower than  {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}.
 * @attr ref android.R.styleable#View_layoutDirection
 */
@ViewDebug.ExportedProperty(category="String_Node_Str",mapping={@ViewDebug.IntToString(from=LAYOUT_DIRECTION_LTR,to="String_Node_Str"),@ViewDebug.IntToString(from=LAYOUT_DIRECTION_RTL,to="String_Node_Str")}) public int getLayoutDirection(){
  final int targetSdkVersion=getContext().getApplicationInfo().targetSdkVersion;
  if (targetSdkVersion < JELLY_BEAN_MR1) {
    mPrivateFlags2|=PFLAG2_LAYOUT_DIRECTION_RESOLVED;
    return LAYOUT_DIRECTION_RESOLVED_DEFAULT;
  }
  return ((mPrivateFlags2 & PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL) == PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL) ? LAYOUT_DIRECTION_RTL : LAYOUT_DIRECTION_LTR;
}
Program: 2853
Project: 2853
Buggy source:
/** 
 * Resolve the text direction.
 * @return true if resolution has been done, false otherwise.
 * @hide
 */
public boolean resolveTextDirection(){
  mPrivateFlags2&=~(PFLAG2_TEXT_DIRECTION_RESOLVED | PFLAG2_TEXT_DIRECTION_RESOLVED_MASK);
  if (hasRtlSupport()) {
    final int textDirection=getRawTextDirection();
switch (textDirection) {
case TEXT_DIRECTION_INHERIT:
      if (!canResolveTextDirection()) {
        mPrivateFlags2|=PFLAG2_TEXT_DIRECTION_RESOLVED_DEFAULT;
        return false;
      }
    View parent=((View)mParent);
  if (!parent.isTextDirectionResolved()) {
    mPrivateFlags2|=PFLAG2_TEXT_DIRECTION_RESOLVED_DEFAULT;
    return false;
  }
final int parentResolvedDirection=parent.getTextDirection();
switch (parentResolvedDirection) {
case TEXT_DIRECTION_FIRST_STRONG:
case TEXT_DIRECTION_ANY_RTL:
case TEXT_DIRECTION_LTR:
case TEXT_DIRECTION_RTL:
case TEXT_DIRECTION_LOCALE:
mPrivateFlags2|=(parentResolvedDirection << PFLAG2_TEXT_DIRECTION_RESOLVED_MASK_SHIFT);
break;
default :
mPrivateFlags2|=PFLAG2_TEXT_DIRECTION_RESOLVED_DEFAULT;
}
break;
case TEXT_DIRECTION_FIRST_STRONG:
case TEXT_DIRECTION_ANY_RTL:
case TEXT_DIRECTION_LTR:
case TEXT_DIRECTION_RTL:
case TEXT_DIRECTION_LOCALE:
mPrivateFlags2|=(textDirection << PFLAG2_TEXT_DIRECTION_RESOLVED_MASK_SHIFT);
break;
default :
mPrivateFlags2|=PFLAG2_TEXT_DIRECTION_RESOLVED_DEFAULT;
}
}
 else {
mPrivateFlags2|=PFLAG2_TEXT_DIRECTION_RESOLVED_DEFAULT;
}
mPrivateFlags2|=PFLAG2_TEXT_DIRECTION_RESOLVED;
return true;
}

Fixed version (ground truth):
/** 
 * Resolve the text direction.
 * @return true if resolution has been done, false otherwise.
 * @hide
 */
public boolean resolveTextDirection(){
  mPrivateFlags2&=~(PFLAG2_TEXT_DIRECTION_RESOLVED | PFLAG2_TEXT_DIRECTION_RESOLVED_MASK);
  if (hasRtlSupport()) {
    final int textDirection=getRawTextDirection();
switch (textDirection) {
case TEXT_DIRECTION_INHERIT:
      if (!canResolveTextDirection()) {
        mPrivateFlags2|=PFLAG2_TEXT_DIRECTION_RESOLVED_DEFAULT;
        return false;
      }
    if (!mParent.isTextDirectionResolved()) {
      mPrivateFlags2|=PFLAG2_TEXT_DIRECTION_RESOLVED_DEFAULT;
      return false;
    }
  final int parentResolvedDirection=mParent.getTextDirection();
switch (parentResolvedDirection) {
case TEXT_DIRECTION_FIRST_STRONG:
case TEXT_DIRECTION_ANY_RTL:
case TEXT_DIRECTION_LTR:
case TEXT_DIRECTION_RTL:
case TEXT_DIRECTION_LOCALE:
  mPrivateFlags2|=(parentResolvedDirection << PFLAG2_TEXT_DIRECTION_RESOLVED_MASK_SHIFT);
break;
default :
mPrivateFlags2|=PFLAG2_TEXT_DIRECTION_RESOLVED_DEFAULT;
}
break;
case TEXT_DIRECTION_FIRST_STRONG:
case TEXT_DIRECTION_ANY_RTL:
case TEXT_DIRECTION_LTR:
case TEXT_DIRECTION_RTL:
case TEXT_DIRECTION_LOCALE:
mPrivateFlags2|=(textDirection << PFLAG2_TEXT_DIRECTION_RESOLVED_MASK_SHIFT);
break;
default :
mPrivateFlags2|=PFLAG2_TEXT_DIRECTION_RESOLVED_DEFAULT;
}
}
 else {
mPrivateFlags2|=PFLAG2_TEXT_DIRECTION_RESOLVED_DEFAULT;
}
mPrivateFlags2|=PFLAG2_TEXT_DIRECTION_RESOLVED;
return true;
}
Program: 2854
Project: 2854
Buggy source:
/** 
 * Resolve and cache the layout direction. LTR is set initially. This is implicitly supposing that the parent directionality can and will be resolved before its children.
 * @return true if resolution has been done, false otherwise.
 * @hide
 */
public boolean resolveLayoutDirection(){
  mPrivateFlags2&=~PFLAG2_LAYOUT_DIRECTION_RESOLVED_MASK;
  if (hasRtlSupport()) {
switch ((mPrivateFlags2 & PFLAG2_LAYOUT_DIRECTION_MASK) >> PFLAG2_LAYOUT_DIRECTION_MASK_SHIFT) {
case LAYOUT_DIRECTION_INHERIT:
      if (!canResolveLayoutDirection())       return false;
    View parent=((View)mParent);
  if (!parent.isLayoutDirectionResolved())   return false;
if (parent.getLayoutDirection() == LAYOUT_DIRECTION_RTL) {
  mPrivateFlags2|=PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL;
}
break;
case LAYOUT_DIRECTION_RTL:
mPrivateFlags2|=PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL;
break;
case LAYOUT_DIRECTION_LOCALE:
if ((LAYOUT_DIRECTION_RTL == TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()))) {
mPrivateFlags2|=PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL;
}
break;
default :
}
}
mPrivateFlags2|=PFLAG2_LAYOUT_DIRECTION_RESOLVED;
return true;
}

Fixed version (ground truth):
/** 
 * Resolve and cache the layout direction. LTR is set initially. This is implicitly supposing that the parent directionality can and will be resolved before its children.
 * @return true if resolution has been done, false otherwise.
 * @hide
 */
public boolean resolveLayoutDirection(){
  mPrivateFlags2&=~PFLAG2_LAYOUT_DIRECTION_RESOLVED_MASK;
  if (hasRtlSupport()) {
switch ((mPrivateFlags2 & PFLAG2_LAYOUT_DIRECTION_MASK) >> PFLAG2_LAYOUT_DIRECTION_MASK_SHIFT) {
case LAYOUT_DIRECTION_INHERIT:
      if (!canResolveLayoutDirection())       return false;
    if (!mParent.isLayoutDirectionResolved())     return false;
  if (mParent.getLayoutDirection() == LAYOUT_DIRECTION_RTL) {
    mPrivateFlags2|=PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL;
  }
break;
case LAYOUT_DIRECTION_RTL:
mPrivateFlags2|=PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL;
break;
case LAYOUT_DIRECTION_LOCALE:
if ((LAYOUT_DIRECTION_RTL == TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()))) {
mPrivateFlags2|=PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL;
}
break;
default :
}
}
mPrivateFlags2|=PFLAG2_LAYOUT_DIRECTION_RESOLVED;
return true;
}
Program: 2855
Project: 2855
Buggy source:
/** 
 * Check if layout direction resolution can be done.
 * @return true if layout direction resolution can be done otherwise return false.
 * @hide
 */
public boolean canResolveLayoutDirection(){
switch (getRawLayoutDirection()) {
case LAYOUT_DIRECTION_INHERIT:
    return (mParent != null) && (mParent instanceof ViewGroup) && ((ViewGroup)mParent).canResolveLayoutDirection();
default :
  return true;
}
}

Fixed version (ground truth):
/** 
 * Check if layout direction resolution can be done.
 * @return true if layout direction resolution can be done otherwise return false.
 * @hide
 */
public boolean canResolveLayoutDirection(){
switch (getRawLayoutDirection()) {
case LAYOUT_DIRECTION_INHERIT:
    return (mParent != null) && mParent.canResolveLayoutDirection();
default :
  return true;
}
}
Program: 2856
Project: 2856
Buggy source:
/** 
 * Check if text alignment resolution can be done.
 * @return true if text alignment resolution can be done otherwise return false.
 */
private boolean canResolveTextAlignment(){
switch (getRawTextAlignment()) {
case TEXT_DIRECTION_INHERIT:
    return (mParent != null) && (mParent instanceof View) && ((View)mParent).canResolveTextAlignment();
default :
  return true;
}
}

Fixed version (ground truth):
/** 
 * Check if text alignment resolution can be done.
 * @return true if text alignment resolution can be done otherwise return false.
 * @hide
 */
public boolean canResolveTextAlignment(){
switch (getRawTextAlignment()) {
case TEXT_DIRECTION_INHERIT:
    return (mParent != null) && mParent.canResolveTextAlignment();
default :
  return true;
}
}
Program: 2857
Project: 2857
Buggy source:
/** 
 * Return a color integer associated with a particular resource ID. If the resource holds a complex  {@link android.content.res.ColorStateList}, then the default color from the set is returned.
 * @param id The desired resource identifier, as generated by the aapttool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier.
 * @throws NotFoundException Throws NotFoundException if the given ID does not exist.
 * @return Returns a single color value in the form 0xAARRGGBB.
 */
public int getColor(int id) throws NotFoundException {
  TypedValue value;
synchronized (mAccessLock) {
    value=mTmpValue;
    if (value == null) {
      value=new TypedValue();
    }
    getValue(id,value,true);
    if (value.type >= TypedValue.TYPE_FIRST_INT && value.type <= TypedValue.TYPE_LAST_INT) {
      mTmpValue=value;
      return value.data;
    }
 else     if (value.type != TypedValue.TYPE_STRING) {
      throw new NotFoundException("String_Node_Str" + Integer.toHexString(id) + "String_Node_Str"+ Integer.toHexString(value.type)+ "String_Node_Str");
    }
  }
  ColorStateList csl=loadColorStateList(value,id);
synchronized (mAccessLock) {
    if (mTmpValue == null) {
      mTmpValue=value;
    }
  }
  return csl.getDefaultColor();
}

Fixed version (ground truth):
/** 
 * Return a color integer associated with a particular resource ID. If the resource holds a complex  {@link android.content.res.ColorStateList}, then the default color from the set is returned.
 * @param id The desired resource identifier, as generated by the aapttool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier.
 * @throws NotFoundException Throws NotFoundException if the given ID does not exist.
 * @return Returns a single color value in the form 0xAARRGGBB.
 */
public int getColor(int id) throws NotFoundException {
  TypedValue value;
synchronized (mAccessLock) {
    value=mTmpValue;
    if (value == null) {
      value=new TypedValue();
    }
    getValue(id,value,true);
    if (value.type >= TypedValue.TYPE_FIRST_INT && value.type <= TypedValue.TYPE_LAST_INT) {
      mTmpValue=value;
      return value.data;
    }
 else     if (value.type != TypedValue.TYPE_STRING) {
      throw new NotFoundException("String_Node_Str" + Integer.toHexString(id) + "String_Node_Str"+ Integer.toHexString(value.type)+ "String_Node_Str");
    }
    mTmpValue=null;
  }
  ColorStateList csl=loadColorStateList(value,id);
synchronized (mAccessLock) {
    if (mTmpValue == null) {
      mTmpValue=value;
    }
  }
  return csl.getDefaultColor();
}
Program: 2858
Project: 2858
Buggy source:
/** 
 * Return a color integer associated with a particular resource ID. If the resource holds a complex  {@link android.content.res.ColorStateList}, then the default color from the set is returned.
 * @param id The desired resource identifier, as generated by the aapttool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier.
 * @throws NotFoundException Throws NotFoundException if the given ID does not exist.
 * @return Returns a single color value in the form 0xAARRGGBB.
 */
public int getColor(int id) throws NotFoundException {
  TypedValue value;
synchronized (mAccessLock) {
    value=mTmpValue;
    if (value == null) {
      value=new TypedValue();
    }
    getValue(id,value,true);
    if (value.type >= TypedValue.TYPE_FIRST_INT && value.type <= TypedValue.TYPE_LAST_INT) {
      mTmpValue=value;
      return value.data;
    }
 else     if (value.type != TypedValue.TYPE_STRING) {
      throw new NotFoundException("String_Node_Str" + Integer.toHexString(id) + "String_Node_Str"+ Integer.toHexString(value.type)+ "String_Node_Str");
    }
  }
  ColorStateList csl=loadColorStateList(value,id);
synchronized (mAccessLock) {
    if (mTmpValue == null) {
      mTmpValue=value;
    }
  }
  return csl.getDefaultColor();
}

Fixed version (ground truth):
/** 
 * Return a color integer associated with a particular resource ID. If the resource holds a complex  {@link android.content.res.ColorStateList}, then the default color from the set is returned.
 * @param id The desired resource identifier, as generated by the aapttool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier.
 * @throws NotFoundException Throws NotFoundException if the given ID does not exist.
 * @return Returns a single color value in the form 0xAARRGGBB.
 */
public int getColor(int id) throws NotFoundException {
  TypedValue value;
synchronized (mAccessLock) {
    value=mTmpValue;
    if (value == null) {
      value=new TypedValue();
    }
    getValue(id,value,true);
    if (value.type >= TypedValue.TYPE_FIRST_INT && value.type <= TypedValue.TYPE_LAST_INT) {
      mTmpValue=value;
      return value.data;
    }
 else     if (value.type != TypedValue.TYPE_STRING) {
      throw new NotFoundException("String_Node_Str" + Integer.toHexString(id) + "String_Node_Str"+ Integer.toHexString(value.type)+ "String_Node_Str");
    }
    mTmpValue=null;
  }
  ColorStateList csl=loadColorStateList(value,id);
synchronized (mAccessLock) {
    if (mTmpValue == null) {
      mTmpValue=value;
    }
  }
  return csl.getDefaultColor();
}
Program: 2859
Project: 2859
Buggy source:
/** 
 * @return true if layout direction has been resolved.
 */
private boolean isLayoutDirectionResolved(){
  return (mPrivateFlags2 & PFLAG2_LAYOUT_DIRECTION_RESOLVED) == PFLAG2_LAYOUT_DIRECTION_RESOLVED;
}

Fixed version (ground truth):
/** 
 * @return true if layout direction has been resolved.
 * @hide
 */
public boolean isLayoutDirectionResolved(){
  return (mPrivateFlags2 & PFLAG2_LAYOUT_DIRECTION_RESOLVED) == PFLAG2_LAYOUT_DIRECTION_RESOLVED;
}
Program: 2861
Project: 2861
Buggy source:
/** 
 * @return true if text alignment is resolved.
 */
private boolean isTextAlignmentResolved(){
  return (mPrivateFlags2 & PFLAG2_TEXT_ALIGNMENT_RESOLVED) == PFLAG2_TEXT_ALIGNMENT_RESOLVED;
}

Fixed version (ground truth):
/** 
 * @return true if text alignment is resolved.
 * @hide
 */
public boolean isTextAlignmentResolved(){
  return (mPrivateFlags2 & PFLAG2_TEXT_ALIGNMENT_RESOLVED) == PFLAG2_TEXT_ALIGNMENT_RESOLVED;
}
Program: 2862
Project: 2862
Buggy source:
/** 
 * Check if text direction resolution can be done.
 * @return true if text direction resolution can be done otherwise return false.
 */
private boolean canResolveTextDirection(){
switch (getRawTextDirection()) {
case TEXT_DIRECTION_INHERIT:
    return (mParent != null) && (mParent instanceof View) && ((View)mParent).canResolveTextDirection();
default :
  return true;
}
}

Fixed version (ground truth):
/** 
 * Check if text direction resolution can be done.
 * @return true if text direction resolution can be done otherwise return false.
 * @hide
 */
public boolean canResolveTextDirection(){
switch (getRawTextDirection()) {
case TEXT_DIRECTION_INHERIT:
    return (mParent != null) && mParent.canResolveTextDirection();
default :
  return true;
}
}
Program: 2863
Project: 2863
Buggy source:
/** 
 * @return true if text direction is resolved.
 */
private boolean isTextDirectionResolved(){
  return (mPrivateFlags2 & PFLAG2_TEXT_DIRECTION_RESOLVED) == PFLAG2_TEXT_DIRECTION_RESOLVED;
}

Fixed version (ground truth):
/** 
 * @return true if text direction is resolved.
 * @hide
 */
public boolean isTextDirectionResolved(){
  return (mPrivateFlags2 & PFLAG2_TEXT_DIRECTION_RESOLVED) == PFLAG2_TEXT_DIRECTION_RESOLVED;
}
Program: 2864
Project: 2864
Buggy source:
/** 
 * Returns the resolved layout direction for this view.
 * @return {@link #LAYOUT_DIRECTION_RTL} if the layout direction is RTL or returns{@link #LAYOUT_DIRECTION_LTR} if the layout direction is not RTL.For compatibility, this will return  {@link #LAYOUT_DIRECTION_LTR} if API versionis lower than  {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}.
 * @attr ref android.R.styleable#View_layoutDirection
 */
@ViewDebug.ExportedProperty(category="String_Node_Str",mapping={@ViewDebug.IntToString(from=LAYOUT_DIRECTION_LTR,to="String_Node_Str"),@ViewDebug.IntToString(from=LAYOUT_DIRECTION_RTL,to="String_Node_Str")}) public int getLayoutDirection(){
  final int targetSdkVersion=getContext().getApplicationInfo().targetSdkVersion;
  if (targetSdkVersion < JELLY_BEAN_MR1) {
    mPrivateFlags2|=PFLAG2_LAYOUT_DIRECTION_RESOLVED;
    return LAYOUT_DIRECTION_LTR;
  }
  return ((mPrivateFlags2 & PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL) == PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL) ? LAYOUT_DIRECTION_RTL : LAYOUT_DIRECTION_LTR;
}

Fixed version (ground truth):
/** 
 * Returns the resolved layout direction for this view.
 * @return {@link #LAYOUT_DIRECTION_RTL} if the layout direction is RTL or returns{@link #LAYOUT_DIRECTION_LTR} if the layout direction is not RTL.For compatibility, this will return  {@link #LAYOUT_DIRECTION_LTR} if API versionis lower than  {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}.
 * @attr ref android.R.styleable#View_layoutDirection
 */
@ViewDebug.ExportedProperty(category="String_Node_Str",mapping={@ViewDebug.IntToString(from=LAYOUT_DIRECTION_LTR,to="String_Node_Str"),@ViewDebug.IntToString(from=LAYOUT_DIRECTION_RTL,to="String_Node_Str")}) public int getLayoutDirection(){
  final int targetSdkVersion=getContext().getApplicationInfo().targetSdkVersion;
  if (targetSdkVersion < JELLY_BEAN_MR1) {
    mPrivateFlags2|=PFLAG2_LAYOUT_DIRECTION_RESOLVED;
    return LAYOUT_DIRECTION_RESOLVED_DEFAULT;
  }
  return ((mPrivateFlags2 & PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL) == PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL) ? LAYOUT_DIRECTION_RTL : LAYOUT_DIRECTION_LTR;
}
Program: 2865
Project: 2865
Buggy source:
/** 
 * Resolve the text direction.
 * @return true if resolution has been done, false otherwise.
 * @hide
 */
public boolean resolveTextDirection(){
  mPrivateFlags2&=~(PFLAG2_TEXT_DIRECTION_RESOLVED | PFLAG2_TEXT_DIRECTION_RESOLVED_MASK);
  if (hasRtlSupport()) {
    final int textDirection=getRawTextDirection();
switch (textDirection) {
case TEXT_DIRECTION_INHERIT:
      if (!canResolveTextDirection()) {
        mPrivateFlags2|=PFLAG2_TEXT_DIRECTION_RESOLVED_DEFAULT;
        return false;
      }
    View parent=((View)mParent);
  if (!parent.isTextDirectionResolved()) {
    mPrivateFlags2|=PFLAG2_TEXT_DIRECTION_RESOLVED_DEFAULT;
    return false;
  }
final int parentResolvedDirection=parent.getTextDirection();
switch (parentResolvedDirection) {
case TEXT_DIRECTION_FIRST_STRONG:
case TEXT_DIRECTION_ANY_RTL:
case TEXT_DIRECTION_LTR:
case TEXT_DIRECTION_RTL:
case TEXT_DIRECTION_LOCALE:
mPrivateFlags2|=(parentResolvedDirection << PFLAG2_TEXT_DIRECTION_RESOLVED_MASK_SHIFT);
break;
default :
mPrivateFlags2|=PFLAG2_TEXT_DIRECTION_RESOLVED_DEFAULT;
}
break;
case TEXT_DIRECTION_FIRST_STRONG:
case TEXT_DIRECTION_ANY_RTL:
case TEXT_DIRECTION_LTR:
case TEXT_DIRECTION_RTL:
case TEXT_DIRECTION_LOCALE:
mPrivateFlags2|=(textDirection << PFLAG2_TEXT_DIRECTION_RESOLVED_MASK_SHIFT);
break;
default :
mPrivateFlags2|=PFLAG2_TEXT_DIRECTION_RESOLVED_DEFAULT;
}
}
 else {
mPrivateFlags2|=PFLAG2_TEXT_DIRECTION_RESOLVED_DEFAULT;
}
mPrivateFlags2|=PFLAG2_TEXT_DIRECTION_RESOLVED;
return true;
}

Fixed version (ground truth):
/** 
 * Resolve the text direction.
 * @return true if resolution has been done, false otherwise.
 * @hide
 */
public boolean resolveTextDirection(){
  mPrivateFlags2&=~(PFLAG2_TEXT_DIRECTION_RESOLVED | PFLAG2_TEXT_DIRECTION_RESOLVED_MASK);
  if (hasRtlSupport()) {
    final int textDirection=getRawTextDirection();
switch (textDirection) {
case TEXT_DIRECTION_INHERIT:
      if (!canResolveTextDirection()) {
        mPrivateFlags2|=PFLAG2_TEXT_DIRECTION_RESOLVED_DEFAULT;
        return false;
      }
    if (!mParent.isTextDirectionResolved()) {
      mPrivateFlags2|=PFLAG2_TEXT_DIRECTION_RESOLVED_DEFAULT;
      return false;
    }
  final int parentResolvedDirection=mParent.getTextDirection();
switch (parentResolvedDirection) {
case TEXT_DIRECTION_FIRST_STRONG:
case TEXT_DIRECTION_ANY_RTL:
case TEXT_DIRECTION_LTR:
case TEXT_DIRECTION_RTL:
case TEXT_DIRECTION_LOCALE:
  mPrivateFlags2|=(parentResolvedDirection << PFLAG2_TEXT_DIRECTION_RESOLVED_MASK_SHIFT);
break;
default :
mPrivateFlags2|=PFLAG2_TEXT_DIRECTION_RESOLVED_DEFAULT;
}
break;
case TEXT_DIRECTION_FIRST_STRONG:
case TEXT_DIRECTION_ANY_RTL:
case TEXT_DIRECTION_LTR:
case TEXT_DIRECTION_RTL:
case TEXT_DIRECTION_LOCALE:
mPrivateFlags2|=(textDirection << PFLAG2_TEXT_DIRECTION_RESOLVED_MASK_SHIFT);
break;
default :
mPrivateFlags2|=PFLAG2_TEXT_DIRECTION_RESOLVED_DEFAULT;
}
}
 else {
mPrivateFlags2|=PFLAG2_TEXT_DIRECTION_RESOLVED_DEFAULT;
}
mPrivateFlags2|=PFLAG2_TEXT_DIRECTION_RESOLVED;
return true;
}
Program: 2866
Project: 2866
Buggy source:
/** 
 * Resolve and cache the layout direction. LTR is set initially. This is implicitly supposing that the parent directionality can and will be resolved before its children.
 * @return true if resolution has been done, false otherwise.
 * @hide
 */
public boolean resolveLayoutDirection(){
  mPrivateFlags2&=~PFLAG2_LAYOUT_DIRECTION_RESOLVED_MASK;
  if (hasRtlSupport()) {
switch ((mPrivateFlags2 & PFLAG2_LAYOUT_DIRECTION_MASK) >> PFLAG2_LAYOUT_DIRECTION_MASK_SHIFT) {
case LAYOUT_DIRECTION_INHERIT:
      if (!canResolveLayoutDirection())       return false;
    View parent=((View)mParent);
  if (!parent.isLayoutDirectionResolved())   return false;
if (parent.getLayoutDirection() == LAYOUT_DIRECTION_RTL) {
  mPrivateFlags2|=PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL;
}
break;
case LAYOUT_DIRECTION_RTL:
mPrivateFlags2|=PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL;
break;
case LAYOUT_DIRECTION_LOCALE:
if ((LAYOUT_DIRECTION_RTL == TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()))) {
mPrivateFlags2|=PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL;
}
break;
default :
}
}
mPrivateFlags2|=PFLAG2_LAYOUT_DIRECTION_RESOLVED;
return true;
}

Fixed version (ground truth):
/** 
 * Resolve and cache the layout direction. LTR is set initially. This is implicitly supposing that the parent directionality can and will be resolved before its children.
 * @return true if resolution has been done, false otherwise.
 * @hide
 */
public boolean resolveLayoutDirection(){
  mPrivateFlags2&=~PFLAG2_LAYOUT_DIRECTION_RESOLVED_MASK;
  if (hasRtlSupport()) {
switch ((mPrivateFlags2 & PFLAG2_LAYOUT_DIRECTION_MASK) >> PFLAG2_LAYOUT_DIRECTION_MASK_SHIFT) {
case LAYOUT_DIRECTION_INHERIT:
      if (!canResolveLayoutDirection())       return false;
    if (!mParent.isLayoutDirectionResolved())     return false;
  if (mParent.getLayoutDirection() == LAYOUT_DIRECTION_RTL) {
    mPrivateFlags2|=PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL;
  }
break;
case LAYOUT_DIRECTION_RTL:
mPrivateFlags2|=PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL;
break;
case LAYOUT_DIRECTION_LOCALE:
if ((LAYOUT_DIRECTION_RTL == TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()))) {
mPrivateFlags2|=PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL;
}
break;
default :
}
}
mPrivateFlags2|=PFLAG2_LAYOUT_DIRECTION_RESOLVED;
return true;
}
Program: 2867
Project: 2867
Buggy source:
/** 
 * Check if layout direction resolution can be done.
 * @return true if layout direction resolution can be done otherwise return false.
 * @hide
 */
public boolean canResolveLayoutDirection(){
switch (getRawLayoutDirection()) {
case LAYOUT_DIRECTION_INHERIT:
    return (mParent != null) && (mParent instanceof ViewGroup) && ((ViewGroup)mParent).canResolveLayoutDirection();
default :
  return true;
}
}

Fixed version (ground truth):
/** 
 * Check if layout direction resolution can be done.
 * @return true if layout direction resolution can be done otherwise return false.
 * @hide
 */
public boolean canResolveLayoutDirection(){
switch (getRawLayoutDirection()) {
case LAYOUT_DIRECTION_INHERIT:
    return (mParent != null) && mParent.canResolveLayoutDirection();
default :
  return true;
}
}
Program: 2868
Project: 2868
Buggy source:
/** 
 * Check if text alignment resolution can be done.
 * @return true if text alignment resolution can be done otherwise return false.
 */
private boolean canResolveTextAlignment(){
switch (getRawTextAlignment()) {
case TEXT_DIRECTION_INHERIT:
    return (mParent != null) && (mParent instanceof View) && ((View)mParent).canResolveTextAlignment();
default :
  return true;
}
}

Fixed version (ground truth):
/** 
 * Check if text alignment resolution can be done.
 * @return true if text alignment resolution can be done otherwise return false.
 * @hide
 */
public boolean canResolveTextAlignment(){
switch (getRawTextAlignment()) {
case TEXT_DIRECTION_INHERIT:
    return (mParent != null) && mParent.canResolveTextAlignment();
default :
  return true;
}
}
Program: 2869
Project: 2869
Buggy source:
/** 
 * Return a color integer associated with a particular resource ID. If the resource holds a complex  {@link android.content.res.ColorStateList}, then the default color from the set is returned.
 * @param id The desired resource identifier, as generated by the aapttool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier.
 * @throws NotFoundException Throws NotFoundException if the given ID does not exist.
 * @return Returns a single color value in the form 0xAARRGGBB.
 */
public int getColor(int id) throws NotFoundException {
  TypedValue value;
synchronized (mAccessLock) {
    value=mTmpValue;
    if (value == null) {
      value=new TypedValue();
    }
    getValue(id,value,true);
    if (value.type >= TypedValue.TYPE_FIRST_INT && value.type <= TypedValue.TYPE_LAST_INT) {
      mTmpValue=value;
      return value.data;
    }
 else     if (value.type != TypedValue.TYPE_STRING) {
      throw new NotFoundException("String_Node_Str" + Integer.toHexString(id) + "String_Node_Str"+ Integer.toHexString(value.type)+ "String_Node_Str");
    }
  }
  ColorStateList csl=loadColorStateList(value,id);
synchronized (mAccessLock) {
    if (mTmpValue == null) {
      mTmpValue=value;
    }
  }
  return csl.getDefaultColor();
}

Fixed version (ground truth):
/** 
 * Return a color integer associated with a particular resource ID. If the resource holds a complex  {@link android.content.res.ColorStateList}, then the default color from the set is returned.
 * @param id The desired resource identifier, as generated by the aapttool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier.
 * @throws NotFoundException Throws NotFoundException if the given ID does not exist.
 * @return Returns a single color value in the form 0xAARRGGBB.
 */
public int getColor(int id) throws NotFoundException {
  TypedValue value;
synchronized (mAccessLock) {
    value=mTmpValue;
    if (value == null) {
      value=new TypedValue();
    }
    getValue(id,value,true);
    if (value.type >= TypedValue.TYPE_FIRST_INT && value.type <= TypedValue.TYPE_LAST_INT) {
      mTmpValue=value;
      return value.data;
    }
 else     if (value.type != TypedValue.TYPE_STRING) {
      throw new NotFoundException("String_Node_Str" + Integer.toHexString(id) + "String_Node_Str"+ Integer.toHexString(value.type)+ "String_Node_Str");
    }
    mTmpValue=null;
  }
  ColorStateList csl=loadColorStateList(value,id);
synchronized (mAccessLock) {
    if (mTmpValue == null) {
      mTmpValue=value;
    }
  }
  return csl.getDefaultColor();
}
Program: 2870
Project: 2870
Buggy source:
/** 
 * @return true if layout direction has been resolved.
 */
private boolean isLayoutDirectionResolved(){
  return (mPrivateFlags2 & PFLAG2_LAYOUT_DIRECTION_RESOLVED) == PFLAG2_LAYOUT_DIRECTION_RESOLVED;
}

Fixed version (ground truth):
/** 
 * @return true if layout direction has been resolved.
 * @hide
 */
public boolean isLayoutDirectionResolved(){
  return (mPrivateFlags2 & PFLAG2_LAYOUT_DIRECTION_RESOLVED) == PFLAG2_LAYOUT_DIRECTION_RESOLVED;
}
Program: 2872
Project: 2872
Buggy source:
/** 
 * @return true if text alignment is resolved.
 */
private boolean isTextAlignmentResolved(){
  return (mPrivateFlags2 & PFLAG2_TEXT_ALIGNMENT_RESOLVED) == PFLAG2_TEXT_ALIGNMENT_RESOLVED;
}

Fixed version (ground truth):
/** 
 * @return true if text alignment is resolved.
 * @hide
 */
public boolean isTextAlignmentResolved(){
  return (mPrivateFlags2 & PFLAG2_TEXT_ALIGNMENT_RESOLVED) == PFLAG2_TEXT_ALIGNMENT_RESOLVED;
}
Program: 2873
Project: 2873
Buggy source:
/** 
 * Check if text direction resolution can be done.
 * @return true if text direction resolution can be done otherwise return false.
 */
private boolean canResolveTextDirection(){
switch (getRawTextDirection()) {
case TEXT_DIRECTION_INHERIT:
    return (mParent != null) && (mParent instanceof View) && ((View)mParent).canResolveTextDirection();
default :
  return true;
}
}

Fixed version (ground truth):
/** 
 * Check if text direction resolution can be done.
 * @return true if text direction resolution can be done otherwise return false.
 * @hide
 */
public boolean canResolveTextDirection(){
switch (getRawTextDirection()) {
case TEXT_DIRECTION_INHERIT:
    return (mParent != null) && mParent.canResolveTextDirection();
default :
  return true;
}
}
Program: 2874
Project: 2874
Buggy source:
/** 
 * @return true if text direction is resolved.
 */
private boolean isTextDirectionResolved(){
  return (mPrivateFlags2 & PFLAG2_TEXT_DIRECTION_RESOLVED) == PFLAG2_TEXT_DIRECTION_RESOLVED;
}

Fixed version (ground truth):
/** 
 * @return true if text direction is resolved.
 * @hide
 */
public boolean isTextDirectionResolved(){
  return (mPrivateFlags2 & PFLAG2_TEXT_DIRECTION_RESOLVED) == PFLAG2_TEXT_DIRECTION_RESOLVED;
}