Search in sources :

Example 6 with BinaryName

use of org.checkerframework.checker.signature.qual.BinaryName in project checker-framework by typetools.

the class WholeProgramInferenceJavaParserStorage method getFieldAnnotations.

@Override
public AnnotatedTypeMirror getFieldAnnotations(Element element, String fieldName, AnnotatedTypeMirror lhsATM, AnnotatedTypeFactory atypeFactory) {
    ClassSymbol enclosingClass = ((VarSymbol) element).enclClass();
    // Read in classes for the element.
    getFileForElement(element);
    // https://tinyurl.com/cfissue/3094
    @SuppressWarnings("signature") @BinaryName String className = enclosingClass.flatname.toString();
    ClassOrInterfaceAnnos classAnnos = classToAnnos.get(className);
    // and it won't have extra annotations, so just return the basic type:
    if (classAnnos.enumConstants.contains(fieldName)) {
        return lhsATM;
    } else {
        return classAnnos.fields.get(fieldName).getType(lhsATM, atypeFactory);
    }
}
Also used : ClassSymbol(com.sun.tools.javac.code.Symbol.ClassSymbol) BinaryName(org.checkerframework.checker.signature.qual.BinaryName) VarSymbol(com.sun.tools.javac.code.Symbol.VarSymbol)

Example 7 with BinaryName

use of org.checkerframework.checker.signature.qual.BinaryName in project checker-framework by typetools.

the class AnnotationUtils method annotationBinaryName.

/**
 * Returns the binary name of an annotation as a String.
 *
 * @param annotation the annotation whose binary name to return
 * @return the binary name of an annotation as a String
 */
@BinaryName
public static final String annotationBinaryName(AnnotationMirror annotation) {
    final DeclaredType annoType = annotation.getAnnotationType();
    final TypeElement elm = (TypeElement) annoType.asElement();
    return ElementUtils.getBinaryName(elm);
}
Also used : TypeElement(javax.lang.model.element.TypeElement) DeclaredType(javax.lang.model.type.DeclaredType) BinaryName(org.checkerframework.checker.signature.qual.BinaryName)

Aggregations

BinaryName (org.checkerframework.checker.signature.qual.BinaryName)7 ClassSymbol (com.sun.tools.javac.code.Symbol.ClassSymbol)3 Element (javax.lang.model.element.Element)3 TypeElement (javax.lang.model.element.TypeElement)3 VarSymbol (com.sun.tools.javac.code.Symbol.VarSymbol)2 File (java.io.File)2 JarFile (java.util.jar.JarFile)2 PackageElement (javax.lang.model.element.PackageElement)2 VariableElement (javax.lang.model.element.VariableElement)2 IOException (java.io.IOException)1 JarURLConnection (java.net.JarURLConnection)1 LinkedHashSet (java.util.LinkedHashSet)1 ExecutableElement (javax.lang.model.element.ExecutableElement)1 DeclaredType (javax.lang.model.type.DeclaredType)1 Identifier (org.checkerframework.checker.signature.qual.Identifier)1 BugInCF (org.checkerframework.javacutil.BugInCF)1 AClass (scenelib.annotations.el.AClass)1 AField (scenelib.annotations.el.AField)1