Class DeclarationAnnotationHelper.DeclarationAnnotationsInfo

java.lang.Object
org.benf.cfr.reader.bytecode.analysis.types.DeclarationAnnotationHelper.DeclarationAnnotationsInfo
Enclosing class:
DeclarationAnnotationHelper

public static class DeclarationAnnotationHelper.DeclarationAnnotationsInfo extends Object
Represents information about where to place declaration and ElementType.TYPE_USE annotations for a place where both can occur.

This information differentiates between admissible and non-admissible types. What this means is defined in JLS 9.7.4. Depending on whether a type is admissible or not annotation placement has to be adjusted.

Examples for annotation @DeclTypeUse with target TYPE_USE and FIELD:

 // Applies both to declaration and type; placement in front of type is admissible
 @TypeUse
 public String f;

 // Would consider the annotation repeated
 @TypeUse
 public @TypeUse String f;

 // Applies only to type
 public java.lang.@TypeUse String f;

 // Applies both to declaration and type
 // Probably javac bug (JDK-8223936) and should only apply to declaration
 @TypeUse
 public java.lang.String f;
 

So depending on how the type is written by the decompiler (maybe the qualified name is used to resolve type collisions) the annotations have to be placed differently. Additionally the annotations present in the class files can require creating a non-admissible type, e.g. because the annotation is only present on the type, but not on the declaration, or because it was different values or appears in a different order.