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


Java ConstPool.CONST_Integer方法代碼示例

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


在下文中一共展示了ConstPool.CONST_Integer方法的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);
}
 
開發者ID:AndreJCL,項目名稱:JCL,代碼行數:23,代碼來源:Tracer.java

示例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);
}
 
開發者ID:AndreJCL,項目名稱:JCL,代碼行數:29,代碼來源:Executor.java

示例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));
}
 
開發者ID:pietrobraione,項目名稱:jbse,代碼行數:28,代碼來源:ClassFileJavassist.java

示例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.");
    }
}
 
開發者ID:pietrobraione,項目名稱:jbse,代碼行數:43,代碼來源:ClassFileJavassist.java


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