當前位置: 首頁>>代碼示例>>Java>>正文


Java Handle.getTag方法代碼示例

本文整理匯總了Java中org.objectweb.asm.Handle.getTag方法的典型用法代碼示例。如果您正苦於以下問題:Java Handle.getTag方法的具體用法?Java Handle.getTag怎麽用?Java Handle.getTag使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.objectweb.asm.Handle的用法示例。


在下文中一共展示了Handle.getTag方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: visitInvokeDynamicInsn

import org.objectweb.asm.Handle; //導入方法依賴的package包/類
@Override
public void visitInvokeDynamicInsn(String name, String desc, Handle bsm,
        Object... bsmArgs) {
    checkStartCode();
    checkEndCode();
    checkMethodIdentifier(version, name, "name");
    checkMethodDesc(desc);
    if (bsm.getTag() != Opcodes.H_INVOKESTATIC
            && bsm.getTag() != Opcodes.H_NEWINVOKESPECIAL) {
        throw new IllegalArgumentException("invalid handle tag "
                + bsm.getTag());
    }
    for (int i = 0; i < bsmArgs.length; i++) {
        checkLDCConstant(bsmArgs[i]);
    }
    super.visitInvokeDynamicInsn(name, desc, bsm, bsmArgs);
    ++insnCount;
}
 
開發者ID:ItzSomebody,項目名稱:DirectLeaks-AntiReleak-Remover,代碼行數:19,代碼來源:CheckMethodAdapter.java

示例2: build

import org.objectweb.asm.Handle; //導入方法依賴的package包/類
private void build(InvokeDynamicInsnNode insn, IRBuilder builder) {
  // Bootstrap method
  Handle bsmHandle = insn.bsm;
  if (bsmHandle.getTag() != Opcodes.H_INVOKESTATIC &&
      bsmHandle.getTag() != Opcodes.H_NEWINVOKESPECIAL) {
    throw new Unreachable(
        "Bootstrap handle is not yet supported: tag == " + bsmHandle.getTag());
  }
  // Resolve the bootstrap method.
  DexMethodHandle bootstrapMethod = getMethodHandle(application, bsmHandle);

  // Decode static bootstrap arguments
  List<DexValue> bootstrapArgs = new ArrayList<>();
  for (Object arg : insn.bsmArgs) {
    bootstrapArgs.add(decodeBootstrapArgument(arg));
  }

  // Construct call site
  DexCallSite callSite = application
      .getCallSite(insn.name, insn.desc, bootstrapMethod, bootstrapArgs);

  buildInvoke(insn.desc, null /* Not needed */,
      false /* Receiver is passed explicitly */, builder,
      (types, registers) -> builder.addInvokeCustom(callSite, types, registers));
}
 
開發者ID:inferjay,項目名稱:r8,代碼行數:26,代碼來源:JarSourceCode.java

示例3: getTargetHandle

import org.objectweb.asm.Handle; //導入方法依賴的package包/類
public static Handle getTargetHandle(Handle bsm, Object[] bsmArgs) {
	if (bsm.getTag() == Opcodes.H_INVOKESTATIC
			&& bsm.getOwner().equals("java/lang/invoke/LambdaMetafactory")
			&& bsm.getName().equals("metafactory")
			&& bsm.getDesc().equals("(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;")
			&& !bsm.isInterface()) {
		return (Handle) bsmArgs[1];
	} else {
		System.out.printf("unknown invokedynamic bsm: %s/%s%s (tag=%d iif=%b)%n", bsm.getOwner(), bsm.getName(), bsm.getDesc(), bsm.getTag(), bsm.isInterface());

		return null;
	}
}
 
開發者ID:sfPlayer1,項目名稱:Matcher,代碼行數:14,代碼來源:Util.java

示例4: mapValue

import org.objectweb.asm.Handle; //導入方法依賴的package包/類
public Object mapValue(Object value) {
    if (value instanceof Type) {
        return mapType((Type) value);
    }
    if (value instanceof Handle) {
        Handle h = (Handle) value;
        return new Handle(h.getTag(), mapType(h.getOwner()), mapMethodName(
                h.getOwner(), h.getName(), h.getDesc()),
                mapMethodDesc(h.getDesc()), h.isInterface());
    }
    return value;
}
 
開發者ID:ItzSomebody,項目名稱:DirectLeaks-AntiReleak-Remover,代碼行數:13,代碼來源:Remapper.java

示例5: registerMethodHandleType

import org.objectweb.asm.Handle; //導入方法依賴的package包/類
private void registerMethodHandleType(Handle handle) {
  switch (handle.getTag()) {
    case Opcodes.H_GETFIELD:
      visitFieldInsn(Opcodes.GETFIELD, handle.getOwner(), handle.getName(), handle.getDesc());
      break;
    case Opcodes.H_GETSTATIC:
      visitFieldInsn(Opcodes.GETSTATIC, handle.getOwner(), handle.getName(), handle.getDesc());
      break;
    case Opcodes.H_PUTFIELD:
      visitFieldInsn(Opcodes.PUTFIELD, handle.getOwner(), handle.getName(), handle.getDesc());
      break;
    case Opcodes.H_PUTSTATIC:
      visitFieldInsn(Opcodes.PUTSTATIC, handle.getOwner(), handle.getName(), handle.getDesc());
      break;
    case Opcodes.H_INVOKEVIRTUAL:
      visitMethodInsn(
          Opcodes.INVOKEVIRTUAL, handle.getOwner(), handle.getName(), handle.getDesc(), false);
      break;
    case Opcodes.H_INVOKEINTERFACE:
      visitMethodInsn(
          Opcodes.INVOKEINTERFACE, handle.getOwner(), handle.getName(), handle.getDesc(), true);
      break;
    case Opcodes.H_INVOKESPECIAL:
      visitMethodInsn(
          Opcodes.INVOKESPECIAL, handle.getOwner(), handle.getName(), handle.getDesc(), false);
      break;
    case Opcodes.H_INVOKESTATIC:
      visitMethodInsn(
          Opcodes.INVOKESTATIC, handle.getOwner(), handle.getName(), handle.getDesc(), false);
      break;
    case Opcodes.H_NEWINVOKESPECIAL:
      visitMethodInsn(
          Opcodes.INVOKESPECIAL, handle.getOwner(), handle.getName(), handle.getDesc(), false);
      break;
    default:
      throw new Unreachable("MethodHandle tag is not supported: " + handle.getTag());
  }
}
 
開發者ID:inferjay,項目名稱:r8,代碼行數:39,代碼來源:JarRegisterEffectsVisitor.java

示例6: getMethodHandleType

import org.objectweb.asm.Handle; //導入方法依賴的package包/類
private MethodHandleType getMethodHandleType(Handle handle) {
  switch (handle.getTag()) {
    case Opcodes.H_GETFIELD:
      return MethodHandleType.INSTANCE_GET;
    case Opcodes.H_GETSTATIC:
      return MethodHandleType.STATIC_GET;
    case Opcodes.H_PUTFIELD:
      return MethodHandleType.INSTANCE_PUT;
    case Opcodes.H_PUTSTATIC:
      return MethodHandleType.STATIC_PUT;
    case Opcodes.H_INVOKESPECIAL:
      DexType owner = application.getTypeFromName(handle.getOwner());
      if (owner == clazz || handle.getName().equals(Constants.INSTANCE_INITIALIZER_NAME)) {
        return MethodHandleType.INVOKE_INSTANCE;
      } else {
        return MethodHandleType.INVOKE_SUPER;
      }
    case Opcodes.H_INVOKEVIRTUAL:
      return MethodHandleType.INVOKE_INSTANCE;
    case Opcodes.H_INVOKEINTERFACE:
      return MethodHandleType.INVOKE_INTERFACE;
    case Opcodes.H_INVOKESTATIC:
      return MethodHandleType.INVOKE_STATIC;
    case Opcodes.H_NEWINVOKESPECIAL:
      return MethodHandleType.INVOKE_CONSTRUCTOR;
    default:
      throw new Unreachable("MethodHandle tag is not supported: " + handle.getTag());
  }
}
 
開發者ID:inferjay,項目名稱:r8,代碼行數:30,代碼來源:JarSourceCode.java

示例7: compareHandle

import org.objectweb.asm.Handle; //導入方法依賴的package包/類
private static int compareHandle(Handle h1, Handle h2) {
    int d = h1.getTag() - h2.getTag();
    if (d == 0) {
        d = h1.getOwner().compareTo(h2.getOwner());
        if (d == 0) {
            d = h1.getName().compareTo(h2.getName());
            if (d == 0) {
                d = h1.getDesc().compareTo(h2.getDesc());
            }
        }
    }
    return d;
}
 
開發者ID:acmerli,項目名稱:fastAOP,代碼行數:14,代碼來源:Shrinker.java

示例8: appendHandle

import org.objectweb.asm.Handle; //導入方法依賴的package包/類
/**
 * 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(')');
    }
}
 
開發者ID:ItzSomebody,項目名稱:DirectLeaks-AntiReleak-Remover,代碼行數:59,代碼來源:Textifier.java


注:本文中的org.objectweb.asm.Handle.getTag方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。