Package org.apache.bcel.generic

Examples of org.apache.bcel.generic.ReferenceType


                return b;
            } else if (bType == T_NULL) {
                return a;
            }

            ReferenceType aRef = (ReferenceType) a;
            ReferenceType bRef = (ReferenceType) b;
            return mergeReferenceTypes(aRef, bRef);
        } else if (isReferenceType(aType) || isReferenceType(bType)) {
            // meet
            // non-object
            // is
View Full Code Here


            return TypeFrame.getTopType();
        }

        // Compute first common superclass
        ThrownExceptionIterator i = iterator();
        ReferenceType result = i.next();
        while (i.hasNext()) {
            if (Subtypes2.ENABLE_SUBTYPES2_FOR_COMMON_SUPERCLASS_QUERIES) {
                result = AnalysisContext.currentAnalysisContext().getSubtypes2().getFirstCommonSuperclass(result, i.next());
            } else {
                result = result.getFirstCommonSuperclass(i.next());
            }
            if (result == null) {
                // This should only happen if the class hierarchy
                // is incomplete. We'll just be conservative.
                result = Type.THROWABLE;
View Full Code Here

            Type fieldType = Type.getType(f.getSignature());
            if (!(fieldType instanceof ReferenceType)) {
                removeProperty(f);
                continue;
            }
            ReferenceType storeType = type.getLoadType((ReferenceType) fieldType);
            if (storeType.equals(fieldType)) {
                removeProperty(f);
            }
        }
    }
View Full Code Here

            }
            if (!(operandType instanceof ReferenceType)) {
                // Shouldn't happen - illegal bytecode
                continue;
            }
            ReferenceType refType = (ReferenceType) operandType;

            if (refType.equals(NullType.instance())) {
                continue;
            }

            try {

                double isSerializable = DeepSubtypeAnalysis.isDeepSerializable(refType);

                if (isSerializable < 0.9) {
                    SourceLineAnnotation sourceLineAnnotation = SourceLineAnnotation.fromVisitedInstruction(classContext,
                            methodGen, sourceFile, handle);
                    ReferenceType problem = DeepSubtypeAnalysis.getLeastSerializableTypeComponent(refType);

                    bugAccumulator.accumulateBug(new BugInstance(this, "J2EE_STORE_OF_NON_SERIALIZABLE_OBJECT_INTO_SESSION",
                            isSerializable < 0.15 ? HIGH_PRIORITY : isSerializable > 0.5 ? LOW_PRIORITY : NORMAL_PRIORITY)
                    .addClassAndMethod(methodGen, sourceFile).addType(problem).describe(TypeAnnotation.FOUND_ROLE),
                    sourceLineAnnotation);
View Full Code Here

        }
        return loadType;
    }

    private void computeLoadType(ReferenceType fieldType) {
        ReferenceType leastSupertype = null;

        for (Iterator<String> i = signatureIterator(); i.hasNext();) {
            try {
                String signature = i.next();
                Type type = Type.getType(signature);
                if (!(type instanceof ReferenceType)) {
                    continue;
                }

                // FIXME: this will mangle interface types, since
                // getFirstCommonSuperclass() ignores interfaces.
                /*
                 * leastSupertype = (leastSupertype == null) ? (ReferenceType)
                 * type :
                 * leastSupertype.getFirstCommonSuperclass((ReferenceType)
                 * type);
                 */
                if (leastSupertype == null) {
                    leastSupertype = (ReferenceType) type;
                } else {
                    if (Subtypes2.ENABLE_SUBTYPES2_FOR_COMMON_SUPERCLASS_QUERIES) {
                        leastSupertype = AnalysisContext.currentAnalysisContext().getSubtypes2()
                                .getFirstCommonSuperclass(leastSupertype, (ReferenceType) type);
                    } else {
                        leastSupertype = leastSupertype.getFirstCommonSuperclass((ReferenceType) type);
                    }
                }

            } catch (ClassFormatException e) {
                // Bad signature: ignore
View Full Code Here


                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);
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
View Full Code Here

            }
            if (!(operandType instanceof ReferenceType)) {
                // Shouldn't happen - illegal bytecode
                continue;
            }
            ReferenceType refType = (ReferenceType) operandType;

            if (refType.equals(NullType.instance())) {
                continue;
            }

            try {

                double isSerializable = DeepSubtypeAnalysis.isDeepSerializable(refType);

                if (isSerializable >= 0.9) {
                    continue;
                }

                ReferenceType problem = DeepSubtypeAnalysis.getLeastSerializableTypeComponent(refType);

                double isRemote = DeepSubtypeAnalysis.isDeepRemote(refType);
                if (isRemote >= 0.9) {
                    continue;
                }
View Full Code Here

            } else {
                return type;
            }
        }

        ReferenceType result = type;
        double value =  isDeepSerializable(type.getSignature());
        if (type instanceof GenericObjectType && Subtypes2.isContainer(type)) {
            GenericObjectType gt = (GenericObjectType) type;
            List<? extends ReferenceType> parameters = gt.getParameters();
            if (parameters != null) {
View Full Code Here

        // Easy case: same types
        if (a.equals(b)) {
            return a;
        }

        ReferenceType answer = checkFirstCommonSuperclassQueryCache(a, b);
        if (answer == null) {
            answer = computeFirstCommonSuperclassOfReferenceTypes(a, b);
            putFirstCommonSuperclassQueryCache(a, b, answer);
        }
        return answer;
View Full Code Here

TOP

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

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.