Package edu.umd.cs.findbugs.classfile

Examples of edu.umd.cs.findbugs.classfile.ClassDescriptor


    @Override
    public void sawOpcode(int seen) {
        if (seen == INVOKEVIRTUAL) {
            if (getNameConstantOperand().equals("equals") && getSigConstantOperand().equals("(Ljava/lang/Object;)Z")) {
                OpcodeStack.Item item = stack.getStackItem(1);
                ClassDescriptor c = DescriptorFactory.createClassDescriptorFromSignature(item.getSignature());
                check(c);

            } else if (getClassConstantOperand().equals("java/lang/Class")
                    && (getNameConstantOperand().equals("isInstance") || getNameConstantOperand().equals("cast"))) {
                OpcodeStack.Item item = stack.getStackItem(1);
                if (item.getSignature().equals("Ljava/lang/Class;")) {
                    Object value = item.getConstant();
                    if (value instanceof String) {
                        ClassDescriptor c = DescriptorFactory.createClassDescriptor((String) value);
                        check(c);
                    }
                }

            }
View Full Code Here


     *
     */
    private void check(ClassDescriptor c) {
        OpcodeStack.Item item = stack.getStackItem(0);
        if (item.isInitialParameter() && item.getRegisterNumber() == 1) {
            ClassDescriptor thisClassDescriptor = getClassDescriptor();
            if (c.equals(thisClassDescriptor)) {
                return;
            }
            Subtypes2 subtypes2 = AnalysisContext.currentAnalysisContext().getSubtypes2();
            try {
                if (!c.isArray() && (subtypes2.isSubtype(c, thisClassDescriptor) || subtypes2.isSubtype(thisClassDescriptor, c))) {
                    return;
                }

                Type thisType = Type.getType(thisClassDescriptor.getSignature());
                Type cType = Type.getType(c.getSignature());
                IncompatibleTypes check = IncompatibleTypes.getPriorityForAssumingCompatible(thisType, cType, false);
                int priority = check.getPriority();
                if ("java/lang/Object".equals(getSuperclassName()) && ClassName.isAnonymous(getClassName())) {
                    priority++;
View Full Code Here

    private boolean checkForWeirdEquals(String lhsSig, String rhsSig, Set<XMethod> targets) {
        boolean allOk = false;
        try {
            ClassSummary classSummary = AnalysisContext.currentAnalysisContext().getClassSummary();

            ClassDescriptor expectedClassDescriptor = DescriptorFactory.createClassDescriptorFromSignature(lhsSig);
            ClassDescriptor actualClassDescriptor = DescriptorFactory.createClassDescriptorFromSignature(rhsSig);

            targets.addAll(Hierarchy2.resolveVirtualMethodCallTargets(expectedClassDescriptor, "equals", "(Ljava/lang/Object;)Z",
                    false, false));
            allOk = targets.size() > 0;
            for (XMethod m2 : targets) {
View Full Code Here

        if (initializedFields.contains(f)) {
            return;
        }
        FieldSummary fieldSummary = AnalysisContext.currentAnalysisContext().getFieldSummary();

        ClassDescriptor superClassDescriptor = DescriptorFactory.createClassDescriptor(getSuperclassName());
        Set<ProgramPoint> calledFrom = fieldSummary.getCalledFromSuperConstructor(superClassDescriptor, getXMethod());
        if (calledFrom.isEmpty()) {
            return;
        }
        UnreadFieldsData unreadFields = AnalysisContext.currentAnalysisContext().getUnreadFieldsData();
View Full Code Here

        switch (seen) {
        case INVOKEVIRTUAL:
        case INVOKESPECIAL:
        case INVOKESTATIC:
        case INVOKEINTERFACE:
            ClassDescriptor c = getClassDescriptorOperand();
            Subtypes2 subtypes2 = AnalysisContext.currentAnalysisContext().getSubtypes2();
            if (subtypes2.isApplicationClass(c)) {
                xFactory.addCalledMethod(getMethodDescriptorOperand());
            }
View Full Code Here

                    a = a.substring(1);
                    ma = ma.substring(1);
                }
                if (ma.startsWith("Q")) {
                    ma = stripFirstAndLast(ma);
                    ClassDescriptor ad = DescriptorFactory.createClassDescriptorFromFieldSignature(a);
                    if (ad == null) {
                        continue nextMethod;
                    }
                    a = ad.getSimpleName();
                }
                if (!ma.equals(a)) {
                    continue nextMethod;
                }
            }
View Full Code Here

TOP

Related Classes of edu.umd.cs.findbugs.classfile.ClassDescriptor

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.