本文整理匯總了Java中javassist.bytecode.ConstPool.CONST_Float方法的典型用法代碼示例。如果您正苦於以下問題:Java ConstPool.CONST_Float方法的具體用法?Java ConstPool.CONST_Float怎麽用?Java ConstPool.CONST_Float使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javassist.bytecode.ConstPool
的用法示例。
在下文中一共展示了ConstPool.CONST_Float方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: doLDC
import javassist.bytecode.ConstPool; //導入方法依賴的package包/類
private void doLDC(int index) {
TypeData[] stackTypes = this.stackTypes;
int tag = cpool.getTag(index);
if (tag == ConstPool.CONST_String)
stackTypes[stackTop++] = new TypeData.ClassName("java.lang.String");
else if (tag == ConstPool.CONST_Integer)
stackTypes[stackTop++] = INTEGER;
else if (tag == ConstPool.CONST_Float)
stackTypes[stackTop++] = FLOAT;
else if (tag == ConstPool.CONST_Long) {
stackTypes[stackTop++] = LONG;
stackTypes[stackTop++] = TOP;
}
else if (tag == ConstPool.CONST_Double) {
stackTypes[stackTop++] = DOUBLE;
stackTypes[stackTop++] = TOP;
}
else if (tag == ConstPool.CONST_Class)
stackTypes[stackTop++] = new TypeData.ClassName("java.lang.Class");
else
throw new RuntimeException("bad LDC: " + tag);
}
示例2: evalLDC
import javassist.bytecode.ConstPool; //導入方法依賴的package包/類
private void evalLDC(int index, Frame frame) throws BadBytecode {
int tag = constPool.getTag(index);
Type type;
switch (tag) {
case ConstPool.CONST_String:
type = STRING_TYPE;
break;
case ConstPool.CONST_Integer:
type = Type.INTEGER;
break;
case ConstPool.CONST_Float:
type = Type.FLOAT;
break;
case ConstPool.CONST_Long:
type = Type.LONG;
break;
case ConstPool.CONST_Double:
type = Type.DOUBLE;
break;
case ConstPool.CONST_Class:
type = CLASS_TYPE;
break;
default:
throw new BadBytecode("bad LDC [pos = " + lastPos + "]: " + tag);
}
simplePush(type, frame);
}
示例3: getValueFromConstantPool
import javassist.bytecode.ConstPool; //導入方法依賴的package包/類
@Override
public ConstantPoolValue getValueFromConstantPool(int index) throws InvalidIndexException {
if (index < 1 || index > this.cp.getSize()) {
throw new InvalidIndexException(indexOutOfRangeMessage(index));
}
final int tag = this.cp.getTag(index);
switch (tag) {
case ConstPool.CONST_Integer:
return new ConstantPoolPrimitive(this.cp.getIntegerInfo(index));
case ConstPool.CONST_Float:
return new ConstantPoolPrimitive(this.cp.getFloatInfo(index));
case ConstPool.CONST_Long:
return new ConstantPoolPrimitive(this.cp.getLongInfo(index));
case ConstPool.CONST_Double:
return new ConstantPoolPrimitive(this.cp.getDoubleInfo(index));
case ConstPool.CONST_String:
if (this.cpPatches != null && index < this.cpPatches.length && this.cpPatches[index] != null) {
return this.cpPatches[index];
}
return new ConstantPoolString(this.cp.getStringInfo(index));
case ConstPool.CONST_Class:
return new ConstantPoolClass(internalClassName(this.cp.getClassInfo(index)));
case ConstPool.CONST_Utf8:
return new ConstantPoolUtf8(this.cp.getUtf8Info(index));
}
throw new InvalidIndexException(entryInvalidMessage(index));
}
示例4: checkCpPatches
import javassist.bytecode.ConstPool; //導入方法依賴的package包/類
private void checkCpPatches(javassist.bytecode.ConstPool cp, ConstantPoolValue[] cpPatches)
throws InvalidInputException {
if (cpPatches == null) {
return;
}
for (int i = 1; i < Math.min(cp.getSize(), cpPatches.length); ++i) {
if (cpPatches[i] == null) {
continue;
}
final int tag = cp.getTag(i);
if (tag == ConstPool.CONST_String) {
continue; //any will fit
}
if (tag == ConstPool.CONST_Integer &&
cpPatches[i] instanceof ConstantPoolPrimitive &&
((ConstantPoolPrimitive) cpPatches[i]).getValue() instanceof Integer) {
continue;
}
if (tag == ConstPool.CONST_Long &&
cpPatches[i] instanceof ConstantPoolPrimitive &&
((ConstantPoolPrimitive) cpPatches[i]).getValue() instanceof Long) {
continue;
}
if (tag == ConstPool.CONST_Float &&
cpPatches[i] instanceof ConstantPoolPrimitive &&
((ConstantPoolPrimitive) cpPatches[i]).getValue() instanceof Float) {
continue;
}
if (tag == ConstPool.CONST_Double &&
cpPatches[i] instanceof ConstantPoolPrimitive &&
((ConstantPoolPrimitive) cpPatches[i]).getValue() instanceof Double) {
continue;
}
if (tag == ConstPool.CONST_Utf8 && cpPatches[i] instanceof ConstantPoolString) {
continue;
}
if (tag == ConstPool.CONST_Class && cpPatches[i] instanceof ConstantPoolClass) {
continue;
}
throw new InvalidInputException("ClassFile constructor for anonymous classfile invoked with cpPatches parameter not matching bytecode's constant pool.");
}
}