Class DeclarationAnnotationHelper
- java.lang.Object
-
- org.benf.cfr.reader.bytecode.analysis.types.DeclarationAnnotationHelper
-
public class DeclarationAnnotationHelper extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classDeclarationAnnotationHelper.ArrayCountingIteratorstatic classDeclarationAnnotationHelper.DeclarationAnnotationsInfoRepresents information about where to place declaration andElementType.TYPE_USEannotations for a place where both can occur.private static classDeclarationAnnotationHelper.NestedCountingIteratorprivate static classDeclarationAnnotationHelper.SinglePartTypeIterator
-
Field Summary
Fields Modifier and Type Field Description private static DecompilerCommentsEMPTY_DECOMPILER_COMMENTS
-
Constructor Summary
Constructors Modifier Constructor Description privateDeclarationAnnotationHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static booleanareAnnotationsEqual(java.util.List<AnnotationTableEntry> declAnnotations, java.util.List<AnnotationTableTypeEntry> typeAnnotations)private static booleancanTypeAnnotationBeMovedToDecl(JavaTypeInstance annotatedType, AnnotationTableTypeEntry typeAnnotation, java.lang.Integer commonInnerAnnotationIndex)Returns whether the type annotation can be moved to the declaration.private static java.lang.IntegergetCommonInnerClassAnnotationIndex(java.util.List<AnnotationTableTypeEntry> typeAnnotations)Returns for the annotations the common inner class annotation index, ornullif there is no common index.private static java.util.Set<JavaTypeInstance>getDeclAndTypeUseAnnotationTypes(java.util.List<AnnotationTableEntry> declAnnotations, java.util.List<AnnotationTableTypeEntry> typeAnnotations)static DeclarationAnnotationHelper.DeclarationAnnotationsInfogetDeclarationInfo(JavaTypeInstance nullableAnnotatedType, java.util.List<AnnotationTableEntry> declarationAnnotations, java.util.List<AnnotationTableTypeEntry> typeAnnotations)Calculates information about where to place declaration andElementType.TYPE_USEannotations for a place where both can occur.
-
-
-
Field Detail
-
EMPTY_DECOMPILER_COMMENTS
private static final DecompilerComments EMPTY_DECOMPILER_COMMENTS
-
-
Method Detail
-
getDeclAndTypeUseAnnotationTypes
private static java.util.Set<JavaTypeInstance> getDeclAndTypeUseAnnotationTypes(java.util.List<AnnotationTableEntry> declAnnotations, java.util.List<AnnotationTableTypeEntry> typeAnnotations)
-
getCommonInnerClassAnnotationIndex
private static java.lang.Integer getCommonInnerClassAnnotationIndex(java.util.List<AnnotationTableTypeEntry> typeAnnotations)
Returns for the annotations the common inner class annotation index, ornullif there is no common index. For example withAandBbeing 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 annotatedtypeAnnotation- Annotation for the typecommonInnerAnnotationIndex- Nullable index of the common annotation position for inner classes- Returns:
- Whether the annotation can be moved to the declaration
-
areAnnotationsEqual
private static boolean areAnnotationsEqual(java.util.List<AnnotationTableEntry> declAnnotations, java.util.List<AnnotationTableTypeEntry> typeAnnotations)
-
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 andElementType.TYPE_USEannotations for a place where both can occur.- Parameters:
nullableAnnotatedType- Type for which theTYPE_USEannotations apply,nullif there is no type (e.g. for constructor declarations)declarationAnnotations- Annotations for the declaration, e.g.ElementType.FIELDtypeAnnotations- Annotations for the type, i.e.ElementType.TYPE_USE- Returns:
- Information about how to place the annotations
-
-