Package edu.umd.cs.findbugs.classfile

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


            }
            prevWasSuperEquals = false;
        }

        if (seen == INSTANCEOF && stack.getStackDepth() > 0 && stack.getStackItem(0).getRegisterNumber() == 1) {
            ClassDescriptor instanceOfCheck = getClassDescriptorOperand();
            if (instanceOfCheck.equals(getClassDescriptor())) {
                sawInstanceOf = true;
            } else {
                try {
                    if (AnalysisContext.currentAnalysisContext().getSubtypes2().isSubtype(getClassDescriptor(), instanceOfCheck)) {
                        sawInstanceOfSupertype = true;
                    }
                } catch (ClassNotFoundException e) {
                    sawInstanceOfSupertype = true;
                }
            }
        }

        if (seen == CHECKCAST && stack.getStackDepth() > 0 && stack.getStackItem(0).getRegisterNumber() == 1) {
            ClassDescriptor castTo = getClassDescriptorOperand();
            if (castTo.equals(getClassDescriptor())) {
                sawCheckedCast = true;
            }
            try {
                if (AnalysisContext.currentAnalysisContext().getSubtypes2().isSubtype(getClassDescriptor(), castTo)) {
                    sawCheckedCast = true;
View Full Code Here


        }

    }

    private boolean isJunit3TestCase(XClass jClass) throws ClassNotFoundException {
        ClassDescriptor sDesc = jClass.getSuperclassDescriptor();
        if (sDesc == null) {
            return false;
        }
        String sName = sDesc.getClassName();
        if (sName.equals("junit/framework/TestCase")) {
            return true;
        }
        if (sName.equals("java/lang/Object")) {
            return false;
View Full Code Here

     */
    public static boolean isUncheckedException(ObjectType type) throws ClassNotFoundException {
        if (type.equals(Type.THROWABLE) || type.equals(RUNTIME_EXCEPTION_TYPE) || type.equals(ERROR_TYPE)) {
            return true;
        }
        ClassDescriptor c = DescriptorFactory.getClassDescriptor(type);
        Subtypes2 subtypes2 = Global.getAnalysisCache().getDatabase(Subtypes2.class);
        return subtypes2.isSubtype(c, RUNTIME_EXCEPTION, ERROR);

    }
View Full Code Here

        AnalysisContext analysisContext = AnalysisContext.currentAnalysisContext();

        // Get the receiver class.
        String receiverClassName = ((ObjectType) receiverType).getClassName();
        JavaClass receiverClass = analysisContext.lookupClass(receiverClassName);
        ClassDescriptor receiverDesc = DescriptorFactory.createClassDescriptorFromDottedClassName(receiverClassName);

        // Figure out the upper bound for the method.
        // This is what will be called if this is not a virtual call site.
        JavaClassAndMethod upperBound = findMethod(receiverClass, methodName, methodSig, CONCRETE_METHOD);
        if (upperBound == null) {
View Full Code Here

        public void addAccessFlags(int accessFlags) {
            this.accessFlags |= accessFlags;
        }

        public void addAnnotation(String name, AnnotationValue value) {
            ClassDescriptor annotationClass = DescriptorFactory.createClassDescriptorFromSignature(name);
            methodAnnotations.put(annotationClass, value);
        }
View Full Code Here

            ClassDescriptor annotationClass = DescriptorFactory.createClassDescriptorFromSignature(name);
            methodAnnotations.put(annotationClass, value);
        }

        public void addParameterAnnotation(int parameter, String name, AnnotationValue value) {
            ClassDescriptor annotationClass = DescriptorFactory.createClassDescriptorFromSignature(name);
            Map<ClassDescriptor, AnnotationValue> map = methodParameterAnnotations.get(parameter);
            if (map == null) {
                map = new HashMap<ClassDescriptor, AnnotationValue>();
                methodParameterAnnotations.put(parameter, map);
            }
View Full Code Here

        // then we have an easy answer.
        Throwable cause = ex.getCause();
        if (cause instanceof ResourceNotFoundException) {
            String resourceName = ((ResourceNotFoundException) cause).getResourceName();
            if (resourceName != null) {
                ClassDescriptor classDesc = DescriptorFactory.createClassDescriptorFromResourceName(resourceName);
                return classDesc.toDottedClassName();
            }
        }

        if (ex.getMessage() == null) {
            return null;
View Full Code Here

            result = Math.max(result, Math.max(mapResult, collectionResult) * 0.95);
            if (result >= 0.9) {
                return result;
            }
        }
        ClassDescriptor classDescriptor = DescriptorFactory.createClassDescriptor(x);

        Subtypes2 subtypes2 = AnalysisContext.currentAnalysisContext().getSubtypes2();

        Set<ClassDescriptor> directSubtypes = subtypes2.getDirectSubtypes(classDescriptor);
        directSubtypes.remove(classDescriptor);
View Full Code Here

        public void setSourceSignature(String fieldSourceSignature) {
            this.fieldSourceSignature = fieldSourceSignature;
        }

        public void addAnnotation(String name, AnnotationValue value) {
            ClassDescriptor annotationClass = DescriptorFactory.createClassDescriptorFromSignature(name);
            fieldAnnotations.put(annotationClass, value);
        }
View Full Code Here

                return Global.getAnalysisCache().getClassAnalysis(XClass.class, getImmediateEnclosingClass());
            }
            if (getClassName().endsWith("package-info")) {
                return null;
            }
            ClassDescriptor p = DescriptorFactory.createClassDescriptor(getSlashedPackageName() + "/" + "package-info");
            return Global.getAnalysisCache().getClassAnalysis(XClass.class, p);
        } catch (CheckedAnalysisException e) {
            return null;
        }
    }
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.