Package org.apache.bcel.generic

Examples of org.apache.bcel.generic.InvokeInstruction


                    break;
                }
            }
            Instruction i = h.getInstruction();
            if (i instanceof InvokeInstruction) {
                InvokeInstruction ii = (InvokeInstruction) i;
                String name = ii.getMethodName(classContext.getConstantPoolGen());
                if (name.startsWith("check") || name.startsWith("assert")) {
                    return true;
                }
            }
            h = h.getNext();
View Full Code Here


                InstructionHandle handle = location.getHandle();
                Instruction ins = handle.getInstruction();
                ValueNumberFrame valueNumberFrame = vna.getFactAtLocation(location);
                TypeFrame typeFrame = typeDataflow.getFactAtLocation(location);
                if (ins instanceof InvokeInstruction) {
                    InvokeInstruction inv = (InvokeInstruction) ins;
                    XMethod m = XFactory.createXMethod(inv, cpg);
                    SignatureParser sigParser = new SignatureParser(m.getSignature());
                    int numParams = sigParser.getNumParameters();

                    // Check nonnull annotations
View Full Code Here

        if (actionList == null) {
            Instruction ins = handle.getInstruction();
            actionList = Collections.emptyList();
            if (ins instanceof InvokeInstruction) {

                InvokeInstruction inv = (InvokeInstruction) ins;
                XMethod invokedMethod = XFactory.createXMethod(inv, cpg);
                String signature = invokedMethod.getSignature();
                String methodName = invokedMethod.getName();

                if (DEBUG_LOOKUP) {
                    System.out.println("Looking up actions for call to " + invokedMethod);
                }


                if (invokedMethod.getAnnotationDescriptors().contains(WILL_CLOSE) && methodName.startsWith("close") && signature.endsWith(")V")) {
                    actionList = Collections.singletonList(ObligationPolicyDatabaseAction.CLEAR);
                } else if (signature.indexOf(';') >= -1) {
                    ReferenceType receiverType = inv.getReferenceType(cpg);

                    boolean isStatic = inv.getOpcode() == Constants.INVOKESTATIC;
                    actionList = new LinkedList<ObligationPolicyDatabaseAction>();

                    database.getActions(receiverType, methodName, signature, isStatic, actionList);

                    if (actionList.isEmpty()) {
View Full Code Here

            }

            // Is invoked class a subtype of the base class we want
            // FIXME: should test be different for INVOKESPECIAL and
            // INVOKESTATIC?
            InvokeInstruction inv = (InvokeInstruction) ins;
            ReferenceType classType = inv.getReferenceType(cpg);
            if (!Hierarchy.isSubtype(classType, baseClassType)) {
                return null;
            }

            // See if method name and signature match
            String methodName = inv.getMethodName(cpg);
            String methodSig = inv.getSignature(cpg);
            if (!this.methodName.equals(methodName) || !this.methodSig.equals(methodSig)) {
                return null;
            }

            String streamClass = type.getClassName();
View Full Code Here

            if (!(ins instanceof InvokeInstruction)) {
                continue;
            }

            InvokeInstruction invoke = (InvokeInstruction) ins;
            String mName = invoke.getMethodName(cpg);
            if (!mName.equals("writeObject")) {
                continue;
            }
            String cName = invoke.getClassName(cpg);
            if (!cName.equals("java.io.ObjectOutput") && !cName.equals("java.io.ObjectOutputStream")) {
                continue;
            }

            TypeFrame frame = typeDataflow.getFactAtLocation(location);
View Full Code Here

        }
        if (ins.getOpcode() == Constants.INVOKESTATIC) {
            return false;
        }

        InvokeInstruction inv = (InvokeInstruction) ins;
        String methodName = inv.getMethodName(cpg);
        String methodSig = inv.getSignature(cpg);

        return isMonitorWait(methodName, methodSig);
    }
View Full Code Here

        }
        if (ins.getOpcode() == Constants.INVOKESTATIC) {
            return false;
        }

        InvokeInstruction inv = (InvokeInstruction) ins;
        String methodName = inv.getMethodName(cpg);
        String methodSig = inv.getSignature(cpg);

        return isMonitorNotify(methodName, methodSig);
    }
View Full Code Here

        }
        Location location = new Location(handle, basicBlock);

        Instruction i = handle.getInstruction();
        if (i instanceof InvokeInstruction) {
            InvokeInstruction ii = (InvokeInstruction) i;
            XMethod m = XFactory.createXMethod(ii, cpg);
            if (TypeQualifierDataflowAnalysis.isIdentifyFunctionForTypeQualifiers(m)) {
                ValueNumberFrame vnaFrameAtLocation = vnaDataflow.getFactAtLocation(location);
                ValueNumberFrame vnaFrameAfterInstruction = vnaDataflow.getFactAfterLocation(location);
                ValueNumber in = vnaFrameAtLocation.getStackValue(0);
View Full Code Here

            modifyLock(frame, fact, opcode == Constants.MONITORENTER ? 1 : -1);

        } else if (opcode == Constants.INVOKEVIRTUAL || opcode == Constants.INVOKEINTERFACE) {

            InvokeInstruction inv = (InvokeInstruction) ins;
            String name = inv.getMethodName(methodGen.getConstantPool());
            String sig = inv.getSignature(methodGen.getConstantPool());
            ValueNumberFrame frame = vnaDataflow.getFactAtLocation(new Location(handle, basicBlock));

            if (sig.equals("()V") && (name.equals("lock") || name.equals("lockInterruptibly"))) {
                modifyLock(frame, fact, 1);
            } else if (sig.equals("()V") && (name.equals("unlock"))) {
View Full Code Here

        }
    }

    private void modelArguments(Location location) throws DataflowAnalysisException {
        // Model arguments to called method
        InvokeInstruction inv = (InvokeInstruction) location.getHandle().getInstruction();
        XMethod calledMethod = XFactory.createXMethod(inv, cpg);

        SignatureParser sigParser = new SignatureParser(calledMethod.getSignature());
        if (sigParser.getNumParameters() == 0) {
            return;
View Full Code Here

TOP

Related Classes of org.apache.bcel.generic.InvokeInstruction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.