Example usage for org.objectweb.asm.tree.analysis AnalyzerException AnalyzerException

List of usage examples for org.objectweb.asm.tree.analysis AnalyzerException AnalyzerException

Introduction

In this page you can find the example usage for org.objectweb.asm.tree.analysis AnalyzerException AnalyzerException.

Prototype

public AnalyzerException(final AbstractInsnNode insn, final String message, final Object expected,
        final Value actual) 

Source Link

Document

Constructs a new AnalyzerException .

Usage

From source file:edu.ubc.mirrors.holograms.FrameVerifier.java

License:Open Source License

@Override
public FrameValue naryOperation(AbstractInsnNode insn, List<? extends FrameValue> values)
        throws AnalyzerException {
    if (insn.getOpcode() == Opcodes.INVOKESPECIAL) {
        MethodInsnNode methodNode = (MethodInsnNode) insn;
        if (methodNode.name.charAt(0) == '<') {
            FrameValue target = values.get(0);
            Type targetType = target.getBasicValue().getType();
            Type ownerType = Type.getObjectType(methodNode.owner);
            BasicValue owner = new BasicValue(ownerType);
            FrameValue expected = new FrameValue(owner, insn);
            if (!target.isUninitialized()) {
                throw new AnalyzerException(insn, "Argument 0", expected, target);
            }/*from  w w w  .  j a  v  a 2 s.  com*/
            if (!targetType.equals(ownerType) && !(target.isUninitializedThis()
                    && simplerVerifier.getSuperClass(targetType).equals(ownerType))) {
                throw new AnalyzerException(insn, "Argument 0", expected, target);
            }
            FrameValue result = FrameValue.fromBasicValue(target.getBasicValue());
            int locals = currentFrame.getLocals();
            for (int local = 0; local < locals; local++) {
                if (currentFrame.getLocal(local) == target) {
                    currentFrame.setLocal(local, result);
                }
            }
            Stack<FrameValue> stack = new Stack<FrameValue>();
            while (currentFrame.getStackSize() > 0) {
                FrameValue value = currentFrame.pop();
                if (value == target) {
                    value = result;
                }
                stack.push(value);
            }
            while (!stack.empty()) {
                currentFrame.push(stack.pop());
            }
        }
    }

    List<BasicValue> basicValues = new ArrayList<BasicValue>(values.size());
    for (FrameValue value : values) {
        basicValues.add(value.getBasicValue());
    }

    return FrameValue.fromBasicValue(simplerVerifier.naryOperation(insn, basicValues));
}

From source file:edu.ubc.mirrors.holograms.FrameVerifier.java

License:Open Source License

private BasicValue checkUninitialized(AbstractInsnNode insn, String msg, FrameValue value)
        throws AnalyzerException {
    if (value.isUninitialized()) {
        throw new AnalyzerException(insn, msg, "initialized value", value);
    }// w ww. j a  va  2 s.  com
    return value.getBasicValue();
}

From source file:jaspex.speculation.newspec.FlowFrame.java

License:Open Source License

/** Testa que BasicValue no  um MergedUninitializedValue e faz strip se for um Future **/
private BasicValue checkAndPrepare(AbstractInsnNode insn, BasicValue value) throws AnalyzerException {
    if (value instanceof MergedUninitializedValue) {
        throw new AnalyzerException(insn, "MergedUninitializedValue during checkAndPrepare",
                "an object reference", value);
    }//from ww  w.ja  v  a  2 s  .  c  o  m
    return stripFuture(value);
}