Program: 27657
Project: 27657
Buggy source:
/** 
 * <p>This method demonstrates the use of the <em>cancellable</em> argument for an injection. Specifying that an injection is <em>cancellable</em> allows us to supply our own return values and short-circuit the target method's normal logic.</p> <p>Choosing the appropriate   {@link At} is very important when dealing with cancellable callbacks. For example you may with to be able to"short-circuit" a method by injecting at the HEAD and cancelling it if you don't want the method to be executed. However if you want the method to execute but be able to change the result, then injecting at RETURN makes more sense. Injecting at RETURN also allows you to see the value the method was going to return and optionally change it. The  {@link CallbackInfoReturnable#getReturnValue} method can be used to get the returnvalue from the stack, but <b>only</b> when using the RETURN injection point.</p> <p>It should be noted that it's perfectly possible to specify <em>cancellable</em> when injecting into a method which returns void, but with the key difference being that it's not possible to fetch the return value (because there isn't one) or set a return value (because there isn't one!) but it is still perfectly possible to short-circuit a method in this way.</p> 
 */
@Inject(method="String_Node_Str",at=@At("String_Node_Str"),cancellable=true) public void onCanCoordinateBeSpawn(int x,int z,CallbackInfoReturnable<Boolean> cir){
  int coordinateWeDontLike=666;
  if (x == coordinateWeDontLike || z == coordinateWeDontLike) {
    if (cir.getReturnValue()) {
      System.err.println("String_Node_Str" + this + "String_Node_Str"+ x+ "String_Node_Str"+ z+ "String_Node_Str");
    }
    cir.setReturnValue(false);
  }
}

Fixed version (ground truth):
/** 
 * <p>This method demonstrates the use of the <em>cancellable</em> argument for an injection. Specifying that an injection is <em>cancellable</em> allows us to supply our own return values and short-circuit the target method's normal logic.</p> <p>Choosing the appropriate   {@link At} is very important when dealing with cancellable callbacks. For example you may with to be able to"short-circuit" a method by injecting at the HEAD and cancelling it if you don't want the method to be executed. However if you want the method to execute but be able to change the result, then injecting at RETURN makes more sense. Injecting at RETURN also allows you to see the value the method was going to return and optionally change it. The  {@link CallbackInfoReturnable#getReturnValue} method can be used to get the returnvalue from the stack, but <b>only</b> when using the RETURN injection point.</p> <p>It should be noted that it's perfectly possible to specify <em>cancellable</em> when injecting into a method which returns void, but with the key difference being that it's not possible to fetch the return value (because there isn't one) or set a return value (because there isn't one!) but it is still perfectly possible to short-circuit a method in this way.</p>
 * @param x The x coordinate
 * @param z The z coordinate
 * @param cir The callback
 */
@Inject(method="String_Node_Str",at=@At("String_Node_Str"),cancellable=true) public void onCanCoordinateBeSpawn(int x,int z,CallbackInfoReturnable<Boolean> cir){
  int coordinateWeDontLike=666;
  if (x == coordinateWeDontLike || z == coordinateWeDontLike) {
    if (cir.getReturnValue()) {
      System.err.println("String_Node_Str" + this + "String_Node_Str"+ x+ "String_Node_Str"+ z+ "String_Node_Str");
    }
    cir.setReturnValue(false);
  }
}