当前位置: 首页>>代码示例>>Java>>正文


Java ConstPool.getClassInfo方法代码示例

本文整理汇总了Java中scouter.javassist.bytecode.ConstPool.getClassInfo方法的典型用法代码示例。如果您正苦于以下问题:Java ConstPool.getClassInfo方法的具体用法?Java ConstPool.getClassInfo怎么用?Java ConstPool.getClassInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在scouter.javassist.bytecode.ConstPool的用法示例。


在下文中一共展示了ConstPool.getClassInfo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getType

import scouter.javassist.bytecode.ConstPool; //导入方法依赖的package包/类
/**
 * Returns the <code>CtClass</code> object representing
 * the type specified by the cast.
 */
public CtClass getType() throws NotFoundException {
    ConstPool cp = getConstPool();
    int pos = currentPos;
    int index = iterator.u16bitAt(pos + 1);
    String name = cp.getClassInfo(index);
    return thisClass.getClassPool().getCtClass(name);
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:12,代码来源:Cast.java

示例2: getType

import scouter.javassist.bytecode.ConstPool; //导入方法依赖的package包/类
/**
 * Returns the type handled by the catch clause.
 * If this is a <code>finally</code> block, <code>null</code> is returned.
 */
public CtClass getType() throws NotFoundException {
    int type = etable.catchType(index);
    if (type == 0)
        return null;
    else {
        ConstPool cp = getConstPool();
        String name = cp.getClassInfo(type);
        return thisClass.getClassPool().getCtClass(name);
    }
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:15,代码来源:Handler.java

示例3: getType

import scouter.javassist.bytecode.ConstPool; //导入方法依赖的package包/类
/**
 * Returns the <code>CtClass</code> object representing
 * the type name on the right hand side
 * of the instanceof operator.
 */
public CtClass getType() throws NotFoundException {
    ConstPool cp = getConstPool();
    int pos = currentPos;
    int index = iterator.u16bitAt(pos + 1);
    String name = cp.getClassInfo(index);
    return thisClass.getClassPool().getCtClass(name);
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:13,代码来源:Instanceof.java

示例4: replace2

import scouter.javassist.bytecode.ConstPool; //导入方法依赖的package包/类
private void replace2(String statement)
    throws CompileError, NotFoundException, BadBytecode,
           CannotCompileException
{
    thisClass.getClassFile();   // to call checkModify().
    ConstPool constPool = getConstPool();
    int pos = currentPos;
    CtClass retType;
    int codeLength;
    int index = 0;
    int dim = 1;
    String desc;
    if (opcode == Opcode.NEWARRAY) {
        index = iterator.byteAt(currentPos + 1);    // atype
        CtPrimitiveType cpt = (CtPrimitiveType)getPrimitiveType(index);
        desc = "[" + cpt.getDescriptor();
        codeLength = 2;
    }
    else if (opcode == Opcode.ANEWARRAY) {
        index = iterator.u16bitAt(pos + 1);
        desc = constPool.getClassInfo(index);
        if (desc.startsWith("["))
            desc = "[" + desc;
        else
            desc = "[L" + desc + ";";

        codeLength = 3;
    }
    else if (opcode == Opcode.MULTIANEWARRAY) {
        index = iterator.u16bitAt(currentPos + 1);
        desc = constPool.getClassInfo(index);
        dim = iterator.byteAt(currentPos + 3);
        codeLength = 4;
    }
    else
        throw new RuntimeException("bad opcode: " + opcode);

    retType = Descriptor.toCtClass(desc, thisClass.getClassPool());

    Javac jc = new Javac(thisClass);
    CodeAttribute ca = iterator.get();

    CtClass[] params = new CtClass[dim];
    for (int i = 0; i < dim; ++i)
        params[i] = CtClass.intType;

    int paramVar = ca.getMaxLocals();
    jc.recordParams(javaLangObject, params,
                    true, paramVar, withinStatic());

    /* Is $_ included in the source code?
     */
    checkResultValue(retType, statement);
    int retVar = jc.recordReturnType(retType, true);
    jc.recordProceed(new ProceedForArray(retType, opcode, index, dim));

    Bytecode bytecode = jc.getBytecode();
    storeStack(params, true, paramVar, bytecode);
    jc.recordLocalVariables(ca, pos);

    bytecode.addOpcode(Opcode.ACONST_NULL);        // initialize $_
    bytecode.addAstore(retVar);

    jc.compileStmnt(statement);
    bytecode.addAload(retVar);

    replace0(pos, bytecode, codeLength);
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:69,代码来源:NewArray.java


注:本文中的scouter.javassist.bytecode.ConstPool.getClassInfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。