Examples of InvokeInstruction


Examples of org.apache.bcel.generic.InvokeInstruction

        }

        @Override
        public boolean mightCloseResource(BasicBlock basicBlock, InstructionHandle handle, ConstantPoolGen cpg)
                throws DataflowAnalysisException {
            InvokeInstruction inv = toInvokeInstruction(handle.getInstruction());
            if (inv == null) {
                return false;
            }

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

            try {
                if (methodName.equals("unlock") && methodSig.equals("()V")
                        && Hierarchy.isSubtype(className, "java.util.concurrent.locks.Lock")) {
View Full Code Here

Examples of org.apache.bcel.generic.InvokeInstruction

                    if (DEBUG && notNull) {
                        System.out.println("Ignoring exception from non-null GETFIELD");
                    }
                    return notNull;
                } else if (ins instanceof InvokeInstruction) {
                    InvokeInstruction iins = (InvokeInstruction) ins;
                    String methodName = iins.getMethodName(cpg);
                    // System.out.println("Method " + methodName);
                    if (methodName.startsWith("access$")) {
                        return true;
                    }
                    if (methodName.equals("readLock") || methodName.equals("writeLock")) {
View Full Code Here

Examples of org.apache.bcel.generic.InvokeInstruction

            }
            if (ins instanceof INVOKEINTERFACE) {
                continue;
            }

            InvokeInstruction inv = (InvokeInstruction) ins;
            TypeFrame frame = typeDataflow.getFactAtLocation(location);

            String methodName = inv.getMethodName(constantPoolGen);
            if (methodName.toLowerCase().indexOf("unsupported") >= 0) {
                continue;
            }
            String methodSig = inv.getSignature(constantPoolGen);
            if (methodSig.equals("()Ljava/lang/UnsupportedOperationException;")) {
                continue;
            }

            Set<XMethod> targets;
View Full Code Here

Examples of org.apache.bcel.generic.InvokeInstruction

            Instruction ins = location.getHandle().getInstruction();
            switch (ins.getOpcode()) {
            case INVOKEVIRTUAL:
            case INVOKEINTERFACE:
                InvokeInstruction iins = (InvokeInstruction) ins;
                String invoking = iins.getName(cpg);
                if ( comparatorMethod(invoking) || booleanComparisonMethod(invoking) ) {
                    if (methodGen.getName().toLowerCase().indexOf("test") >= 0) {
                        break;
                    }
                    if (methodGen.getClassName().toLowerCase().indexOf("test") >= 0) {
                        break;
                    }
                    if (classContext.getJavaClass().getSuperclassName().toLowerCase().indexOf("test") >= 0) {
                        break;
                    }
                    if (location.getHandle().getNext().getInstruction().getOpcode() == POP) {
                        break;
                    }
                    String sig = iins.getSignature(cpg);

                    SignatureParser parser = new SignatureParser(sig);
                    if (parser.getNumParameters() == 1
                            && ( booleanComparisonMethod(invoking&& sig.endsWith(";)Z") || comparatorMethod(invoking) && sig.endsWith(";)I"))) {
                        checkForSelfOperation(classContext, location, valueNumberDataflow, "COMPARISON", method, methodGen,
View Full Code Here

Examples of org.apache.bcel.generic.InvokeInstruction

            InstructionHandle handle = location.getHandle();
            Instruction ins = handle.getInstruction();

            if (ins instanceof InvokeInstruction) {
                InvokeInstruction invoke = (InvokeInstruction) ins;
                String className = invoke.getClassName(cpg);

                if (invoke.getMethodName(cpg).equals("putIfAbsent")) {
                    String signature = invoke.getSignature(cpg);
                    if (signature.equals("(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;")
                            && !(invoke instanceof INVOKESTATIC) && extendsConcurrentMap(className)) {
                        InstructionHandle next = handle.getNext();
                        boolean isIgnored = next != null && next.getInstruction() instanceof POP;
                        //                        boolean isImmediateNullTest = next != null
View Full Code Here

Examples of org.apache.bcel.generic.InvokeInstruction

                if (prevLocation != null && !isSafeValue(prevLocation, cpg)) {
                    stringAppendState.setSawUnsafeAppend(handle);
                }

            } else if (ins instanceof InvokeInstruction) {
                InvokeInstruction inv = (InvokeInstruction) ins;
                String sig1 = inv.getSignature(cpg);
                String sig2 = sig1.substring(sig1.indexOf(')'));

                if (sig2.indexOf("java/lang/String") >= 0) {
                    String methodName = inv.getMethodName(cpg);
                    String className = inv.getClassName(cpg);
                    if (methodName.equals("valueOf") && className.equals("java.lang.String")
                            && sig1.equals("(Ljava/lang/Object;)Ljava/lang/String;")) {
                        try {
                            TypeDataflow typeDataflow = classContext.getTypeDataflow(method);
                            TypeFrame frame = typeDataflow.getFactAtLocation(location);
View Full Code Here

Examples of org.apache.bcel.generic.InvokeInstruction

            Location location = i.next();
            Instruction ins = location.getHandle().getInstruction();
            if (!(ins instanceof InvokeInstruction)) {
                continue;
            }
            InvokeInstruction invoke = (InvokeInstruction) ins;
            if (isDatabaseSink(invoke, cpg)) {
                ConstantFrame frame = dataflow.getFactAtLocation(location);
                int numArguments = frame.getNumArguments(invoke, cpg);
                Constant value = frame.getStackValue(numArguments - 1);
View Full Code Here

Examples of org.apache.bcel.generic.InvokeInstruction

            Instruction ins = thrower.getInstruction();
            if (!(ins instanceof InvokeInstruction)) {
                continue;
            }

            InvokeInstruction inv = (InvokeInstruction) ins;
            boolean foundThrower = false;
            boolean foundNonThrower = false;

            if (inv instanceof INVOKEINTERFACE) {
                continue;
            }

            String className = inv.getClassName(cpg);

            Location loc = new Location(thrower, basicBlock);
            TypeFrame typeFrame = typeDataflow.getFactAtLocation(loc);
            XMethod primaryXMethod = XFactory.createXMethod(inv, cpg);
            // if (primaryXMethod.isAbstract()) continue;
            Set<XMethod> targetSet = null;
            try {

                if (className.startsWith("[")) {
                    continue;
                }
                String methodSig = inv.getSignature(cpg);
                if (!methodSig.endsWith("V")) {
                    continue;
                }

                targetSet = Hierarchy2.resolveMethodCallTargets(inv, typeFrame, cpg);
View Full Code Here

Examples of org.apache.bcel.generic.InvokeInstruction

    enum Use { STORE_INTO_HTTP_SESSION, PASSED_TO_WRITE_OBJECT, STORED_IN_SERIALZIED_FIELD }

    @CheckForNull Use getUse(ConstantPoolGen cpg, Instruction ins) {
        if (ins instanceof InvokeInstruction) {
            InvokeInstruction invoke = (InvokeInstruction) ins;

            String mName = invoke.getMethodName(cpg);
            String cName = invoke.getClassName(cpg);

            if (mName.equals("setAttribute") && cName.equals("javax.servlet.http.HttpSession")) {
                return Use.STORE_INTO_HTTP_SESSION;
            }
            if (mName.equals("writeObject")
View Full Code Here

Examples of org.apache.bcel.generic.InvokeInstruction

        ConstantPoolGen cpg = cfg.getMethodGen().getConstantPool();
        if (ins instanceof IfInstruction && ins.consumeStack(cpg) == 2) {
            isTest = true;
        else if (ins instanceof InvokeInstruction && ins.consumeStack(cpg) == 2) {
            InvokeInstruction invoke = (InvokeInstruction) ins;
            isTest = invoke.getMethodName(cpg).equals("equals") &&invoke.getSignature(cpg).equals("(Ljava/lang/Object;)Z") ;
        }
        if (isTest) {
            ValueNumber top = factAtLocation.getStackValue(0);
            if (top.hasFlag(ValueNumber.CONSTANT_VALUE)) {
                return;
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.