Type declaration AST node type. A type declaration is the union of a class declaration and an interface declaration. For JLS2:
TypeDeclaration: ClassDeclaration InterfaceDeclaration ClassDeclaration: [ Javadoc ] { Modifier } class Identifier [ extends Type] [ implements Type { , Type } ] { { ClassBodyDeclaration | ; } } InterfaceDeclaration: [ Javadoc ] { Modifier } interface Identifier [ extends Type { , Type } ] { { InterfaceBodyDeclaration | ; } }
For JLS3, type parameters and reified modifiers (and annotations) were added, and the superclass type name and superinterface types names are generalized to type so that parameterized types can be referenced:
TypeDeclaration: ClassDeclaration InterfaceDeclaration ClassDeclaration: [ Javadoc ] { ExtendedModifier } class Identifier [ < TypeParameter { , TypeParameter } > ] [ extends Type ] [ implements Type { , Type } ] { { ClassBodyDeclaration | ; } } InterfaceDeclaration: [ Javadoc ] { ExtendedModifier } interface Identifier [ < TypeParameter { , TypeParameter } > ] [ extends Type { , Type } ] { { InterfaceBodyDeclaration | ; } }
When a Javadoc comment is present, the source range begins with the first character of the "/**" comment delimiter. When there is no Javadoc comment, the source range begins with the first character of the first modifier or annotation (if any), or the first character of the "class" or "interface" keyword (if no modifiers or annotations). The source range extends through the last character of the "}" token following the body declarations.
@since 2.0
@noinstantiate This class is not intended to be instantiated by clients.