Package org.apache.bcel.generic

Examples of org.apache.bcel.generic.ReferenceType


        return firstCommonSupertype;
    }

    private void putFirstCommonSuperclassQueryCache(ReferenceType a, ReferenceType b, ReferenceType answer) {
        if (a.getSignature().compareTo(b.getSignature()) > 0) {
            ReferenceType tmp = a;
            a = b;
            b = tmp;
        }
        firstCommonSuperclassQueryCache.put(a, b, answer);
    }
View Full Code Here


        firstCommonSuperclassQueryCache.put(a, b, answer);
    }

    private ReferenceType checkFirstCommonSuperclassQueryCache(ReferenceType a, ReferenceType b) {
        if (a.getSignature().compareTo(b.getSignature()) > 0) {
            ReferenceType tmp = a;
            a = b;
            b = tmp;
        }
        return firstCommonSuperclassQueryCache.get(a, b);
    }
View Full Code Here

        List<ReferenceType> types = new ArrayList<ReferenceType>();

        Iterator<String> iter = parser.parameterSignatureIterator();
        while (iter.hasNext()) {
            String parameterString = iter.next();
            ReferenceType t = (ReferenceType) getType(parameterString);
            if (t == null) {
                return null;
            }
            types.add(t);
        }
View Full Code Here

            }
            if (!(operandType instanceof ReferenceType)) {
                // Shouldn't happen - illegal bytecode
                continue;
            }
            final ReferenceType refType = (ReferenceType) operandType;
            boolean impliesByGenerics = typeDataflow.getAnalysis().isImpliedByGenericTypes(refType);

            if (impliesByGenerics && !isCast) {
                continue;
            }

            final boolean typesAreEqual = refType.equals(castType);
            if (isCast && typesAreEqual) {
                // System.out.println("self-cast to " +
                // castType.getSignature());
                continue;
            }

            String refSig = refType.getSignature();
            String castSig2 = castSig;
            String refSig2 = refSig;
            while (castSig2.charAt(0) == '[' && refSig2.charAt(0) == '[') {
                castSig2 = castSig2.substring(1);
                refSig2 = refSig2.substring(1);
View Full Code Here

            }
            XField xfield = getXField();
            Type type = TypeFrameModelingVisitor.getType(xfield);
            if (type instanceof ReferenceType) {
                try {
                    ReferenceType rtype = (ReferenceType) type;

                    double isSerializable = DeepSubtypeAnalysis.isDeepSerializable(rtype);
                    if (DEBUG) {
                        System.out.println("  isSerializable: " + isSerializable);
                    }
                    if (isSerializable < 1.0) {
                        fieldsThatMightBeAProblem.put(obj.getName(), xfield);
                    }
                    if (isSerializable < 0.9) {
                        ReferenceType problemType = DeepSubtypeAnalysis.getLeastSerializableTypeComponent(rtype);

                        // Priority is LOW for GUI classes (unless explicitly marked
                        // Serializable),
                        // HIGH if the class directly implements Serializable,
                        // NORMAL otherwise.
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);

                    String pattern;
                    switch(use) {
                    case PASSED_TO_WRITE_OBJECT:
                        pattern = "DMI_NONSERIALIZABLE_OBJECT_WRITTEN";
View Full Code Here

        List<ReferenceType> parameters = GenericUtilities
                .getTypeParameters("Lcom/google/common/util/WeakIdentityHashMap<TK;TV;>.IdentityWeakReference;TV;");

        System.out.println(parameters);
        assertEquals(2, parameters.size());
        ReferenceType t = parameters.get(0);
        assertEquals("com.google.common.util.WeakIdentityHashMap$IdentityWeakReference", t.toString());
    }
View Full Code Here

        // }
        String declaringClassName = field.getDeclaringClass().getName();
        InstructionList instructionList = new InstructionList();
        // push 'target' onto operand stack
        instructionList.append(new ALOAD(1));
        ReferenceType targetType = new ObjectType(declaringClassName);
        instructionList.append(instructionFactory.createCheckCast(targetType));

        Class fieldTypeClass = field.getType();
        Type fieldType = computeType(fieldTypeClass);
        pushAndConvertValueArg(instructionList, instructionFactory,
View Full Code Here

        // pushd 'target' onto operand stack
        instructionList.append(new ALOAD(1));

        boolean isStaticField = Modifier.isStatic(field.getModifiers());
        String declaringClassName = field.getDeclaringClass().getName();
        ReferenceType targetType = new ObjectType(declaringClassName);
        Class fieldTypeClass = field.getType();
        Type fieldType = computeType(fieldTypeClass);
        if (isStaticField) {
            // handle static fields -- simply pop rather than checkcast
            instructionList.append(new POP());
View Full Code Here

        InstructionList instructionList = new InstructionList();
        // pushd 'target' onto operand stack
        instructionList.append(new ALOAD(1));

        String targetClassName = method.getDeclaringClass().getName();
        ReferenceType targetType = new ObjectType(targetClassName);
        // generate invoke instruction
        Class returnTypeClass = method.getReturnType();
        Type returnType = computeType(returnTypeClass);
        boolean isStaticMethod = Modifier.isStatic(method.getModifiers());
        if (!isStaticMethod) {
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.