org.objectweb.asm.ConstantDynamic#getBootstrapMethodArgumentCount ( )源码实例Demo

下面列出了org.objectweb.asm.ConstantDynamic#getBootstrapMethodArgumentCount ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Concurnas   文件: Remapper.java
/**
 * Returns the given value, remapped with this remapper. Possible values are {@link Boolean},
 * {@link Byte}, {@link Short}, {@link Character}, {@link Integer}, {@link Long}, {@link Double},
 * {@link Float}, {@link String}, {@link Type}, {@link Handle}, {@link ConstantDynamic} or arrays
 * of primitive types .
 *
 * @param value an object. Only {@link Type}, {@link Handle} and {@link ConstantDynamic} values
 *     are remapped.
 * @return the given value, remapped with this remapper.
 */
public Object mapValue(final Object value) {
  if (value instanceof Type) {
    return mapType((Type) value);
  }
  if (value instanceof Handle) {
    Handle handle = (Handle) value;
    return new Handle(
        handle.getTag(),
        mapType(handle.getOwner()),
        mapMethodName(handle.getOwner(), handle.getName(), handle.getDesc()),
        handle.getTag() <= Opcodes.H_PUTSTATIC
            ? mapDesc(handle.getDesc())
            : mapMethodDesc(handle.getDesc()),
        handle.isInterface());
  }
  if (value instanceof ConstantDynamic) {
    ConstantDynamic constantDynamic = (ConstantDynamic) value;
    int bootstrapMethodArgumentCount = constantDynamic.getBootstrapMethodArgumentCount();
    Object[] remappedBootstrapMethodArguments = new Object[bootstrapMethodArgumentCount];
    for (int i = 0; i < bootstrapMethodArgumentCount; ++i) {
      remappedBootstrapMethodArguments[i] =
          mapValue(constantDynamic.getBootstrapMethodArgument(i));
    }
    String descriptor = constantDynamic.getDescriptor();
    return new ConstantDynamic(
        mapInvokeDynamicMethodName(constantDynamic.getName(), descriptor),
        mapDesc(descriptor),
        (Handle) mapValue(constantDynamic.getBootstrapMethod()),
        remappedBootstrapMethodArguments);
  }
  return value;
}
 
源代码2 项目: JReFrameworker   文件: Remapper.java
/**
 * Returns the given value, remapped with this remapper. Possible values are {@link Boolean},
 * {@link Byte}, {@link Short}, {@link Character}, {@link Integer}, {@link Long}, {@link Double},
 * {@link Float}, {@link String}, {@link Type}, {@link Handle}, {@link ConstantDynamic} or arrays
 * of primitive types .
 *
 * @param value an object. Only {@link Type}, {@link Handle} and {@link ConstantDynamic} values
 *     are remapped.
 * @return the given value, remapped with this remapper.
 */
public Object mapValue(final Object value) {
  if (value instanceof Type) {
    return mapType((Type) value);
  }
  if (value instanceof Handle) {
    Handle handle = (Handle) value;
    return new Handle(
        handle.getTag(),
        mapType(handle.getOwner()),
        mapMethodName(handle.getOwner(), handle.getName(), handle.getDesc()),
        handle.getTag() <= Opcodes.H_PUTSTATIC
            ? mapDesc(handle.getDesc())
            : mapMethodDesc(handle.getDesc()),
        handle.isInterface());
  }
  if (value instanceof ConstantDynamic) {
    ConstantDynamic constantDynamic = (ConstantDynamic) value;
    int bootstrapMethodArgumentCount = constantDynamic.getBootstrapMethodArgumentCount();
    Object[] remappedBootstrapMethodArguments = new Object[bootstrapMethodArgumentCount];
    for (int i = 0; i < bootstrapMethodArgumentCount; ++i) {
      remappedBootstrapMethodArguments[i] =
          mapValue(constantDynamic.getBootstrapMethodArgument(i));
    }
    String descriptor = constantDynamic.getDescriptor();
    return new ConstantDynamic(
        mapInvokeDynamicMethodName(constantDynamic.getName(), descriptor),
        mapDesc(descriptor),
        (Handle) mapValue(constantDynamic.getBootstrapMethod()),
        remappedBootstrapMethodArguments);
  }
  return value;
}
 
源代码3 项目: JReFrameworker   文件: Remapper.java
/**
 * Returns the given value, remapped with this remapper. Possible values are {@link Boolean},
 * {@link Byte}, {@link Short}, {@link Character}, {@link Integer}, {@link Long}, {@link Double},
 * {@link Float}, {@link String}, {@link Type}, {@link Handle}, {@link ConstantDynamic} or arrays
 * of primitive types .
 *
 * @param value an object. Only {@link Type}, {@link Handle} and {@link ConstantDynamic} values
 *     are remapped.
 * @return the given value, remapped with this remapper.
 */
public Object mapValue(final Object value) {
  if (value instanceof Type) {
    return mapType((Type) value);
  }
  if (value instanceof Handle) {
    Handle handle = (Handle) value;
    return new Handle(
        handle.getTag(),
        mapType(handle.getOwner()),
        mapMethodName(handle.getOwner(), handle.getName(), handle.getDesc()),
        handle.getTag() <= Opcodes.H_PUTSTATIC
            ? mapDesc(handle.getDesc())
            : mapMethodDesc(handle.getDesc()),
        handle.isInterface());
  }
  if (value instanceof ConstantDynamic) {
    ConstantDynamic constantDynamic = (ConstantDynamic) value;
    int bootstrapMethodArgumentCount = constantDynamic.getBootstrapMethodArgumentCount();
    Object[] remappedBootstrapMethodArguments = new Object[bootstrapMethodArgumentCount];
    for (int i = 0; i < bootstrapMethodArgumentCount; ++i) {
      remappedBootstrapMethodArguments[i] =
          mapValue(constantDynamic.getBootstrapMethodArgument(i));
    }
    String descriptor = constantDynamic.getDescriptor();
    return new ConstantDynamic(
        mapInvokeDynamicMethodName(constantDynamic.getName(), descriptor),
        mapDesc(descriptor),
        (Handle) mapValue(constantDynamic.getBootstrapMethod()),
        remappedBootstrapMethodArguments);
  }
  return value;
}
 
源代码4 项目: Concurnas   文件: CheckMethodAdapter.java
/**
 * Checks that the given value is a valid operand for the LDC instruction.
 *
 * @param value the value to be checked.
 */
private void checkLdcConstant(final Object value) {
  if (value instanceof Type) {
    int sort = ((Type) value).getSort();
    if (sort != Type.OBJECT && sort != Type.ARRAY && sort != Type.METHOD) {
      throw new IllegalArgumentException("Illegal LDC constant value");
    }
    if (sort != Type.METHOD && (version & 0xFFFF) < Opcodes.V1_5) {
      throw new IllegalArgumentException("ldc of a constant class requires at least version 1.5");
    }
    if (sort == Type.METHOD && (version & 0xFFFF) < Opcodes.V1_7) {
      throw new IllegalArgumentException("ldc of a method type requires at least version 1.7");
    }
  } else if (value instanceof Handle) {
    if ((version & 0xFFFF) < Opcodes.V1_7) {
      throw new IllegalArgumentException("ldc of a Handle requires at least version 1.7");
    }
    Handle handle = (Handle) value;
    int tag = handle.getTag();
    if (tag < Opcodes.H_GETFIELD || tag > Opcodes.H_INVOKEINTERFACE) {
      throw new IllegalArgumentException("invalid handle tag " + tag);
    }
    checkInternalName(this.version, handle.getOwner(), "handle owner");
    if (tag <= Opcodes.H_PUTSTATIC) {
      checkDescriptor(this.version, handle.getDesc(), false);
    } else {
      checkMethodDescriptor(this.version, handle.getDesc());
    }
    String handleName = handle.getName();
    if (!("<init>".equals(handleName) && tag == Opcodes.H_NEWINVOKESPECIAL)) {
      checkMethodIdentifier(this.version, handleName, "handle name");
    }
  } else if (value instanceof ConstantDynamic) {
    if ((version & 0xFFFF) < Opcodes.V11) {
      throw new IllegalArgumentException("ldc of a ConstantDynamic requires at least version 11");
    }
    ConstantDynamic constantDynamic = (ConstantDynamic) value;
    checkMethodIdentifier(this.version, constantDynamic.getName(), "constant dynamic name");
    checkDescriptor(this.version, constantDynamic.getDescriptor(), false);
    checkLdcConstant(constantDynamic.getBootstrapMethod());
    int bootstrapMethodArgumentCount = constantDynamic.getBootstrapMethodArgumentCount();
    for (int i = 0; i < bootstrapMethodArgumentCount; ++i) {
      checkLdcConstant(constantDynamic.getBootstrapMethodArgument(i));
    }
  } else {
    checkConstant(value);
  }
}
 
源代码5 项目: JReFrameworker   文件: CheckMethodAdapter.java
/**
 * Checks that the given value is a valid operand for the LDC instruction.
 *
 * @param value the value to be checked.
 */
private void checkLdcConstant(final Object value) {
  if (value instanceof Type) {
    int sort = ((Type) value).getSort();
    if (sort != Type.OBJECT && sort != Type.ARRAY && sort != Type.METHOD) {
      throw new IllegalArgumentException("Illegal LDC constant value");
    }
    if (sort != Type.METHOD && (version & 0xFFFF) < Opcodes.V1_5) {
      throw new IllegalArgumentException("ldc of a constant class requires at least version 1.5");
    }
    if (sort == Type.METHOD && (version & 0xFFFF) < Opcodes.V1_7) {
      throw new IllegalArgumentException("ldc of a method type requires at least version 1.7");
    }
  } else if (value instanceof Handle) {
    if ((version & 0xFFFF) < Opcodes.V1_7) {
      throw new IllegalArgumentException("ldc of a Handle requires at least version 1.7");
    }
    Handle handle = (Handle) value;
    int tag = handle.getTag();
    if (tag < Opcodes.H_GETFIELD || tag > Opcodes.H_INVOKEINTERFACE) {
      throw new IllegalArgumentException("invalid handle tag " + tag);
    }
    checkInternalName(this.version, handle.getOwner(), "handle owner");
    if (tag <= Opcodes.H_PUTSTATIC) {
      checkDescriptor(this.version, handle.getDesc(), false);
    } else {
      checkMethodDescriptor(this.version, handle.getDesc());
    }
    String handleName = handle.getName();
    if (!("<init>".equals(handleName) && tag == Opcodes.H_NEWINVOKESPECIAL)) {
      checkMethodIdentifier(this.version, handleName, "handle name");
    }
  } else if (value instanceof ConstantDynamic) {
    if ((version & 0xFFFF) < Opcodes.V11) {
      throw new IllegalArgumentException("ldc of a ConstantDynamic requires at least version 11");
    }
    ConstantDynamic constantDynamic = (ConstantDynamic) value;
    checkMethodIdentifier(this.version, constantDynamic.getName(), "constant dynamic name");
    checkDescriptor(this.version, constantDynamic.getDescriptor(), false);
    checkLdcConstant(constantDynamic.getBootstrapMethod());
    int bootstrapMethodArgumentCount = constantDynamic.getBootstrapMethodArgumentCount();
    for (int i = 0; i < bootstrapMethodArgumentCount; ++i) {
      checkLdcConstant(constantDynamic.getBootstrapMethodArgument(i));
    }
  } else {
    checkConstant(value);
  }
}
 
源代码6 项目: JReFrameworker   文件: CheckMethodAdapter.java
/**
 * Checks that the given value is a valid operand for the LDC instruction.
 *
 * @param value the value to be checked.
 */
private void checkLdcConstant(final Object value) {
  if (value instanceof Type) {
    int sort = ((Type) value).getSort();
    if (sort != Type.OBJECT && sort != Type.ARRAY && sort != Type.METHOD) {
      throw new IllegalArgumentException("Illegal LDC constant value");
    }
    if (sort != Type.METHOD && (version & 0xFFFF) < Opcodes.V1_5) {
      throw new IllegalArgumentException("ldc of a constant class requires at least version 1.5");
    }
    if (sort == Type.METHOD && (version & 0xFFFF) < Opcodes.V1_7) {
      throw new IllegalArgumentException("ldc of a method type requires at least version 1.7");
    }
  } else if (value instanceof Handle) {
    if ((version & 0xFFFF) < Opcodes.V1_7) {
      throw new IllegalArgumentException("ldc of a Handle requires at least version 1.7");
    }
    Handle handle = (Handle) value;
    int tag = handle.getTag();
    if (tag < Opcodes.H_GETFIELD || tag > Opcodes.H_INVOKEINTERFACE) {
      throw new IllegalArgumentException("invalid handle tag " + tag);
    }
    checkInternalName(this.version, handle.getOwner(), "handle owner");
    if (tag <= Opcodes.H_PUTSTATIC) {
      checkDescriptor(this.version, handle.getDesc(), false);
    } else {
      checkMethodDescriptor(this.version, handle.getDesc());
    }
    String handleName = handle.getName();
    if (!("<init>".equals(handleName) && tag == Opcodes.H_NEWINVOKESPECIAL)) {
      checkMethodIdentifier(this.version, handleName, "handle name");
    }
  } else if (value instanceof ConstantDynamic) {
    if ((version & 0xFFFF) < Opcodes.V11) {
      throw new IllegalArgumentException("ldc of a ConstantDynamic requires at least version 11");
    }
    ConstantDynamic constantDynamic = (ConstantDynamic) value;
    checkMethodIdentifier(this.version, constantDynamic.getName(), "constant dynamic name");
    checkDescriptor(this.version, constantDynamic.getDescriptor(), false);
    checkLdcConstant(constantDynamic.getBootstrapMethod());
    int bootstrapMethodArgumentCount = constantDynamic.getBootstrapMethodArgumentCount();
    for (int i = 0; i < bootstrapMethodArgumentCount; ++i) {
      checkLdcConstant(constantDynamic.getBootstrapMethodArgument(i));
    }
  } else {
    checkConstant(value);
  }
}