nus-yam/ex-repair huggingface dataset:
Program: 20469
Project: 20469
Buggy source:
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  if (post == null) {
  }
 else {
    if (!post.hasImage) {
      throw new IllegalArgumentException("String_Node_Str");
    }
    imageView.setThumbnail(post.thumbnailUrl);
    if (post.ext.equals("String_Node_Str")) {
      imageView.setGif(post.imageUrl);
    }
 else     if (post.ext.equals("String_Node_Str")) {
      isVideo=true;
      activity.invalidateActionBar();
      showProgressBar(false);
      if (ChanPreferences.getVideoAutoPlay()) {
        startVideo();
      }
    }
 else {
      imageView.setBigImage(post.imageUrl);
    }
  }
}

Fixed version (ground truth):
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  if (post == null) {
  }
 else {
    if (!post.hasImage) {
      throw new IllegalArgumentException("String_Node_Str");
    }
    imageView.post(new Runnable(){
      @Override public void run(){
        if (imageView.getWidth() == 0 || imageView.getHeight() == 0)         return;
        imageView.setThumbnail(post.thumbnailUrl);
        if (post.ext.equals("String_Node_Str")) {
          imageView.setGif(post.imageUrl);
        }
 else         if (post.ext.equals("String_Node_Str")) {
          isVideo=true;
          activity.invalidateActionBar();
          showProgressBar(false);
          if (ChanPreferences.getVideoAutoPlay()) {
            startVideo();
          }
        }
 else {
          imageView.setBigImage(post.imageUrl);
        }
      }
    }
);
  }
}
Program: 20470
Project: 20470
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  if (post == null) {
    return null;
  }
 else {
    context=inflater.getContext();
    imageView=new ThumbnailImageView(context);
    imageView.setCallback(this);
    int padding=(int)context.getResources().getDimension(R.dimen.image_view_padding);
    imageView.setPadding(padding,padding,padding,padding);
    return imageView;
  }
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  if (post == null) {
    return null;
  }
 else {
    context=inflater.getContext();
    imageView=new ThumbnailImageView(context);
    imageView.setCallback(this);
    imageView.setLayoutParams(Utils.MATCH_PARAMS);
    int padding=(int)context.getResources().getDimension(R.dimen.image_view_padding);
    imageView.setPadding(padding,padding,padding,padding);
    return imageView;
  }
}
Program: 20471
Project: 20471
Buggy source:
public void setGif(String gifUrl){
  callback.setProgress(true);
  imageRequest=ChanApplication.getVolleyRequestQueue().add(new GIFRequest(gifUrl,new Response.Listener<GIFView>(){
    @Override public void onResponse(    GIFView view){
      view.setLayoutParams(Utils.MATCH_PARAMS);
      setView(view,false);
      callback.setProgress(false);
      thumbnailNeeded=false;
      tapDismiss=true;
    }
  }
,new Response.ErrorListener(){
    @Override public void onErrorResponse(    VolleyError error){
      onError();
    }
  }
,getContext()));
}

Fixed version (ground truth):
public void setGif(String gifUrl){
  if (getWidth() == 0 || getHeight() == 0) {
    Logger.e(TAG,"String_Node_Str");
    return;
  }
  callback.setProgress(true);
  imageRequest=ChanApplication.getVolleyRequestQueue().add(new GIFRequest(gifUrl,new Response.Listener<GIFView>(){
    @Override public void onResponse(    GIFView view){
      view.setLayoutParams(Utils.MATCH_PARAMS);
      setView(view,false);
      callback.setProgress(false);
      thumbnailNeeded=false;
      tapDismiss=true;
    }
  }
,new Response.ErrorListener(){
    @Override public void onErrorResponse(    VolleyError error){
      onError();
    }
  }
,getContext()));
}
Program: 20472
Project: 20472
Buggy source:
public void setThumbnail(String thumbnailUrl){
  ChanApplication.getImageLoader().get(thumbnailUrl,new ImageListener(){
    @Override public void onErrorResponse(    VolleyError error){
      onError();
    }
    @Override public void onResponse(    ImageContainer response,    boolean isImmediate){
      if (response.getBitmap() != null && thumbnailNeeded) {
        ImageView thumbnail=new ImageView(getContext());
        thumbnail.setImageBitmap(response.getBitmap());
        thumbnail.setLayoutParams(Utils.MATCH_PARAMS);
        setView(thumbnail,false);
      }
    }
  }
,getWidth(),getHeight());
}

Fixed version (ground truth):
public void setThumbnail(String thumbnailUrl){
  if (getWidth() == 0 || getHeight() == 0) {
    Logger.e(TAG,"String_Node_Str");
    return;
  }
  ChanApplication.getImageLoader().get(thumbnailUrl,new ImageListener(){
    @Override public void onErrorResponse(    VolleyError error){
      onError();
    }
    @Override public void onResponse(    ImageContainer response,    boolean isImmediate){
      if (response.getBitmap() != null && thumbnailNeeded) {
        ImageView thumbnail=new ImageView(getContext());
        thumbnail.setImageBitmap(response.getBitmap());
        thumbnail.setLayoutParams(Utils.MATCH_PARAMS);
        setView(thumbnail,false);
      }
    }
  }
,getWidth(),getHeight());
}
Program: 20473
Project: 20473
Buggy source:
public void setBigImage(String imageUrl){
  callback.setProgress(true);
  imageContainerRequest=ChanApplication.getImageLoader().get(imageUrl,new ImageListener(){
    @Override public void onErrorResponse(    VolleyError error){
      onError();
    }
    @Override public void onResponse(    ImageContainer response,    boolean isImmediate){
      if (response.getBitmap() != null) {
        CleanupImageView image=new CleanupImageView(getContext());
        image.setImageBitmap(response.getBitmap());
        PhotoViewAttacher attacher=new PhotoViewAttacher(image);
        attacher.setOnViewTapListener(ThumbnailImageView.this);
        attacher.setMaximumScale(maxScale);
        image.setAttacher(attacher);
        setView(image,!isImmediate);
        callback.setProgress(false);
        thumbnailNeeded=false;
        tapDismiss=true;
      }
    }
  }
,(int)(getWidth() * maxScale),(int)(getHeight() * maxScale));
}

Fixed version (ground truth):
public void setBigImage(String imageUrl){
  if (getWidth() == 0 || getHeight() == 0) {
    Logger.e(TAG,"String_Node_Str");
    return;
  }
  callback.setProgress(true);
  int maxWidth=Math.min((int)(getWidth() * maxScale),4096);
  int maxHeight=Math.min((int)(getHeight() * maxScale),4096);
  imageContainerRequest=ChanApplication.getImageLoader().get(imageUrl,new ImageListener(){
    @Override public void onErrorResponse(    VolleyError error){
      onError();
    }
    @Override public void onResponse(    ImageContainer response,    boolean isImmediate){
      if (response.getBitmap() != null) {
        CleanupImageView image=new CleanupImageView(getContext());
        image.setImageBitmap(response.getBitmap());
        PhotoViewAttacher attacher=new PhotoViewAttacher(image);
        attacher.setOnViewTapListener(ThumbnailImageView.this);
        attacher.setMaximumScale(maxScale);
        image.setAttacher(attacher);
        setView(image,!isImmediate);
        callback.setProgress(false);
        thumbnailNeeded=false;
        tapDismiss=true;
      }
    }
  }
,maxWidth,maxHeight);
}
Program: 20474
Project: 20474
Buggy source:
/** 
 * Reads the contents of HttpEntity into a byte[]. 
 */
private byte[] entityToBytes(HttpEntity entity) throws IOException, ServerError {
  PoolingByteArrayOutputStream bytes=new PoolingByteArrayOutputStream(mPool,(int)entity.getContentLength());
  byte[] buffer=null;
  try {
    InputStream in=entity.getContent();
    if (in == null) {
      throw new ServerError();
    }
    buffer=mPool.getBuf(1024);
    int count;
    while ((count=in.read(buffer)) != -1) {
      bytes.write(buffer,0,count);
    }
    return bytes.toByteArray();
  }
  finally {
    try {
      entity.consumeContent();
    }
 catch (    IOException e) {
      VolleyLog.v("String_Node_Str");
    }
    mPool.returnBuf(buffer);
    bytes.close();
  }
}

Fixed version (ground truth):
/** 
 * Reads the contents of HttpEntity into a byte[]. 
 */
private byte[] entityToBytes(HttpEntity entity) throws IOException, ServerError {
  PoolingByteArrayOutputStream bytes=new PoolingByteArrayOutputStream(mPool,(int)entity.getContentLength());
  byte[] buffer=null;
  try {
    InputStream in=entity.getContent();
    if (in == null) {
      throw new ServerError();
    }
    buffer=mPool.getBuf(1024);
    int count;
    while ((count=in.read(buffer)) != -1) {
      bytes.write(buffer,0,count);
    }
    return bytes.toByteArray();
  }
 catch (  OutOfMemoryError e) {
    Logger.e("String_Node_Str","String_Node_Str",e);
    return new byte[0];
  }
 finally {
    try {
      entity.consumeContent();
    }
 catch (    IOException e) {
      VolleyLog.v("String_Node_Str");
    }
    mPool.returnBuf(buffer);
    bytes.close();
  }
}
Program: 20476
Project: 20476
Buggy source:
private View createThreadEndView(){
  if (false) {
    ThreadWatchCounterView view=new ThreadWatchCounterView(context);
    Utils.setPressedDrawable(view);
    view.init(threadManager,listView,this);
    int padding=context.getResources().getDimensionPixelSize(R.dimen.general_padding);
    view.setPadding(padding,padding,padding,padding);
    int height=context.getResources().getDimensionPixelSize(R.dimen.dp48);
    view.setHeight(height);
    view.setGravity(Gravity.CENTER);
    return view;
  }
 else {
    if (endOfLine) {
      TextView textView=new TextView(context);
      textView.setText(context.getString(R.string.thread_load_end_of_line));
      int padding=context.getResources().getDimensionPixelSize(R.dimen.general_padding);
      textView.setPadding(padding,padding,padding,padding);
      return textView;
    }
 else {
      return new ProgressBar(context);
    }
  }
}

Fixed version (ground truth):
private View createThreadEndView(){
  if (threadManager.getLoadable().isThreadMode()) {
    ThreadWatchCounterView view=new ThreadWatchCounterView(context);
    Utils.setPressedDrawable(view);
    view.init(threadManager,listView,this);
    int padding=context.getResources().getDimensionPixelSize(R.dimen.general_padding);
    view.setPadding(padding,padding,padding,padding);
    int height=context.getResources().getDimensionPixelSize(R.dimen.dp48);
    view.setHeight(height);
    view.setGravity(Gravity.CENTER);
    return view;
  }
 else {
    if (endOfLine) {
      TextView textView=new TextView(context);
      textView.setText(context.getString(R.string.thread_load_end_of_line));
      int padding=context.getResources().getDimensionPixelSize(R.dimen.general_padding);
      textView.setPadding(padding,padding,padding,padding);
      return textView;
    }
 else {
      return new ProgressBar(context);
    }
  }
}
Program: 20477
Project: 20477
Buggy source:
@Override public void onThreadLoaded(List<Post> posts){
  if (postAdapter == null) {
    listView=new ListView(baseActivity);
    postAdapter=new PostAdapter(baseActivity,threadManager,listView);
    listView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT));
    listView.setAdapter(postAdapter);
    listView.setSelectionFromTop(loadable.listViewIndex,loadable.listViewTop);
    if (threadManager.getLoadable().isThreadMode()) {
      listView.setOnScrollListener(new OnScrollListener(){
        @Override public void onScrollStateChanged(        AbsListView view,        int scrollState){
        }
        @Override public void onScroll(        AbsListView view,        int firstVisibleItem,        int visibleItemCount,        int totalItemCount){
          if (loadable != null) {
            loadable.listViewIndex=view.getFirstVisiblePosition();
            View v=view.getChildAt(0);
            loadable.listViewTop=(v == null) ? 0 : v.getTop();
          }
        }
      }
);
    }
    if (container != null) {
      container.setView(listView);
    }
  }
  if (loadable.isBoardMode()) {
    postAdapter.addList(posts);
  }
 else {
    postAdapter.setList(posts);
  }
}

Fixed version (ground truth):
@Override public void onThreadLoaded(List<Post> posts,boolean append){
  if (postAdapter == null) {
    listView=new ListView(baseActivity);
    postAdapter=new PostAdapter(baseActivity,threadManager,listView);
    listView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT));
    listView.setAdapter(postAdapter);
    listView.setSelectionFromTop(loadable.listViewIndex,loadable.listViewTop);
    if (threadManager.getLoadable().isThreadMode()) {
      listView.setOnScrollListener(new OnScrollListener(){
        @Override public void onScrollStateChanged(        AbsListView view,        int scrollState){
        }
        @Override public void onScroll(        AbsListView view,        int firstVisibleItem,        int visibleItemCount,        int totalItemCount){
          if (loadable != null) {
            loadable.listViewIndex=view.getFirstVisiblePosition();
            View v=view.getChildAt(0);
            loadable.listViewTop=(v == null) ? 0 : v.getTop();
          }
        }
      }
);
    }
    if (container != null) {
      container.setView(listView);
    }
  }
  if (append) {
    postAdapter.addList(posts);
  }
 else {
    postAdapter.setList(posts);
  }
}
Program: 20478
Project: 20478
Buggy source:
public void onData(List<Post> result);

Fixed version (ground truth):
public void onData(List<Post> result,boolean append);
Program: 20479
Project: 20479
Buggy source:
public void requestNextData(){
  if (loadable.isBoardMode()) {
    loadable.no++;
    if (request != null) {
      request.cancel();
    }
    request=getData(loadable);
  }
}

Fixed version (ground truth):
public void requestNextData(){
  if (loadable.isBoardMode()) {
    loadable.no++;
    if (request != null) {
      request.cancel();
    }
    request=getData(loadable);
  }
 else   if (loadable.isThreadMode()) {
    if (request != null) {
      return;
    }
    request=getData(loadable);
  }
}
Program: 20480
Project: 20480
Buggy source:
public void release(Loader loader,Loader.LoaderListener listener){
  if (!loaders.containsValue(loader)) {
    throw new RuntimeException("String_Node_Str");
  }
  if (loader.removeListener(listener)) {
    loaders.remove(loader);
  }
}

Fixed version (ground truth):
public void release(Loader loader,Loader.LoaderListener listener){
  if (!loaders.containsValue(loader)) {
    throw new RuntimeException("String_Node_Str");
  }
  if (loader.removeListener(listener)) {
    loaders.remove(loader.getLoadable());
  }
}
Program: 20481
Project: 20481
Buggy source:
@Override public void onData(List<Post> result){
  threadManagerListener.onThreadLoaded(result);
}

Fixed version (ground truth):
@Override public void onData(List<Post> result,boolean append){
  threadManagerListener.onThreadLoaded(result,append);
}
Program: 20482
Project: 20482
Buggy source:
public void onThreadLoaded(List<Post> result);

Fixed version (ground truth):
public void onThreadLoaded(List<Post> result,boolean append);
Program: 20483
Project: 20483
Buggy source:
@Override public void onData(List<Post> result){
  int count=result.size();
  Logger.test("String_Node_Str");
  Logger.test("String_Node_Str" + count);
  if (pin.watchLastCount <= 0) {
    pin.watchLastCount=pin.watchNewCount;
  }
  pin.watchNewCount=count;
  watchLogic.onLoaded(count,false);
  Logger.test("String_Node_Str" + (System.currentTimeMillis() - startTime) + "String_Node_Str");
  PinnedService.callOnPinsChanged();
}

Fixed version (ground truth):
@Override public void onData(List<Post> result,boolean append){
  int count=result.size();
  Logger.test("String_Node_Str");
  Logger.test("String_Node_Str" + count);
  if (pin.watchLastCount <= 0) {
    pin.watchLastCount=pin.watchNewCount;
  }
  pin.watchNewCount=count;
  watchLogic.onLoaded(count,false);
  Logger.test("String_Node_Str" + (System.currentTimeMillis() - startTime) + "String_Node_Str");
  PinnedService.callOnPinsChanged();
}
Program: 20485
Project: 20485
Buggy source:
/** 
 * Sets the superstate that the configured state is a substate of <p/> Substates inherit the allowed transitions of their superstate. When entering directly into a substate from outside of the superstate, entry actions for the superstate are executed. Likewise when leaving from the substate to outside the supserstate, exit actions for the superstate will execute.
 * @param superstate The superstate
 * @return The receiver
 */
public StateConfiguration<TState,TTrigger> substateOf(TState superstate){
  StateRepresentation<TState,TTrigger> superRepresentation=lookup.call(superstate);
  representation.setSuperstate(superRepresentation);
  superRepresentation.addSubstate(representation);
  return this;
}

Fixed version (ground truth):
/** 
 * Sets the superstate that the configured state is a substate of <p> Substates inherit the allowed transitions of their superstate. When entering directly into a substate from outside of the superstate, entry actions for the superstate are executed. Likewise when leaving from the substate to outside the supserstate, exit actions for the superstate will execute.
 * @param superstate The superstate
 * @return The receiver
 */
public StateConfiguration<TState,TTrigger> substateOf(TState superstate){
  StateRepresentation<TState,TTrigger> superRepresentation=lookup.call(superstate);
  representation.setSuperstate(superRepresentation);
  superRepresentation.addSubstate(representation);
  return this;
}
Program: 20486
Project: 20486
Buggy source:
/** 
 * Accept the specified trigger, execute exit actions and re-execute entry actions. Reentry behaves as though the configured state transitions to an identical sibling state <p/> Applies to the current state only. Will not re-execute superstate actions, or  cause actions to execute transitioning between super- and sub-states
 * @param trigger The accepted trigger
 * @param guard   Function that must return true in order for the trigger to be accepted
 * @return The reciever
 */
public StateConfiguration<TState,TTrigger> permitReentryIf(TTrigger trigger,FuncBoolean guard){
  return publicPermitIf(trigger,representation.getUnderlyingState(),guard);
}

Fixed version (ground truth):
/** 
 * Accept the specified trigger, execute exit actions and re-execute entry actions. Reentry behaves as though the configured state transitions to an identical sibling state <p> Applies to the current state only. Will not re-execute superstate actions, or  cause actions to execute transitioning between super- and sub-states
 * @param trigger The accepted trigger
 * @param guard   Function that must return true in order for the trigger to be accepted
 * @return The reciever
 */
public StateConfiguration<TState,TTrigger> permitReentryIf(TTrigger trigger,FuncBoolean guard){
  return publicPermitIf(trigger,representation.getUnderlyingState(),guard);
}
Program: 20487
Project: 20487
Buggy source:
/** 
 * Accept the specified trigger, execute exit actions and re-execute entry actions. Reentry behaves as though the configured state transitions to an identical sibling state <p/> Applies to the current state only. Will not re-execute superstate actions, or  cause actions to execute transitioning between super- and sub-states
 * @param trigger The accepted trigger
 * @return The reciever
 */
public StateConfiguration<TState,TTrigger> permitReentry(TTrigger trigger){
  return publicPermit(trigger,representation.getUnderlyingState());
}

Fixed version (ground truth):
/** 
 * Accept the specified trigger, execute exit actions and re-execute entry actions. Reentry behaves as though the configured state transitions to an identical sibling state <p> Applies to the current state only. Will not re-execute superstate actions, or  cause actions to execute transitioning between super- and sub-states
 * @param trigger The accepted trigger
 * @return The reciever
 */
public StateConfiguration<TState,TTrigger> permitReentry(TTrigger trigger){
  return publicPermit(trigger,representation.getUnderlyingState());
}
Program: 20488
Project: 20488
Buggy source:
private void saveTriggerConfiguration(TriggerWithParameters<TState,TTrigger> trigger){
  if (triggerConfiguration.containsKey(trigger.getTrigger())) {
    throw new IllegalStateException(String.format("String_Node_Str",trigger));
  }
  triggerConfiguration.put(trigger.getTrigger(),trigger);
}

Fixed version (ground truth):
private void saveTriggerConfiguration(TriggerWithParameters<TState,TTrigger> trigger){
  if (triggerConfiguration.containsKey(trigger.getTrigger())) {
    throw new IllegalStateException("String_Node_Str" + trigger + "String_Node_Str");
  }
  triggerConfiguration.put(trigger.getTrigger(),trigger);
}
Program: 20489
Project: 20489
Buggy source:
public void generateDotFileInto(OutputStream dotFile){
  try (OutputStreamWriter w=new OutputStreamWriter(dotFile,"String_Node_Str")){
    PrintWriter writer=new PrintWriter(w);
    writer.write("String_Node_Str");
    for (    Entry<TState,StateRepresentation<TState,TTrigger>> entry : this.stateConfiguration.entrySet()) {
      Map<TTrigger,List<TriggerBehaviour<TState,TTrigger>>> behaviours=entry.getValue().getTriggerBehaviours();
      for (      Entry<TTrigger,List<TriggerBehaviour<TState,TTrigger>>> behaviour : behaviours.entrySet()) {
        for (        TriggerBehaviour<TState,TTrigger> triggerBehaviour : behaviour.getValue()) {
          if (triggerBehaviour instanceof TransitioningTriggerBehaviour) {
            writer.write(String.format("String_Node_Str",entry.getKey(),triggerBehaviour.resultsInTransitionFrom(null)));
          }
        }
      }
    }
    writer.write("String_Node_Str");
  }
 catch (  IOException ie) {
  }
}

Fixed version (ground truth):
public void generateDotFileInto(final OutputStream dotFile) throws IOException {
  try (OutputStreamWriter w=new OutputStreamWriter(dotFile,"String_Node_Str")){
    PrintWriter writer=new PrintWriter(w);
    writer.write("String_Node_Str");
    OutVar<TState> destination=new OutVar<>();
    for (    Entry<TState,StateRepresentation<TState,TTrigger>> entry : this.stateConfiguration.entrySet()) {
      Map<TTrigger,List<TriggerBehaviour<TState,TTrigger>>> behaviours=entry.getValue().getTriggerBehaviours();
      for (      Entry<TTrigger,List<TriggerBehaviour<TState,TTrigger>>> behaviour : behaviours.entrySet()) {
        for (        TriggerBehaviour<TState,TTrigger> triggerBehaviour : behaviour.getValue()) {
          if (triggerBehaviour instanceof TransitioningTriggerBehaviour) {
            destination.set(null);
            triggerBehaviour.resultsInTransitionFrom(null,null,destination);
            writer.write(String.format("String_Node_Str",entry.getKey(),destination));
          }
        }
      }
    }
    writer.write("String_Node_Str");
  }
 catch (  IOException ex) {
    throw ex;
  }
}
Program: 20490
Project: 20490
Buggy source:
protected void publicFire(TTrigger trigger,Object... args){
  TriggerWithParameters<TState,TTrigger> configuration;
  if (triggerConfiguration.containsKey(trigger)) {
    configuration=triggerConfiguration.get(trigger);
    configuration.validateParameters(args);
  }
  TriggerBehaviour<TState,TTrigger> triggerBehaviour;
  try {
    triggerBehaviour=getCurrentRepresentation().tryFindHandler(trigger);
  }
 catch (  Exception e) {
    unhandledTriggerAction.doIt(getCurrentRepresentation().getUnderlyingState(),trigger);
    return;
  }
  TState source=getState();
  TState destination;
  try {
    destination=triggerBehaviour.resultsInTransitionFrom(source,args);
    Transition<TState,TTrigger> transition=new Transition<>(source,destination,trigger);
    getCurrentRepresentation().exit(transition);
    setState(destination);
    getCurrentRepresentation().enter(transition,args);
  }
 catch (  Exception e) {
  }
}

Fixed version (ground truth):
protected void publicFire(TTrigger trigger,Object... args){
  TriggerWithParameters<TState,TTrigger> configuration=triggerConfiguration.get(trigger);
  if (configuration != null) {
    configuration.validateParameters(args);
  }
  TriggerBehaviour<TState,TTrigger> triggerBehaviour=getCurrentRepresentation().tryFindHandler(trigger);
  if (triggerBehaviour == null) {
    unhandledTriggerAction.doIt(getCurrentRepresentation().getUnderlyingState(),trigger);
    return;
  }
  TState source=getState();
  OutVar<TState> destination=new OutVar<>();
  if (triggerBehaviour.resultsInTransitionFrom(source,args,destination)) {
    Transition<TState,TTrigger> transition=new Transition<>(source,destination.get(),trigger);
    getCurrentRepresentation().exit(transition);
    setState(destination.get());
    getCurrentRepresentation().enter(transition,args);
  }
}
Program: 20491
Project: 20491
Buggy source:
/** 
 * A human-readable representation of the state machine
 * @return A description of the current state and permitted triggers
 */
public String toString(){
  List<TTrigger> permittedTriggers=getPermittedTriggers();
  List<String> parameters=new ArrayList<>();
  for (  TTrigger tTrigger : permittedTriggers) {
    parameters.add(tTrigger.toString());
  }
  StringBuilder params=new StringBuilder();
  String delim="String_Node_Str";
  for (  String param : parameters) {
    params.append(delim);
    params.append(param);
    delim="String_Node_Str";
  }
  return String.format("String_Node_Str",getState(),params.toString());
}

Fixed version (ground truth):
/** 
 * A human-readable representation of the state machine
 * @return A description of the current state and permitted triggers
 */
@Override public String toString(){
  List<TTrigger> permittedTriggers=getPermittedTriggers();
  List<String> parameters=new ArrayList<>();
  for (  TTrigger tTrigger : permittedTriggers) {
    parameters.add(tTrigger.toString());
  }
  StringBuilder params=new StringBuilder();
  String delim="String_Node_Str";
  for (  String param : parameters) {
    params.append(delim);
    params.append(param);
    delim="String_Node_Str";
  }
  return String.format("String_Node_Str",getState(),params.toString());
}
Program: 20492
Project: 20492
Buggy source:
protected StateRepresentation<TState,TTrigger> getRepresentation(TState state){
  if (!stateConfiguration.containsKey(state)) {
    StateRepresentation<TState,TTrigger> result=new StateRepresentation<>(state);
    stateConfiguration.put(state,result);
  }
  return stateConfiguration.get(state);
}

Fixed version (ground truth):
protected StateRepresentation<TState,TTrigger> getRepresentation(TState state){
  StateRepresentation<TState,TTrigger> result=stateConfiguration.get(state);
  if (result == null) {
    result=new StateRepresentation<>(state);
    stateConfiguration.put(state,result);
  }
  return result;
}
Program: 20493
Project: 20493
Buggy source:
public TState resultsInTransitionFrom(TState source,Object... args){
  return destination;
}

Fixed version (ground truth):
@Override public boolean resultsInTransitionFrom(TState source,Object[] args,OutVar<TState> dest){
  dest.set(destination);
  return true;
}
Program: 20494
Project: 20494
Buggy source:
@Override public TState resultsInTransitionFrom(TState source,Object... args){
  return destination.call(args);
}

Fixed version (ground truth):
public boolean resultsInTransitionFrom(TState source,Object[] args,OutVar<TState> dest){
  dest.set(destination.call(args));
  return true;
}
Program: 20495
Project: 20495
Buggy source:
@Override public TState resultsInTransitionFrom(TState source,Object... args){
  throw new IllegalStateException();
}

Fixed version (ground truth):
@Override public boolean resultsInTransitionFrom(TState source,Object[] args,OutVar<TState> dest){
  return false;
}
Program: 20496
Project: 20496
Buggy source:
public abstract TState resultsInTransitionFrom(TState source,Object... args);

Fixed version (ground truth):
public abstract boolean resultsInTransitionFrom(TState source,Object[] args,OutVar<TState> dest);
Program: 20497
Project: 20497
Buggy source:
StateConfiguration<TState,TTrigger> publicPermitDynamicIf(TTrigger trigger,Func2<Object[],TState> destinationStateSelector,Func<Boolean> guard){
}

Fixed version (ground truth):
StateConfiguration<TState,TTrigger> publicPermitDynamicIf(TTrigger trigger,Func2<Object[],TState> destinationStateSelector,FuncBoolean guard){
}
Program: 20498
Project: 20498
Buggy source:
StateConfiguration<TState,TTrigger> publicPermitIf(TTrigger trigger,TState destinationState,Func<Boolean> guard){
}

Fixed version (ground truth):
StateConfiguration<TState,TTrigger> publicPermitIf(TTrigger trigger,TState destinationState,FuncBoolean guard){
}
Program: 20499
Project: 20499
Buggy source:
/** 
 * ignore the specified trigger when in the configured state, if the guard returns true
 * @param trigger The trigger to ignore
 * @param guard   Function that must return true in order for the trigger to be ignored
 * @return The receiver
 */
public StateConfiguration<TState,TTrigger> ignoreIf(TTrigger trigger,Func<Boolean> guard){
}

Fixed version (ground truth):
/** 
 * ignore the specified trigger when in the configured state, if the guard returns true
 * @param trigger The trigger to ignore
 * @param guard   Function that must return true in order for the trigger to be ignored
 * @return The receiver
 */
public StateConfiguration<TState,TTrigger> ignoreIf(TTrigger trigger,FuncBoolean guard){
}
Program: 20500
Project: 20500
Buggy source:
public <TArg0,TArg1,TArg2>StateConfiguration<TState,TTrigger> permitDynamicIf(TriggerWithParameters3<TArg0,TArg1,TArg2,TState,TTrigger> trigger,final Func4<TArg0,TArg1,TArg2,TState> destinationStateSelector,Func<Boolean> guard){
}

Fixed version (ground truth):
/** 
 * Accept the specified trigger and transition to the destination state, calculated dynamically by the supplied function
 * @param trigger                  The accepted trigger
 * @param destinationStateSelector Function to calculate the state that the trigger will cause a transition to
 * @param guard                    Function that must return true in order for the  trigger to be accepted
 * @param < TArg0 >                  Type of the first trigger argument
 * @param < TArg1 >                  Type of the second trigger argument
 * @param < TArg2 >                  Type of the third trigger argument
 * @return The reciever
 */
public <TArg0,TArg1,TArg2>StateConfiguration<TState,TTrigger> permitDynamicIf(TriggerWithParameters3<TArg0,TArg1,TArg2,TState,TTrigger> trigger,final Func4<TArg0,TArg1,TArg2,TState> destinationStateSelector,FuncBoolean guard){
}
Program: 20501
Project: 20501
Buggy source:
/** 
 * Specify an action that will execute when transitioning from the configured state
 * @param exitAction Action to execute
 * @return The receiver
 */
public StateConfiguration<TState,TTrigger> onExit(Action1<Transition<TState,TTrigger>> exitAction){
  Enforce.argumentNotNull(exitAction,"String_Node_Str");
  representation.addExitAction(exitAction);
  return this;
}

Fixed version (ground truth):
/** 
 * Specify an action that will execute when transitioning from the configured state
 * @param exitAction Action to execute
 * @return The receiver
 */
public StateConfiguration<TState,TTrigger> onExit(Action1<Transition<TState,TTrigger>> exitAction){
}
Program: 20502
Project: 20502
Buggy source:
StateConfiguration<TState,TTrigger> publicPermitDynamicIf(TTrigger trigger,Func2<Object[],TState> destinationStateSelector,FuncBoolean guard){
  Enforce.argumentNotNull(destinationStateSelector,"String_Node_Str");
  Enforce.argumentNotNull(guard,"String_Node_Str");
  representation.addTriggerBehaviour(new DynamicTriggerBehaviour<>(trigger,destinationStateSelector,guard));
  return this;
}

Fixed version (ground truth):
StateConfiguration<TState,TTrigger> publicPermitDynamicIf(TTrigger trigger,Func2<Object[],TState> destinationStateSelector,Func<Boolean> guard){
}
Program: 20503
Project: 20503
Buggy source:
StateConfiguration<TState,TTrigger> publicPermitIf(TTrigger trigger,TState destinationState,FuncBoolean guard){
  Enforce.argumentNotNull(guard,"String_Node_Str");
  representation.addTriggerBehaviour(new TransitioningTriggerBehaviour<>(trigger,destinationState,guard));
  return this;
}

Fixed version (ground truth):
StateConfiguration<TState,TTrigger> publicPermitIf(TTrigger trigger,TState destinationState,Func<Boolean> guard){
}
Program: 20504
Project: 20504
Buggy source:
public StateConfiguration(StateRepresentation<TState,TTrigger> representation,Func2<TState,StateRepresentation<TState,TTrigger>> lookup){
  this.representation=Enforce.argumentNotNull(representation,"String_Node_Str");
  this.lookup=Enforce.argumentNotNull(lookup,"String_Node_Str");
}

Fixed version (ground truth):
public StateConfiguration(final StateRepresentation<TState,TTrigger> representation,final Func2<TState,StateRepresentation<TState,TTrigger>> lookup){
}
Program: 20505
Project: 20505
Buggy source:
/** 
 * ignore the specified trigger when in the configured state, if the guard returns true
 * @param trigger The trigger to ignore
 * @param guard   Function that must return true in order for the trigger to be ignored
 * @return The receiver
 */
public StateConfiguration<TState,TTrigger> ignoreIf(TTrigger trigger,FuncBoolean guard){
  Enforce.argumentNotNull(guard,"String_Node_Str");
  representation.addTriggerBehaviour(new IgnoredTriggerBehaviour<TState,TTrigger>(trigger,guard));
  return this;
}

Fixed version (ground truth):
/** 
 * ignore the specified trigger when in the configured state, if the guard returns true
 * @param trigger The trigger to ignore
 * @param guard   Function that must return true in order for the trigger to be ignored
 * @return The receiver
 */
public StateConfiguration<TState,TTrigger> ignoreIf(TTrigger trigger,Func<Boolean> guard){
}
Program: 20506
Project: 20506
Buggy source:
/** 
 * Specify an action that will execute when transitioning into the configured state
 * @param trigger     The trigger by which the state must be entered in order for the action to execute
 * @param entryAction Action to execute, providing details of the transition
 * @param classe0     Class argument
 * @param classe1     Class argument
 * @param classe2     Class argument
 * @param < TArg0 >     Type of the first trigger argument
 * @param < TArg1 >     Type of the second trigger argument
 * @param < TArg2 >     Type of the third trigger argument
 * @return The receiver
 */
public <TArg0,TArg1,TArg2>StateConfiguration<TState,TTrigger> onEntryFrom(TriggerWithParameters3<TArg0,TArg1,TArg2,TState,TTrigger> trigger,final Action4<TArg0,TArg1,TArg2,Transition<TState,TTrigger>> entryAction,final Class<TArg0> classe0,final Class<TArg1> classe1,final Class<TArg2> classe2){
  Enforce.argumentNotNull(entryAction,"String_Node_Str");
  Enforce.argumentNotNull(trigger,"String_Node_Str");
  representation.addEntryAction(trigger.getTrigger(),new Action2<Transition<TState,TTrigger>,Object[]>(){
    @SuppressWarnings("String_Node_Str") public void doIt(    Transition<TState,TTrigger> t,    Object[] args){
      entryAction.doIt((TArg0)args[0],(TArg1)args[1],(TArg2)args[2],t);
    }
  }
);
  return this;
}

Fixed version (ground truth):
/** 
 * Specify an action that will execute when transitioning into the configured state
 * @param trigger     The trigger by which the state must be entered in order for the action to execute
 * @param entryAction Action to execute, providing details of the transition
 * @param classe0     Class argument
 * @param classe1     Class argument
 * @param classe2     Class argument
 * @param < TArg0 >     Type of the first trigger argument
 * @param < TArg1 >     Type of the second trigger argument
 * @param < TArg2 >     Type of the third trigger argument
 * @return The receiver
 */
public <TArg0,TArg1,TArg2>StateConfiguration<TState,TTrigger> onEntryFrom(TriggerWithParameters3<TArg0,TArg1,TArg2,TState,TTrigger> trigger,final Action4<TArg0,TArg1,TArg2,Transition<TState,TTrigger>> entryAction,final Class<TArg0> classe0,final Class<TArg1> classe1,final Class<TArg2> classe2){
}
Program: 20507
Project: 20507
Buggy source:
/** 
 * Accept the specified trigger and transition to the destination state, calculated dynamically by the supplied function
 * @param trigger                  The accepted trigger
 * @param destinationStateSelector Function to calculate the state that the trigger will cause a transition to
 * @param guard                    Function that must return true in order for the  trigger to be accepted
 * @param < TArg0 >                  Type of the first trigger argument
 * @param < TArg1 >                  Type of the second trigger argument
 * @param < TArg2 >                  Type of the third trigger argument
 * @return The reciever
 */
public <TArg0,TArg1,TArg2>StateConfiguration<TState,TTrigger> permitDynamicIf(TriggerWithParameters3<TArg0,TArg1,TArg2,TState,TTrigger> trigger,final Func4<TArg0,TArg1,TArg2,TState> destinationStateSelector,FuncBoolean guard){
  Enforce.argumentNotNull(trigger,"String_Node_Str");
  Enforce.argumentNotNull(destinationStateSelector,"String_Node_Str");
  return publicPermitDynamicIf(trigger.getTrigger(),new Func2<Object[],TState>(){
    @SuppressWarnings("String_Node_Str") public TState call(    Object[] args){
      return destinationStateSelector.call((TArg0)args[0],(TArg1)args[1],(TArg2)args[2]);
    }
  }
,guard);
}

Fixed version (ground truth):
public <TArg0,TArg1,TArg2>StateConfiguration<TState,TTrigger> permitDynamicIf(TriggerWithParameters3<TArg0,TArg1,TArg2,TState,TTrigger> trigger,final Func4<TArg0,TArg1,TArg2,TState> destinationStateSelector,Func<Boolean> guard){
}
Program: 20508
Project: 20508
Buggy source:
/** 
 * Specify an action that will execute when transitioning into the configured state
 * @param entryAction Action to execute, providing details of the transition
 * @return The receiver
 */
public StateConfiguration<TState,TTrigger> onEntry(final Action1<Transition<TState,TTrigger>> entryAction){
  Enforce.argumentNotNull(entryAction,"String_Node_Str");
  representation.addEntryAction(new Action2<Transition<TState,TTrigger>,Object[]>(){
    public void doIt(    Transition<TState,TTrigger> arg1,    Object[] arg2){
      entryAction.doIt(arg1);
    }
  }
);
  return this;
}

Fixed version (ground truth):
/** 
 * Specify an action that will execute when transitioning into the configured state
 * @param entryAction Action to execute, providing details of the transition
 * @return The receiver
 */
public StateConfiguration<TState,TTrigger> onEntry(final Action1<Transition<TState,TTrigger>> entryAction){
}
Program: 20509
Project: 20509
Buggy source:
/** 
 * Transition from the current state via the specified trigger. The target state is determined by the configuration of the current state. Actions associated with leaving the current state and entering the new one will be invoked.
 * @param trigger The trigger to fire
 * @param arg0    The first argument
 * @param arg1    The second argument
 * @param arg2    The third argument
 * @param < TArg0 > Type of the first trigger argument
 * @param < TArg1 > Type of the second trigger argument
 * @param < TArg2 > Type of the third trigger argument
 * @The current state does not allow the trigger to be fired
 */
public <TArg0,TArg1,TArg2>void fire(TriggerWithParameters3<TArg0,TArg1,TArg2,TState,TTrigger> trigger,TArg0 arg0,TArg1 arg1,TArg2 arg2){
  Enforce.argumentNotNull(trigger,"String_Node_Str");
  publicFire(trigger.getTrigger(),arg0,arg1,arg2);
}

Fixed version (ground truth):
/** 
 * Transition from the current state via the specified trigger. The target state is determined by the configuration of the current state. Actions associated with leaving the current state and entering the new one will be invoked.
 * @param trigger The trigger to fire
 * @param arg0    The first argument
 * @param arg1    The second argument
 * @param arg2    The third argument
 * @param < TArg0 > Type of the first trigger argument
 * @param < TArg1 > Type of the second trigger argument
 * @param < TArg2 > Type of the third trigger argument
 * @The current state does not allow the trigger to be fired
 */
public <TArg0,TArg1,TArg2>void fire(TriggerWithParameters3<TArg0,TArg1,TArg2,TState,TTrigger> trigger,TArg0 arg0,TArg1 arg1,TArg2 arg2){
}
Program: 20510
Project: 20510
Buggy source:
@SuppressWarnings("String_Node_Str") public List<TTrigger> getPermittedTriggers() throws Exception {
  List<TTrigger> result=new ArrayList<>();
  for (  TTrigger t : triggerBehaviours.keySet()) {
    Boolean isOk=false;
    for (    TriggerBehaviour<TState,TTrigger> v : triggerBehaviours.get(t)) {
      if (v.isGuardConditionMet()) {
        isOk=true;
      }
    }
    if (isOk) {
      result.add(t);
    }
  }
  if (getSuperstate() != null) {
    result.addAll(getSuperstate().getPermittedTriggers());
  }
  return result;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public List<TTrigger> getPermittedTriggers() throws Exception {
  Set<TTrigger> result=new HashSet<>();
  for (  TTrigger t : triggerBehaviours.keySet()) {
    boolean isOk=false;
    for (    TriggerBehaviour<TState,TTrigger> v : triggerBehaviours.get(t)) {
      if (v.isGuardConditionMet()) {
        isOk=true;
      }
    }
    if (isOk) {
      result.add(t);
    }
  }
  if (getSuperstate() != null) {
    result.addAll(getSuperstate().getPermittedTriggers());
  }
  return new ArrayList<>(result);
}
Program: 20511
Project: 20511
Buggy source:
@Test public void PermittedTriggersAreDistinctValues() throws Exception {
  StateMachine<State,Trigger> sm=new StateMachine<State,Trigger>(State.B);
  sm.configure(State.B).substateOf(State.C).permit(Trigger.X,State.A);
  sm.configure(State.C).permit(Trigger.X,State.B);
  List<Trigger> permitted=sm.getPermittedTriggers();
  assertEquals(1,permitted.size());
  assertEquals(Trigger.X,permitted.get(0));
}

Fixed version (ground truth):
@Test public void PermittedTriggersAreDistinctValues() throws Exception {
  StateMachine<State,Trigger> sm=new StateMachine<>(State.B);
  sm.configure(State.B).substateOf(State.C).permit(Trigger.X,State.A);
  sm.configure(State.C).permit(Trigger.X,State.B);
  List<Trigger> permitted=sm.getPermittedTriggers();
  assertEquals(1,permitted.size());
  assertEquals(Trigger.X,permitted.get(0));
}
Program: 20512
Project: 20512
Buggy source:
private static Cursor getCursorForConstruction(final Context context,final long contactId,final int queryType){
  final Cursor cursor;
  if (queryType == QUERY_TYPE_EMAIL)   cursor=context.getContentResolver().query(Queries.EMAIL.getContentUri(),Queries.EMAIL.getProjection(),Queries.EMAIL.getProjection()[Queries.Query.CONTACT_ID] + "String_Node_Str",new String[]{String.valueOf(contactId)},null);
 else   cursor=context.getContentResolver().query(Queries.PHONE.getContentUri(),Queries.PHONE.getProjection(),Queries.PHONE.getProjection()[Queries.Query.CONTACT_ID] + "String_Node_Str",new String[]{String.valueOf(contactId)},null);
  return removeDuplicateDestinations(cursor);
}

Fixed version (ground truth):
protected static Cursor getCursorForConstruction(final Context context,final long contactId,final int queryType){
  final Cursor cursor;
  if (queryType == QUERY_TYPE_EMAIL)   cursor=context.getContentResolver().query(Queries.EMAIL.getContentUri(),Queries.EMAIL.getProjection(),Queries.EMAIL.getProjection()[Queries.Query.CONTACT_ID] + "String_Node_Str",new String[]{String.valueOf(contactId)},null);
 else   cursor=context.getContentResolver().query(Queries.PHONE.getContentUri(),Queries.PHONE.getProjection(),Queries.PHONE.getProjection()[Queries.Query.CONTACT_ID] + "String_Node_Str",new String[]{String.valueOf(contactId)},null);
  return removeDuplicateDestinations(cursor);
}
Program: 20513
Project: 20513
Buggy source:
public RecipientAlternatesAdapter(final Context context,final long contactId,final long currentId,final int queryMode,final OnCheckedItemChangedListener listener){
  super(context,getCursorForConstruction(context,contactId,queryMode),0);
  mLayoutInflater=LayoutInflater.from(context);
  mCurrentId=currentId;
  mCheckedItemChangedListener=listener;
  if (queryMode == QUERY_TYPE_EMAIL)   mQuery=Queries.EMAIL;
 else   if (queryMode == QUERY_TYPE_PHONE)   mQuery=Queries.PHONE;
 else {
    mQuery=Queries.EMAIL;
    Log.e(TAG,"String_Node_Str" + queryMode);
  }
}

Fixed version (ground truth):
public RecipientAlternatesAdapter(final Context context,final Cursor c,final long currentId,final int queryMode,final OnCheckedItemChangedListener listener){
  super(context,c,0);
  mLayoutInflater=LayoutInflater.from(context);
  mCurrentId=currentId;
  mCheckedItemChangedListener=listener;
  if (queryMode == QUERY_TYPE_EMAIL)   mQuery=Queries.EMAIL;
 else   if (queryMode == QUERY_TYPE_PHONE)   mQuery=Queries.PHONE;
 else {
    mQuery=Queries.EMAIL;
    Log.e(TAG,"String_Node_Str" + queryMode);
  }
}
Program: 20514
Project: 20514
Buggy source:
private void shrink(){
  if (mTokenizer == null)   return;
  final long contactId=mSelectedChip != null ? mSelectedChip.getEntry().getContactId() : -1;
  if (mSelectedChip != null && contactId != RecipientEntry.INVALID_CONTACT && !isPhoneQuery() && contactId != RecipientEntry.GENERATED_CONTACT)   clearSelectedChip();
 else {
    if (getWidth() <= 0) {
      mHandler.removeCallbacks(mDelayedShrink);
      mHandler.post(mDelayedShrink);
      return;
    }
    if (mPendingChipsCount > 0)     postHandlePendingChips();
 else {
      final Editable editable=getText();
      final int end=getSelectionEnd();
      final int start=mTokenizer.findTokenStart(editable,end);
      final DrawableRecipientChip[] chips=getSpannable().getSpans(start,end,DrawableRecipientChip.class);
      if (chips == null || chips.length == 0) {
        final Editable text=getText();
        int whatEnd=mTokenizer.findTokenEnd(text,start);
        if (whatEnd < text.length() && text.charAt(whatEnd) == ',')         whatEnd=movePastTerminators(whatEnd);
        final int selEnd=getSelectionEnd();
        if (whatEnd != selEnd)         handleEdit(start,whatEnd);
 else         commitChip(start,end,editable);
      }
    }
    mHandler.post(mAddTextWatcher);
  }
  createMoreChip();
}

Fixed version (ground truth):
private void shrink(){
  if (mTokenizer == null)   return;
  final long contactId=mSelectedChip != null ? mSelectedChip.getEntry().getContactId() : -1;
  if (mSelectedChip != null && contactId != RecipientEntry.INVALID_CONTACT && !isPhoneQuery() && contactId != RecipientEntry.GENERATED_CONTACT)   clearSelectedChip();
 else {
    if (getWidth() <= 0) {
      mHandler.removeCallbacks(mDelayedShrink);
      mHandler.post(mDelayedShrink);
      return;
    }
    if (mPendingChipsCount > 0)     postHandlePendingChips();
 else {
      final Editable editable=getText();
      final int end=getSelectionEnd();
      final int start=mTokenizer.findTokenStart(editable,end);
      final DrawableRecipientChip[] chips=getSpannable().getSpans(start,end,DrawableRecipientChip.class);
      if (chips == null || chips.length == 0 && start >= 0) {
        final Editable text=getText();
        int whatEnd=mTokenizer.findTokenEnd(text,start);
        if (whatEnd < text.length() && text.charAt(whatEnd) == ',')         whatEnd=movePastTerminators(whatEnd);
        final int selEnd=getSelectionEnd();
        if (whatEnd != selEnd)         handleEdit(start,whatEnd);
 else         commitChip(start,end,editable);
      }
    }
    mHandler.post(mAddTextWatcher);
  }
  createMoreChip();
}
Program: 20515
Project: 20515
Buggy source:
private void handleMethodConsumer(MethodSpec.Builder methodSpec,Multimap<String,String> ramlTypeToMediaType,GType typeDeclaration){
  Collection<String> mediaTypes=ramlTypeToMediaType.get(typeDeclaration == null ? null : typeDeclaration.name());
  AnnotationSpec.Builder ann=buildAnnotation(mediaTypes,Consumes.class);
  methodSpec.addAnnotation(ann.build());
}

Fixed version (ground truth):
private void handleMethodConsumer(MethodSpec.Builder methodSpec,Multimap<String,String> ramlTypeToMediaType,GType typeDeclaration){
  Collection<String> mediaTypes=ramlTypeToMediaType.get(typeDeclaration == null ? null : typeDeclaration.name());
  if (mediaTypes.size() > 0) {
    AnnotationSpec.Builder ann=buildAnnotation(mediaTypes,Consumes.class);
    methodSpec.addAnnotation(ann.build());
  }
}