Java Reference
In-Depth Information
String synopsis(); // Synopsis of RFE
String engineer(); // Name of engineer who implemented RFE
String date();
// Date RFE was implemented
}
The following annotation type declaration defines an annotation type with no ele-
ments, termed a
marker annotation type
:
/**
* An annotation with this type indicates that the
* specification of the annotated API element is
* preliminary and subject to change.
*/
@interface Preliminary {}
It is a compile-time error if the return type of a method declared in an annotation type is not
one of the following: a primitive type,
String
,
Class
, any parameterized invocation of
Class
,
of the preceding types.
This specification precludes elements whose types are nested arrays. For example,
this annotation type declaration is illegal:
@interface Verboten {
String[][] value();
}
It is a compile-time error if any method declared in an annotation type has a signature that
is override-equivalent to that of any
public
or
protected
method declared in class
Object
or in
the interface
java.lang.annotation.Annotation
.
It is a compile-time error if an annotation type declaration
T
contains an element of type
T
,
either directly or indirectly.
For example, this is illegal:
@interface SelfRef { SelfRef value(); }
and so is this:
@interface Ping { Pong value(); }
@interface Pong { Ping value(); }