Class SyntheticArrays


  • public final class SyntheticArrays
    extends java.lang.Object
    SyntheticArrays exists solely to fix AnnotatedTypeMirrors that need to be adapted from Array type to a specific kind of array. There are no classes for arrays. Instead, for each type of array (e.g. String[]) the compiler/JVM creates a synthetic type for them.
    • Method Detail

      • isArrayClone

        public static boolean isArrayClone​(AnnotatedTypeMirror type,
                                           javax.lang.model.element.Element elem)
        Returns true if this combination of type/elem represents an array.clone.
        Parameters:
        type - a type with a method/field of elem
        elem - an element which is a member of type
        Returns:
        true if this combination of type/elem represents an array.clone
      • replaceReturnType

        public static AnnotatedTypeMirror.AnnotatedExecutableType replaceReturnType​(javax.lang.model.element.Element methodElem,
                                                                                    AnnotatedTypeMirror.AnnotatedArrayType newReturnType)
        Returns the annotated type of methodElem with its return type replaced by newReturnType.
        Parameters:
        methodElem - identifies a method that should have an AnnotatedArrayType as its return type
        newReturnType - identifies a type that should replace methodElem's return type
        Returns:
        the annotated type of methodElem with its return type replaced by newReturnType