Java Code Examples for org.objectweb.asm.Opcodes#H_PUTFIELD

The following examples show how to use org.objectweb.asm.Opcodes#H_PUTFIELD . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MemberRef.java    From Mixin with MIT License 6 votes vote down vote up
@Override
public boolean isField() {
    switch (this.handle.getTag()) {
        case Opcodes.H_INVOKEVIRTUAL:
        case Opcodes.H_INVOKESTATIC:
        case Opcodes.H_INVOKEINTERFACE:
        case Opcodes.H_INVOKESPECIAL:
        case Opcodes.H_NEWINVOKESPECIAL:
            return false;
        case Opcodes.H_GETFIELD:
        case Opcodes.H_GETSTATIC:
        case Opcodes.H_PUTFIELD:
        case Opcodes.H_PUTSTATIC:
            return true;
        default:
            throw new MixinTransformerError("Invalid tag " + this.handle.getTag() + " for method handle " + this.handle + ".");
    }
}
 
Example 2
Source File: DalvikStatsTool.java    From buck with Apache License 2.0 6 votes vote down vote up
private void registerMethodHandleType(Handle handle) {
  switch (handle.getTag()) {
    case Opcodes.H_GETFIELD:
    case Opcodes.H_GETSTATIC:
    case Opcodes.H_PUTFIELD:
    case Opcodes.H_PUTSTATIC:
      visitFieldInsn(Opcodes.GETFIELD, handle.getOwner(), handle.getName(), handle.getDesc());
      break;
    case Opcodes.H_INVOKEVIRTUAL:
    case Opcodes.H_INVOKEINTERFACE:
    case Opcodes.H_INVOKESPECIAL:
    case Opcodes.H_INVOKESTATIC:
    case Opcodes.H_NEWINVOKESPECIAL:
      visitMethodInsn(
          Opcodes.H_INVOKEVIRTUAL,
          handle.getOwner(),
          handle.getName(),
          handle.getDesc(),
          false);
      createAdditionalMethodsForDesugar(handle);
      break;
    default:
      throw new IllegalStateException(
          "MethodHandle tag is not supported: " + handle.getTag());
  }
}
 
Example 3
Source File: MixinExperienceOrbEntity.java    From patchwork-api with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Inject(method = "onPlayerCollision", cancellable = true, at = @At(value = "FIELD", opcode = Opcodes.H_PUTFIELD, ordinal = 0,
		target = "net/minecraft/entity/player/PlayerEntity.experiencePickUpDelay:I"))
private void hookOnPlayerCollisionForPickup(PlayerEntity player, CallbackInfo ci) {
	@SuppressWarnings("ConstantConditions")
	ExperienceOrbEntity entity = (ExperienceOrbEntity) (Object) this;

	if (MinecraftForge.EVENT_BUS.post(new PlayerPickupXpEvent(player, entity))) {
		ci.cancel();
	}
}
 
Example 4
Source File: PrefixReferenceScanner.java    From bazel with Apache License 2.0 5 votes vote down vote up
void handleReference(Handle handle) {
  switch (handle.getTag()) {
    case Opcodes.H_GETFIELD:
    case Opcodes.H_GETSTATIC:
    case Opcodes.H_PUTFIELD:
    case Opcodes.H_PUTSTATIC:
      fieldReference(handle.getOwner(), handle.getName(), handle.getDesc());
      break;

    default:
      methodReference(handle.getOwner(), handle.getName(), handle.getDesc());
      break;
  }
}
 
Example 5
Source File: Textifier.java    From Concurnas with MIT License 4 votes vote down vote up
/**
 * Appends a string representation of the given handle to {@link #stringBuilder}.
 *
 * @param handle a handle.
 */
protected void appendHandle(final Handle handle) {
  int tag = handle.getTag();
  stringBuilder.append("// handle kind 0x").append(Integer.toHexString(tag)).append(" : ");
  boolean isMethodHandle = false;
  switch (tag) {
    case Opcodes.H_GETFIELD:
      stringBuilder.append("GETFIELD");
      break;
    case Opcodes.H_GETSTATIC:
      stringBuilder.append("GETSTATIC");
      break;
    case Opcodes.H_PUTFIELD:
      stringBuilder.append("PUTFIELD");
      break;
    case Opcodes.H_PUTSTATIC:
      stringBuilder.append("PUTSTATIC");
      break;
    case Opcodes.H_INVOKEINTERFACE:
      stringBuilder.append("INVOKEINTERFACE");
      isMethodHandle = true;
      break;
    case Opcodes.H_INVOKESPECIAL:
      stringBuilder.append("INVOKESPECIAL");
      isMethodHandle = true;
      break;
    case Opcodes.H_INVOKESTATIC:
      stringBuilder.append("INVOKESTATIC");
      isMethodHandle = true;
      break;
    case Opcodes.H_INVOKEVIRTUAL:
      stringBuilder.append("INVOKEVIRTUAL");
      isMethodHandle = true;
      break;
    case Opcodes.H_NEWINVOKESPECIAL:
      stringBuilder.append("NEWINVOKESPECIAL");
      isMethodHandle = true;
      break;
    default:
      throw new IllegalArgumentException();
  }
  stringBuilder.append('\n');
  stringBuilder.append(tab3);
  appendDescriptor(INTERNAL_NAME, handle.getOwner());
  stringBuilder.append('.');
  stringBuilder.append(handle.getName());
  if (!isMethodHandle) {
    stringBuilder.append('(');
  }
  appendDescriptor(HANDLE_DESCRIPTOR, handle.getDesc());
  if (!isMethodHandle) {
    stringBuilder.append(')');
  }
  if (handle.isInterface()) {
    stringBuilder.append(" itf");
  }
}
 
Example 6
Source File: Textifier.java    From JByteMod-Beta with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Appends the information about the given handle to {@link #buf buf}.
 *
 * @param h
 *          a handle, non null.
 */
protected void appendHandle(final Handle h) {
  int tag = h.getTag();
  buf.append("// handle kind 0x").append(Integer.toHexString(tag)).append(" : ");
  boolean isMethodHandle = false;
  switch (tag) {
  case Opcodes.H_GETFIELD:
    buf.append("GETFIELD");
    break;
  case Opcodes.H_GETSTATIC:
    buf.append("GETSTATIC");
    break;
  case Opcodes.H_PUTFIELD:
    buf.append("PUTFIELD");
    break;
  case Opcodes.H_PUTSTATIC:
    buf.append("PUTSTATIC");
    break;
  case Opcodes.H_INVOKEINTERFACE:
    buf.append("INVOKEINTERFACE");
    isMethodHandle = true;
    break;
  case Opcodes.H_INVOKESPECIAL:
    buf.append("INVOKESPECIAL");
    isMethodHandle = true;
    break;
  case Opcodes.H_INVOKESTATIC:
    buf.append("INVOKESTATIC");
    isMethodHandle = true;
    break;
  case Opcodes.H_INVOKEVIRTUAL:
    buf.append("INVOKEVIRTUAL");
    isMethodHandle = true;
    break;
  case Opcodes.H_NEWINVOKESPECIAL:
    buf.append("NEWINVOKESPECIAL");
    isMethodHandle = true;
    break;
  }
  buf.append('\n');
  buf.append(tab3);
  appendDescriptor(INTERNAL_NAME, h.getOwner());
  buf.append('.');
  buf.append(h.getName());
  if (!isMethodHandle) {
    buf.append('(');
  }
  appendDescriptor(HANDLE_DESCRIPTOR, h.getDesc());
  if (!isMethodHandle) {
    buf.append(')');
  }
  if (h.isInterface()) {
    buf.append(" itf");
  }
}
 
Example 7
Source File: Textifier.java    From JReFrameworker with MIT License 4 votes vote down vote up
/**
 * Appends a string representation of the given handle to {@link #stringBuilder}.
 *
 * @param handle a handle.
 */
protected void appendHandle(final Handle handle) {
  int tag = handle.getTag();
  stringBuilder.append("// handle kind 0x").append(Integer.toHexString(tag)).append(" : ");
  boolean isMethodHandle = false;
  switch (tag) {
    case Opcodes.H_GETFIELD:
      stringBuilder.append("GETFIELD");
      break;
    case Opcodes.H_GETSTATIC:
      stringBuilder.append("GETSTATIC");
      break;
    case Opcodes.H_PUTFIELD:
      stringBuilder.append("PUTFIELD");
      break;
    case Opcodes.H_PUTSTATIC:
      stringBuilder.append("PUTSTATIC");
      break;
    case Opcodes.H_INVOKEINTERFACE:
      stringBuilder.append("INVOKEINTERFACE");
      isMethodHandle = true;
      break;
    case Opcodes.H_INVOKESPECIAL:
      stringBuilder.append("INVOKESPECIAL");
      isMethodHandle = true;
      break;
    case Opcodes.H_INVOKESTATIC:
      stringBuilder.append("INVOKESTATIC");
      isMethodHandle = true;
      break;
    case Opcodes.H_INVOKEVIRTUAL:
      stringBuilder.append("INVOKEVIRTUAL");
      isMethodHandle = true;
      break;
    case Opcodes.H_NEWINVOKESPECIAL:
      stringBuilder.append("NEWINVOKESPECIAL");
      isMethodHandle = true;
      break;
    default:
      throw new IllegalArgumentException();
  }
  stringBuilder.append('\n');
  stringBuilder.append(tab3);
  appendDescriptor(INTERNAL_NAME, handle.getOwner());
  stringBuilder.append('.');
  stringBuilder.append(handle.getName());
  if (!isMethodHandle) {
    stringBuilder.append('(');
  }
  appendDescriptor(HANDLE_DESCRIPTOR, handle.getDesc());
  if (!isMethodHandle) {
    stringBuilder.append(')');
  }
  if (handle.isInterface()) {
    stringBuilder.append(" itf");
  }
}
 
Example 8
Source File: Textifier.java    From JReFrameworker with MIT License 4 votes vote down vote up
/**
 * Appends a string representation of the given handle to {@link #stringBuilder}.
 *
 * @param handle a handle.
 */
protected void appendHandle(final Handle handle) {
  int tag = handle.getTag();
  stringBuilder.append("// handle kind 0x").append(Integer.toHexString(tag)).append(" : ");
  boolean isMethodHandle = false;
  switch (tag) {
    case Opcodes.H_GETFIELD:
      stringBuilder.append("GETFIELD");
      break;
    case Opcodes.H_GETSTATIC:
      stringBuilder.append("GETSTATIC");
      break;
    case Opcodes.H_PUTFIELD:
      stringBuilder.append("PUTFIELD");
      break;
    case Opcodes.H_PUTSTATIC:
      stringBuilder.append("PUTSTATIC");
      break;
    case Opcodes.H_INVOKEINTERFACE:
      stringBuilder.append("INVOKEINTERFACE");
      isMethodHandle = true;
      break;
    case Opcodes.H_INVOKESPECIAL:
      stringBuilder.append("INVOKESPECIAL");
      isMethodHandle = true;
      break;
    case Opcodes.H_INVOKESTATIC:
      stringBuilder.append("INVOKESTATIC");
      isMethodHandle = true;
      break;
    case Opcodes.H_INVOKEVIRTUAL:
      stringBuilder.append("INVOKEVIRTUAL");
      isMethodHandle = true;
      break;
    case Opcodes.H_NEWINVOKESPECIAL:
      stringBuilder.append("NEWINVOKESPECIAL");
      isMethodHandle = true;
      break;
    default:
      throw new IllegalArgumentException();
  }
  stringBuilder.append('\n');
  stringBuilder.append(tab3);
  appendDescriptor(INTERNAL_NAME, handle.getOwner());
  stringBuilder.append('.');
  stringBuilder.append(handle.getName());
  if (!isMethodHandle) {
    stringBuilder.append('(');
  }
  appendDescriptor(HANDLE_DESCRIPTOR, handle.getDesc());
  if (!isMethodHandle) {
    stringBuilder.append(')');
  }
  if (handle.isInterface()) {
    stringBuilder.append(" itf");
  }
}