10.12.2012 Views

The Java Language Specification, Third Edition

The Java Language Specification, Third Edition

The Java Language Specification, Third Edition

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

INTERFACES Annotation Types 9.6<br />

DISCUSSION<br />

Note that the at sign (@) and the keyword interface are two distinct tokens; technically it is<br />

possible to separate them with whitespace, but this is strongly discouraged as a matter of<br />

style.<br />

AnnotationTypeDeclaration:<br />

InterfaceModifiersopt @ interface Identifier AnnotationTypeBody<br />

AnnotationTypeBody:<br />

{ AnnotationTypeElementDeclarationsopt }<br />

AnnotationTypeElementDeclarations:<br />

AnnotationTypeElementDeclaration<br />

AnnotationTypeElementDeclarations AnnotationTypeElementDeclaration<br />

AnnotationTypeElementDeclaration:<br />

AbstractMethodModifiersopt Type Identifier ( ) DefaultValueopt ;<br />

ConstantDeclaration<br />

ClassDeclaration<br />

InterfaceDeclaration<br />

EnumDeclaration<br />

AnnotationTypeDeclaration<br />

;<br />

DefaultValue:<br />

default ElementValue<br />

DISCUSSION<br />

DRAFT<br />

<strong>The</strong> following restrictions are imposed on annotation type declarations by virtue of their<br />

context free syntax:<br />

• Annotation type declarations cannot be generic.<br />

• No extends clause is permitted. (Annotation types implicitly extend annotation.Annotation.)<br />

• Methods cannot have any parameters<br />

• Methods cannot have any type parameters<br />

271

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!