Examples of InvokeInstruction


Examples of org.apache.bcel.generic.InvokeInstruction

            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

Examples of org.apache.bcel.generic.InvokeInstruction

        }
    }

    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

Examples of org.apache.bcel.generic.InvokeInstruction

                    throws DataflowAnalysisException {
        if (invFrame != null && !invFrame.isValid()) {
            return Collections.emptySet();
        }

        InvokeInstruction inv = (InvokeInstruction) location.getHandle().getInstruction();

        SignatureParser sigParser = new SignatureParser(inv.getSignature(constantPool));
        int numParams = sigParser.getNumParameters();
        if (numParams == 0 || !sigParser.hasReferenceParameters()) {
            return Collections.emptySet();
        }
        ParameterNullnessPropertyDatabase database = AnalysisContext.currentAnalysisContext()
View Full Code Here

Examples of org.apache.bcel.generic.InvokeInstruction

        if (invFrame != null && !invFrame.isValid()) {
            return Collections.emptySet();
        }
        INullnessAnnotationDatabase database = AnalysisContext.currentAnalysisContext().getNullnessAnnotationDatabase();

        InvokeInstruction inv = (InvokeInstruction) location.getHandle().getInstruction();
        XMethod called = XFactory.createXMethod(inv, constantPool);
        SignatureParser sigParser = new SignatureParser(called.getSignature());
        int numParams = sigParser.getNumParameters();

        Set<ValueNumber> result = new HashSet<ValueNumber>();
View Full Code Here

Examples of org.apache.bcel.generic.InvokeInstruction

        Number constantValue = instruction.getValue();
        registerConstantSource(location, constantValue);
    }
    private void registerReturnValueSource(Location location) throws DataflowAnalysisException {
        // Nothing to do if called method does not return a value
        InvokeInstruction inv = (InvokeInstruction) location.getHandle().getInstruction();
        String calledMethodSig = inv.getSignature(cpg);
        if (calledMethodSig.endsWith(")V")) {
            return;
        }

        XMethod calledXMethod = XFactory.createXMethod(inv, cpg);
View Full Code Here

Examples of org.apache.bcel.generic.InvokeInstruction

            Instruction ins = handle.getInstruction();

            boolean wasMethodInvocationWasGeneric = methodInvocationWasGeneric;
            methodInvocationWasGeneric = false;
            if (ins instanceof InvokeInstruction) {
                InvokeInstruction iinv = (InvokeInstruction) ins;
                XMethod m = XFactory.createXMethod(iinv, cpg);
                if (m != null) {
                    String sourceSignature = m.getSourceSignature();
                    methodInvocationWasGeneric = sourceSignature != null
                            && (sourceSignature.startsWith("<") || sourceSignature.indexOf("java/lang/Class") >= 0);
View Full Code Here

Examples of org.apache.bcel.generic.InvokeInstruction

        Instruction ins = location.getHandle().getInstruction();
        BugAnnotation cause;
        final ConstantPoolGen cpg = classContext.getConstantPoolGen();

        if (ins instanceof InvokeInstruction) {
            InvokeInstruction iins = (InvokeInstruction) ins;
            XMethod invokedMethod = XFactory.createXMethod((InvokeInstruction) ins, cpg);
            cause = MethodAnnotation.fromXMethod(invokedMethod);
            cause.setDescription(MethodAnnotation.METHOD_CALLED);

            if (iins.getMethodName(cpg).equals("close") && iins.getSignature(cpg).equals("()V")) {
                propertySet.addProperty(NullDerefProperty.CLOSING_NULL);
            }
        } else if (ins instanceof FieldInstruction) {
            FieldInstruction fins = (FieldInstruction) ins;
            XField referencedField = XFactory.createXField(fins, cpg);
View Full Code Here

Examples of org.apache.bcel.generic.InvokeInstruction

            // Only consider invoke instructions
            if (!(ins instanceof InvokeInstruction)) {
                continue;
            }

            InvokeInstruction inv = (InvokeInstruction) ins;

            XMethod invokedMethod = XFactory.createXMethod(inv, cpg);

            String invokedMethodName = invokedMethod.getName();
            String argSignature = invokedMethod.getSignature();
            argSignature = argSignature.substring(0, argSignature.indexOf(')') + 1);
            String call = invokedMethodName+argSignature;
            SignatureParser sigParser = new SignatureParser(inv.getSignature(cpg));

            Collection<Info> collection = callMap.get(call);
            if (!callMap.containsKey(call)) {
                continue;
            }
View Full Code Here

Examples of org.apache.bcel.generic.InvokeInstruction

            if (DEBUG) {
                System.out.println("PC : " + handle.getPosition() + " " + ins);
            }
            if (DEBUG && ins instanceof InvokeInstruction) {
                InvokeInstruction iins = (InvokeInstruction) ins;
                System.out.println("  " + ins.toString(cpg.getConstantPool()));
            }
            if (DEBUG) {
                System.out.println("resource frame before instruction: " + frame.toString());
            }
View Full Code Here

Examples of org.apache.bcel.generic.InvokeInstruction

        @Override
        public Lock isResourceCreation(BasicBlock basicBlock, InstructionHandle handle, ConstantPoolGen cpg)
                throws DataflowAnalysisException {

            InvokeInstruction inv = toInvokeInstruction(handle.getInstruction());
            if (inv == null) {
                return null;
            }

            String className = inv.getClassName(cpg);
            String methodName = inv.getName(cpg);
            String methodSig = inv.getSignature(cpg);

            try {
                if (methodName.equals("lock") && methodSig.equals("()V")
                        && Hierarchy.isSubtype(className, "java.util.concurrent.locks.Lock")) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.