Search in sources :

Example 6 with ATypeElement

use of scenelib.annotations.el.ATypeElement in project checker-framework by typetools.

the class SceneToStubWriter method formatArrayType.

/**
 * Formats the type of an array so that it is printable in Java source code, with the annotations
 * from the scenelib representation added in appropriate places.
 *
 * @param scenelibRep the array's scenelib type element
 * @param javacRep the representation of the array's type used by javac
 * @return the type formatted to be written to Java source code, followed by a space character
 */
private static String formatArrayType(ATypeElement scenelibRep, ArrayType javacRep) {
    TypeMirror componentType = javacRep.getComponentType();
    ATypeElement scenelibComponent = getNextArrayLevel(scenelibRep);
    while (componentType.getKind() == TypeKind.ARRAY) {
        componentType = ((ArrayType) componentType).getComponentType();
        scenelibComponent = getNextArrayLevel(scenelibComponent);
    }
    return formatType(scenelibComponent, componentType) + formatArrayTypeImpl(scenelibRep, javacRep);
}
Also used : TypeMirror(javax.lang.model.type.TypeMirror) ATypeElement(scenelib.annotations.el.ATypeElement)

Aggregations

ATypeElement (scenelib.annotations.el.ATypeElement)6 Annotation (scenelib.annotations.Annotation)4 AnnotationMirror (javax.lang.model.element.AnnotationMirror)3 HashSet (java.util.HashSet)2 TypeMirror (javax.lang.model.type.TypeMirror)2 AnnotatedArrayType (org.checkerframework.framework.type.AnnotatedTypeMirror.AnnotatedArrayType)2 AnnotatedTypeVariable (org.checkerframework.framework.type.AnnotatedTypeMirror.AnnotatedTypeVariable)2 ArrayType (javax.lang.model.type.ArrayType)1