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


Java CHECKCAST类代码示例

本文整理汇总了Java中org.apache.bcel.generic.CHECKCAST的典型用法代码示例。如果您正苦于以下问题:Java CHECKCAST类的具体用法?Java CHECKCAST怎么用?Java CHECKCAST使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: visitCHECKCAST

import org.apache.bcel.generic.CHECKCAST; //导入依赖的package包/类
@Override
public void visitCHECKCAST(CHECKCAST obj) {
    // cast to a safe object type
    ObjectType objectType = obj.getLoadClassType(cpg);
    if (objectType == null) {
        return;
    }

    String objectTypeSignature = objectType.getSignature();

    if(!taintConfig.isClassTaintSafe(objectTypeSignature)) {
        return;
    }

    try {
        getFrame().popValue();
        pushSafe();
    }
    catch (DataflowAnalysisException ex) {
        throw new InvalidBytecodeException("empty stack for checkcast", ex);
    }
}
 
开发者ID:blackarbiter,项目名称:Android_Code_Arbiter,代码行数:23,代码来源:TaintFrameModelingVisitor.java

示例2: visitCHECKCAST

import org.apache.bcel.generic.CHECKCAST; //导入依赖的package包/类
public void visitCHECKCAST(CHECKCAST c) {
	Type t = c.getType(poolGen);
	log.log("         instr(checkcast)=" + t, Project.MSG_DEBUG);
	String type = t.toString();

	design.checkClass(type);
}
 
开发者ID:cniweb,项目名称:ant-contrib,代码行数:8,代码来源:InstructionVisitor.java

示例3: visitCHECKCAST

import org.apache.bcel.generic.CHECKCAST; //导入依赖的package包/类
@Override
public void visitCHECKCAST(CHECKCAST obj) {
    try {
        ResourceValueFrame frame = getFrame();
        ResourceValue topValue;

        topValue = frame.getTopValue();

        if (topValue.equals(ResourceValue.instance()))
            frame.setStatus(ResourceValueFrame.ESCAPED);
    } catch (DataflowAnalysisException e) {
        AnalysisContext.logError("Analysis error", e);
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:15,代码来源:ResourceValueFrameModelingVisitor.java

示例4: registerInstructionSources

import org.apache.bcel.generic.CHECKCAST; //导入依赖的package包/类
private void registerInstructionSources() throws DataflowAnalysisException {
    for (Iterator<Location> i = cfg.locationIterator(); i.hasNext();) {
        Location location = i.next();
        Instruction instruction = location.getHandle().getInstruction();
        short opcode = instruction.getOpcode();

        int produces = instruction.produceStack(cpg);
        if (instruction instanceof InvokeInstruction) {
            // Model return value
            registerReturnValueSource(location);
        } else if (opcode == Constants.GETFIELD || opcode == Constants.GETSTATIC) {
            // Model field loads
            registerFieldLoadSource(location);
        } else if (instruction instanceof LDC) {
            // Model constant values
            registerLDCValueSource(location);
        } else if (instruction instanceof LDC2_W) {
            // Model constant values
            registerLDC2ValueSource(location);
        } else if (instruction instanceof ConstantPushInstruction) {
            // Model constant values
            registerConstantPushSource(location);
        } else if (instruction instanceof ACONST_NULL) {
            // Model constant values
            registerPushNullSource(location);
        } else  if ((produces == 1 || produces == 2) && !(instruction instanceof LocalVariableInstruction) && !(instruction instanceof CHECKCAST)){
            // Model other sources
            registerOtherSource(location);
        }
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:32,代码来源:ForwardTypeQualifierDataflowAnalysis.java

示例5: visitCHECKCAST

import org.apache.bcel.generic.CHECKCAST; //导入依赖的package包/类
/** Checks if the constraints of operands of the said instruction(s) are satisfied. */
public void visitCHECKCAST(CHECKCAST o){
	indexValid(o, o.getIndex());
	Constant c = cpg.getConstant(o.getIndex());
	if (!	(c instanceof ConstantClass)){
		constraintViolated(o, "Expecting a CONSTANT_Class operand, but found a '"+c+"'.");
	}
}
 
开发者ID:Hu6,项目名称:VestaClient,代码行数:9,代码来源:Pass3aVerifier.java

示例6: noAliasesStoreWithIndexBefore

import org.apache.bcel.generic.CHECKCAST; //导入依赖的package包/类
/**
 * Checks that any store in this basic block to the specified variable is the
 * result of a new() or a null.
 * @param ih handle up to where to investigate.
 * @param localVarIndex the local variable index
 * @return true if all stores are OK or there are no stores.
 */
boolean noAliasesStoreWithIndexBefore(InstructionHandle ih, LocalVariableGen lg) {
    InstructionHandle prev = null;
    for (InstructionContext ic : instructions) {
        InstructionHandle current = ic.getInstruction();
        if (current.equals(ih)) {
            break;
        }

        if (methodGen.instructionStoresTo(current, lg.getIndex())) {
            LocalVariableGen l1 = methodGen.findLocalVar(current, lg.getIndex(), false);
            if (l1 != lg) {
                prev = current;
                continue;
            }
            if (prev != null) {
                Instruction i = prev.getInstruction();
                if (i instanceof INVOKESPECIAL) {
                    INVOKESPECIAL invoker = (INVOKESPECIAL) i;
                    if (invoker.getMethodName(methodGen.getConstantPool()).equals("<init>")
                        && isNonEscapingConstructor(invoker)) {
                        continue;
                    }
                }
                if (i instanceof CHECKCAST) {
            	InstructionHandle pp = prev.getPrev();
            	if (pp != null) {
            	    i = pp.getInstruction();
            	}
                }
                if (i instanceof NEWARRAY
                        || i instanceof ANEWARRAY || i instanceof MULTIANEWARRAY
                        || i instanceof ConstantPushInstruction || i instanceof ACONST_NULL) {
                     prev = current;
                     continue;
                }
            }
            return false;

        }
        prev = current;
    }
    return true;
}
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:51,代码来源:LoadAwareBasicBlock.java

示例7: createInstructionCheckcast

import org.apache.bcel.generic.CHECKCAST; //导入依赖的package包/类
@SuppressWarnings("unused")
// Called using reflection
private Instruction createInstructionCheckcast(Element inst) throws IllegalXMLVMException {
    String classType = inst.getAttributeValue("type");
    return new CHECKCAST(constantPoolGen.addClass(classType));
}
 
开发者ID:shannah,项目名称:cn1,代码行数:7,代码来源:JavaByteCodeOutputProcess.java

示例8: prescreen

import org.apache.bcel.generic.CHECKCAST; //导入依赖的package包/类
public boolean prescreen(ClassContext classContext, Method method) {
    BitSet bytecodeSet = classContext.getBytecodeSet(method);
    return bytecodeSet != null && (bytecodeSet.get(Constants.CHECKCAST) || bytecodeSet.get(Constants.INSTANCEOF));
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:5,代码来源:FindBadCast2.java

示例9: visitCHECKCAST

import org.apache.bcel.generic.CHECKCAST; //导入依赖的package包/类
@Override
public void visitCHECKCAST(CHECKCAST obj) {
    // Do nothing
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:5,代码来源:ValueNumberFrameModelingVisitor.java

示例10: visitCHECKCAST

import org.apache.bcel.generic.CHECKCAST; //导入依赖的package包/类
public void visitCHECKCAST( CHECKCAST i ) {
    Type type = i.getType(_cp);
    _out.println("il.append(_factory.createCheckCast(" + BCELifier.printType(type) + "));");
}
 
开发者ID:Hu6,项目名称:VestaClient,代码行数:5,代码来源:BCELFactory.java


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