Package edu.umd.cs.findbugs.classfile

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


     */
    public static TypeQualifierAnnotation constructTypeQualifierAnnotation(AnnotationValue v) {
        assert v != null;
        EnumValue whenValue = (EnumValue) v.getValue("when");
        When when = whenValue == null ? When.ALWAYS : When.valueOf(whenValue.value);
        ClassDescriptor annotationClass = v.getAnnotationClass();
        TypeQualifierValue<?> tqv = TypeQualifierValue.getValue(annotationClass, v.getValue("value"));
        TypeQualifierAnnotation tqa = TypeQualifierAnnotation.getValue(tqv, when);
        return tqa;
    }
View Full Code Here


                System.out.println("  ===> checking " + type.getDescriptor());
            }
            if (type.getDescriptor().startsWith("[")) {
                continue;
            }
            ClassDescriptor typeDesc = DescriptorFactory.instance().getClassDescriptor(type.getInternalName());

            // There is no general way to figure out whether a particular
            // type is a type qualifier we're interested in without
            // resolving it.
            AnnotationValue annotation = new AnnotationValue(typeDesc);
View Full Code Here

    public static boolean likelyTestCase(XMethod m) {
        if (m.getAnnotation(JUNIT4TEST) != null) {
            return true;
        }

        ClassDescriptor c = m.getClassDescriptor();
        if (m.getName().startsWith("test") || m.getName().startsWith("assert")) {
            Subtypes2 subtypes2 = AnalysisContext.currentAnalysisContext().getSubtypes2();

            try {
                if (subtypes2.isSubtype(c, JUNIT3TESTCASE)) {
View Full Code Here

    public boolean mightBeEqualTo(ClassDescriptor checker, ClassDescriptor checkee) {
        return checkee.equals(map.get(checker)) || veryFunky.contains(checker);
    }

    public void checksForEqualTo(ClassDescriptor checker, ClassDescriptor checkee) {
        ClassDescriptor existing = map.get(checker);
        if (checkee.equals(existing)) {
            return;
        } else if (existing != null) {
            veryFunky.add(checker);
        } else {
View Full Code Here

     *            stack of annotations being processed; used to detect cycles in
     *            type qualifier nicknames
     */
    private static void resolveTypeQualifierNicknames(AnnotationValue value, LinkedList<AnnotationValue> result,
            LinkedList<ClassDescriptor> onStack) {
        ClassDescriptor annotationClass = value.getAnnotationClass();

        if (onStack.contains(annotationClass)) {
            AnalysisContext.logError("Cycle found in type nicknames: " + onStack);
            return;
        }
        try {
            onStack.add(annotationClass);

            try {
                if (annotationClass.equals(googleNullable)
                        || annotationClass.equals(eclipseNullable)
                        || annotationClass.equals(intellijNullable)) {
                    resolveTypeQualifierNicknames(new AnnotationValue(JSR305NullnessAnnotations.CHECK_FOR_NULL), result, onStack);
                    return;
                }
                if (annotationClass.equals(eclipseNonNull) || annotationClass.equals(eclipseNonNullByDefault)) {
                    resolveTypeQualifierNicknames(new AnnotationValue(JSR305NullnessAnnotations.NONNULL), result, onStack);
                    return;
                }

                XClass c = Global.getAnalysisCache().getClassAnalysis(XClass.class, annotationClass);
View Full Code Here

        }

    }

    public static void logMissingAnnotationClass(MissingClassException e) {
        ClassDescriptor c = e.getClassDescriptor();
        if (c.getClassName().startsWith("javax.annotation")) {
            AnalysisContext.currentAnalysisContext().getLookupFailureCallback().reportMissingClass(c);
        }
    }
View Full Code Here

                            // is used for a method invocation. But, that's
                            // really a
                            // verification problem.
                            continue;
                        }
                        ClassDescriptor classDescriptor = DescriptorFactory.createClassDescriptorFromSignature(type
                                .getSignature());
                        if (classDescriptor.equals(classContext.getClassDescriptor())) {
                            continue;
                        }
                        if (!classDescriptor.getClassName().startsWith("java/util/concurrent")) {
                            continue;
                        }
                        XClass c = Lookup.getXClass(classDescriptor);
                        XMethod m;
                        int priority = NORMAL_PRIORITY;
View Full Code Here

            superclass = getClassInfo(xclass.getSuperclassDescriptor());
        }

        public XClass next() {
            while (!interfacesToVisit.isEmpty()) {
                ClassDescriptor interfaceDescr = interfacesToVisit.poll();
                if (visited.add(interfaceDescr)) {
                    XClass xinterface = getClassInfo(interfaceDescr);
                    if(xinterface != null){
                        interfacesToVisit.addAll(Arrays.asList(xinterface.getInterfaceDescriptorList()));
                        return xinterface;
View Full Code Here

    private final MultiMap<String, Info> callMap = new MultiMap<String, Info>(LinkedList.class);


    private void addCheckedCall(@DottedClassName String className, String methodName, String sig, int argumentParameterIndex, int typeParameterIndex) {
        ClassDescriptor c = DescriptorFactory.instance().getClassDescriptorForDottedClassName(className);
        String call = methodName+sig;
        Info info = new Info(c, argumentParameterIndex, typeParameterIndex);
        callMap.add(call, info);
    }
View Full Code Here

                    continue;
                }
                if (s.charAt(0) != 'L') {
                    throw new IllegalStateException("unexpected non signature: " + s);
                }
                ClassDescriptor c = DescriptorFactory.createClassDescriptor(s.substring(1, i));
                String superTypeParameter = s.substring(i+1);
                if (isGenericCollection(c) && (typeParameter == null || superTypeParameter.startsWith("T" + typeParameter))) {
                    if (DEBUG) {
                        System.out.println(operandClass + " is a subtype of " + s);
                    }
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.