@Documented @Retention(value=RUNTIME) @Target(value={TYPE_USE,TYPE_PARAMETER}) @SubtypeOf(value={FullyQualifiedName.class,CanonicalNameOrEmpty.class}) public @interface CanonicalName
fully-qualified name
s.
Every canonical name is a fully-qualified name, but not every fully-qualified name is a canonical
name.
JLS section 6.7 gives the following example:
The difference between a fully qualified name and a canonical name can be seen in code such as:Given a character sequence that is a fully-qualified name, there is no way to know whether or not it is a canonical name, without examining the program it refers to. Therefore, to avoid excessive warnings that would have to be suppressed, sometimes a variable that holds a canonical name is annotated asBothpackage p; class O1 { class I {} } class O2 extends O1 {}
p.O1.I
andp.O2.I
are fully qualified names that denote the member classI
, but onlyp.O1.I
is its canonical name.
@
FullyQualifiedName
.FullyQualifiedName