Class DeclarationAnnotationHelper


  • public class DeclarationAnnotationHelper
    extends java.lang.Object
    • Field Detail

      • EMPTY_DECOMPILER_COMMENTS

        private static final DecompilerComments EMPTY_DECOMPILER_COMMENTS
    • Constructor Detail

      • DeclarationAnnotationHelper

        private DeclarationAnnotationHelper()
    • Method Detail

      • getCommonInnerClassAnnotationIndex

        private static java.lang.Integer getCommonInnerClassAnnotationIndex​(java.util.List<AnnotationTableTypeEntry> typeAnnotations)
        Returns for the annotations the common inner class annotation index, or null if there is no common index. For example with A and B being inner classes:
        {@code
        Parameters:
        typeAnnotations - For which the common inner annotation index should be determined
        Returns:
        Common annotation index or null
      • canTypeAnnotationBeMovedToDecl

        private static boolean canTypeAnnotationBeMovedToDecl​(JavaTypeInstance annotatedType,
                                                              AnnotationTableTypeEntry typeAnnotation,
                                                              java.lang.Integer commonInnerAnnotationIndex)
        Returns whether the type annotation can be moved to the declaration. For example:
        {@code
         // Can be moved
         public @TypeUse String[] f;
         // when moved:
        Parameters:
        annotatedType - Type to be annotated
        typeAnnotation - Annotation for the type
        commonInnerAnnotationIndex - Nullable index of the common annotation position for inner classes
        Returns:
        Whether the annotation can be moved to the declaration
      • getDeclarationInfo

        public static DeclarationAnnotationHelper.DeclarationAnnotationsInfo getDeclarationInfo​(JavaTypeInstance nullableAnnotatedType,
                                                                                                java.util.List<AnnotationTableEntry> declarationAnnotations,
                                                                                                java.util.List<AnnotationTableTypeEntry> typeAnnotations)
        Calculates information about where to place declaration and ElementType.TYPE_USE annotations for a place where both can occur.
        Parameters:
        nullableAnnotatedType - Type for which the TYPE_USE annotations apply, null if there is no type (e.g. for constructor declarations)
        declarationAnnotations - Annotations for the declaration, e.g. ElementType.FIELD
        typeAnnotations - Annotations for the type, i.e. ElementType.TYPE_USE
        Returns:
        Information about how to place the annotations