Skip to content
This repository was archived by the owner on Sep 2, 2022. It is now read-only.

Commit 72dfba8

Browse files
author
Julia Boes
committed
8257637: Update usage of "type" terminology in java.lang.annotation
Reviewed-by: darcy
1 parent b5a3a5b commit 72dfba8

File tree

9 files changed

+86
-83
lines changed

9 files changed

+86
-83
lines changed

src/java.base/share/classes/java/lang/annotation/Annotation.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@
2626
package java.lang.annotation;
2727

2828
/**
29-
* The common interface extended by all annotation types. Note that an
29+
* The common interface extended by all annotation interfaces. Note that an
3030
* interface that manually extends this one does <i>not</i> define
31-
* an annotation type. Also note that this interface does not itself
32-
* define an annotation type.
31+
* an annotation interface. Also note that this interface does not itself
32+
* define an annotation interface.
3333
*
34-
* More information about annotation types can be found in section {@jls 9.6} of
35-
* <cite>The Java Language Specification</cite>.
34+
* More information about annotation interfaces can be found in section
35+
* {@jls 9.6} of <cite>The Java Language Specification</cite>.
3636
*
3737
* The {@link java.lang.reflect.AnnotatedElement} interface discusses
38-
* compatibility concerns when evolving an annotation type from being
38+
* compatibility concerns when evolving an annotation interface from being
3939
* non-repeatable to being repeatable.
4040
*
4141
* @author Josh Bloch
@@ -46,7 +46,7 @@ public interface Annotation {
4646
* Returns true if the specified object represents an annotation
4747
* that is logically equivalent to this one. In other words,
4848
* returns true if the specified object is an instance of the same
49-
* annotation type as this instance, all of whose members are equal
49+
* annotation interface as this instance, all of whose members are equal
5050
* to the corresponding member of this annotation, as defined below:
5151
* <ul>
5252
* <li>Two corresponding primitive typed members whose values are
@@ -127,15 +127,15 @@ public interface Annotation {
127127
String toString();
128128

129129
/**
130-
* Returns the annotation type of this annotation.
130+
* Returns the annotation interface of this annotation.
131131
*
132132
* @apiNote Implementation-dependent classes are used to provide
133133
* the implementations of annotations. Therefore, calling {@link
134134
* Object#getClass getClass} on an annotation will return an
135135
* implementation-dependent class. In contrast, this method will
136-
* reliably return the annotation type of the annotation.
136+
* reliably return the annotation interface of the annotation.
137137
*
138-
* @return the annotation type of this annotation
138+
* @return the annotation interface of this annotation
139139
* @see Enum#getDeclaringClass
140140
*/
141141
Class<? extends Annotation> annotationType();

src/java.base/share/classes/java/lang/annotation/Documented.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -27,23 +27,23 @@
2727

2828
/**
2929
* If the annotation {@code @Documented} is present on the declaration
30-
* of an annotation type <i>A</i>, then any {@code @A} annotation on
30+
* of an annotation interface <i>A</i>, then any {@code @A} annotation on
3131
* an element is considered part of the element's public contract.
3232
*
33-
* In more detail, when an annotation type <i>A</i> is annotated with
34-
* {@code Documented}, the presence and value of annotations of type
35-
* <i>A</i> are a part of the public contract of the elements <i>A</i>
33+
* In more detail, when an annotation interface <i>A</i> is annotated with
34+
* {@code Documented}, the presence and value of <i>A</i> annotations
35+
* are a part of the public contract of the elements <i>A</i>
3636
* annotates.
3737
*
38-
* Conversely, if an annotation type <i>B</i> is <em>not</em>
38+
* Conversely, if an annotation interface <i>B</i> is <em>not</em>
3939
* annotated with {@code Documented}, the presence and value of
4040
* <i>B</i> annotations are <em>not</em> part of the public contract
4141
* of the elements <i>B</i> annotates.
4242
*
43-
* Concretely, if an annotation type is annotated with {@code
44-
* Documented}, by default a tool like javadoc will display
45-
* annotations of that type in its output while annotations of
46-
* annotation types without {@code Documented} will not be displayed.
43+
* Concretely, if an annotation interface is annotated with {@code Documented},
44+
* by default a tool like javadoc will display annotations of that interface
45+
* in its output while annotations of annotation interfaces without
46+
* {@code Documented} will not be displayed.
4747
*
4848
* @author Joshua Bloch
4949
* @since 1.5

src/java.base/share/classes/java/lang/annotation/ElementType.java

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
package java.lang.annotation;
2727

2828
/**
29-
* The constants of this enumerated type provide a simple classification of the
29+
* The constants of this enumerated class provide a simple classification of the
3030
* syntactic locations where annotations may appear in a Java program. These
3131
* constants are used in {@link java.lang.annotation.Target Target}
3232
* meta-annotations to specify where it is legal to write annotations of a
@@ -42,23 +42,25 @@
4242
* #MODULE}, {@link #PARAMETER}, {@link #TYPE}, and {@link #TYPE_PARAMETER}
4343
* correspond to the declaration contexts in JLS 9.6.4.1.
4444
*
45-
* <p>For example, an annotation whose type is meta-annotated with
45+
* <p>For example, an annotation whose interface is meta-annotated with
4646
* {@code @Target(ElementType.FIELD)} may only be written as a modifier for a
4747
* field declaration.
4848
*
4949
* <p>The constant {@link #TYPE_USE} corresponds to the type contexts in JLS
50-
* 4.11, as well as to two declaration contexts: type declarations (including
51-
* annotation type declarations) and type parameter declarations.
50+
* 4.11, as well as to two declaration contexts: class and interface
51+
* declarations (including annotation declarations) and type parameter
52+
* declarations.
5253
*
53-
* <p>For example, an annotation whose type is meta-annotated with
54-
* {@code @Target(ElementType.TYPE_USE)} may be written on the type of a field
55-
* (or within the type of the field, if it is a nested, parameterized, or array
56-
* type), and may also appear as a modifier for, say, a class declaration.
54+
* <p>For example, an annotation whose interface is meta-annotated with
55+
* {@code @Target(ElementType.TYPE_USE)} may be written on the class or
56+
* interface of a field (or within the class or interface of the field, if it
57+
* is a nested or parameterized class or interface, or array class), and may
58+
* also appear as a modifier for, say, a class declaration.
5759
*
58-
* <p>The {@code TYPE_USE} constant includes type declarations and type
59-
* parameter declarations as a convenience for designers of type checkers which
60-
* give semantics to annotation types. For example, if the annotation type
61-
* {@code NonNull} is meta-annotated with
60+
* <p>The {@code TYPE_USE} constant includes class and interface declarations
61+
* and type parameter declarations as a convenience for designers of
62+
* type checkers which give semantics to annotation interfaces. For example,
63+
* if the annotation interface {@code NonNull} is meta-annotated with
6264
* {@code @Target(ElementType.TYPE_USE)}, then {@code @NonNull}
6365
* {@code class C {...}} could be treated by a type checker as indicating that
6466
* all variables of class {@code C} are non-null, while still allowing
@@ -71,7 +73,7 @@
7173
* @jls 4.1 The Kinds of Types and Values
7274
*/
7375
public enum ElementType {
74-
/** Class, interface (including annotation type), enum, or record
76+
/** Class, interface (including annotation interface), enum, or record
7577
* declaration */
7678
TYPE,
7779

@@ -90,7 +92,7 @@ public enum ElementType {
9092
/** Local variable declaration */
9193
LOCAL_VARIABLE,
9294

93-
/** Annotation type declaration */
95+
/** Annotation interface declaration (Formerly known as an annotation type.) */
9496
ANNOTATION_TYPE,
9597

9698
/** Package declaration */

src/java.base/share/classes/java/lang/annotation/IncompleteAnnotationException.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727

2828
/**
2929
* Thrown to indicate that a program has attempted to access an element of
30-
* an annotation type that was added to the annotation type definition after
31-
* the annotation was compiled (or serialized). This exception will not be
30+
* an annotation interface that was added to the annotation interface definition
31+
* after the annotation was compiled (or serialized). This exception will not be
3232
* thrown if the new element has a default value.
3333
* This exception can be thrown by the {@linkplain
3434
* java.lang.reflect.AnnotatedElement API used to read annotations
@@ -43,7 +43,7 @@ public class IncompleteAnnotationException extends RuntimeException {
4343
private static final long serialVersionUID = 8445097402741811912L;
4444

4545
/**
46-
* The annotation type.
46+
* The annotation interface.
4747
*/
4848
private Class<? extends Annotation> annotationType;
4949
/**
@@ -53,9 +53,9 @@ public class IncompleteAnnotationException extends RuntimeException {
5353

5454
/**
5555
* Constructs an IncompleteAnnotationException to indicate that
56-
* the named element was missing from the specified annotation type.
56+
* the named element was missing from the specified annotation interface.
5757
*
58-
* @param annotationType the Class object for the annotation type
58+
* @param annotationType the Class object for the annotation interface
5959
* @param elementName the name of the missing element
6060
* @throws NullPointerException if either parameter is {@code null}
6161
*/
@@ -70,10 +70,10 @@ public IncompleteAnnotationException(
7070
}
7171

7272
/**
73-
* Returns the Class object for the annotation type with the
73+
* Returns the Class object for the annotation interface with the
7474
* missing element.
7575
*
76-
* @return the Class object for the annotation type with the
76+
* @return the Class object for the annotation interface with the
7777
* missing element
7878
*/
7979
public Class<? extends Annotation> annotationType() {

src/java.base/share/classes/java/lang/annotation/Inherited.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -26,18 +26,18 @@
2626
package java.lang.annotation;
2727

2828
/**
29-
* Indicates that an annotation type is automatically inherited. If
30-
* an Inherited meta-annotation is present on an annotation type
31-
* declaration, and the user queries the annotation type on a class
32-
* declaration, and the class declaration has no annotation for this type,
29+
* Indicates that an annotation interface is automatically inherited. If
30+
* an Inherited meta-annotation is present on an annotation interface
31+
* declaration, and the user queries the annotation interface on a class
32+
* declaration, and the class declaration has no annotation for this interface,
3333
* then the class's superclass will automatically be queried for the
34-
* annotation type. This process will be repeated until an annotation for this
35-
* type is found, or the top of the class hierarchy (Object)
36-
* is reached. If no superclass has an annotation for this type, then
34+
* annotation interface. This process will be repeated until an annotation for
35+
* this interface is found, or the top of the class hierarchy (Object)
36+
* is reached. If no superclass has an annotation for this interface, then
3737
* the query will indicate that the class in question has no such annotation.
3838
*
39-
* <p>Note that this meta-annotation type has no effect if the annotated
40-
* type is used to annotate anything other than a class. Note also
39+
* <p>Note that this meta-annotation interface has no effect if the annotated
40+
* interface is used to annotate anything other than a class. Note also
4141
* that this meta-annotation only causes annotations to be inherited
4242
* from superclasses; annotations on implemented interfaces have no
4343
* effect.

src/java.base/share/classes/java/lang/annotation/Repeatable.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -26,11 +26,11 @@
2626
package java.lang.annotation;
2727

2828
/**
29-
* The annotation type {@code java.lang.annotation.Repeatable} is
30-
* used to indicate that the annotation type whose declaration it
29+
* The annotation interface {@code java.lang.annotation.Repeatable} is
30+
* used to indicate that the annotation interface whose declaration it
3131
* (meta-)annotates is <em>repeatable</em>. The value of
3232
* {@code @Repeatable} indicates the <em>containing annotation
33-
* type</em> for the repeatable annotation type.
33+
* interface</em> for the repeatable annotation interface.
3434
*
3535
* @since 1.8
3636
* @jls 9.6.3 Repeatable Annotation Interfaces
@@ -41,9 +41,9 @@
4141
@Target(ElementType.ANNOTATION_TYPE)
4242
public @interface Repeatable {
4343
/**
44-
* Indicates the <em>containing annotation type</em> for the
45-
* repeatable annotation type.
46-
* @return the containing annotation type
44+
* Indicates the <em>containing annotation interface</em> for the
45+
* repeatable annotation interface.
46+
* @return the containing annotation interface
4747
*/
4848
Class<? extends Annotation> value();
4949
}

src/java.base/share/classes/java/lang/annotation/Retention.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -26,15 +26,15 @@
2626
package java.lang.annotation;
2727

2828
/**
29-
* Indicates how long annotations with the annotated type are to
29+
* Indicates how long annotations with the annotated interface are to
3030
* be retained. If no Retention annotation is present on
31-
* an annotation type declaration, the retention policy defaults to
31+
* an annotation interface declaration, the retention policy defaults to
3232
* {@code RetentionPolicy.CLASS}.
3333
*
3434
* <p>A Retention meta-annotation has effect only if the
35-
* meta-annotated type is used directly for annotation. It has no
36-
* effect if the meta-annotated type is used as a member type in
37-
* another annotation type.
35+
* meta-annotated interface is used directly for annotation. It has no
36+
* effect if the meta-annotated interface is used as a member interface in
37+
* another annotation interface.
3838
*
3939
* @author Joshua Bloch
4040
* @since 1.5

src/java.base/share/classes/java/lang/annotation/RetentionPolicy.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -26,10 +26,10 @@
2626
package java.lang.annotation;
2727

2828
/**
29-
* Annotation retention policy. The constants of this enumerated type
29+
* Annotation retention policy. The constants of this enumerated class
3030
* describe the various policies for retaining annotations. They are used
31-
* in conjunction with the {@link Retention} meta-annotation type to specify
32-
* how long annotations are to be retained.
31+
* in conjunction with the {@link Retention} meta-annotation interface to
32+
* specify how long annotations are to be retained.
3333
*
3434
* @author Joshua Bloch
3535
* @since 1.5

src/java.base/share/classes/java/lang/annotation/Target.java

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,35 +26,36 @@
2626
package java.lang.annotation;
2727

2828
/**
29-
* Indicates the contexts in which an annotation type is applicable. The
30-
* declaration contexts and type contexts in which an annotation type may be
31-
* applicable are specified in JLS 9.6.4.1, and denoted in source code by enum
32-
* constants of {@link ElementType java.lang.annotation.ElementType}.
29+
* Indicates the contexts in which an annotation interface is applicable. The
30+
* declaration contexts and type contexts in which an annotation interface may
31+
* be applicable are specified in JLS 9.6.4.1, and denoted in source code by
32+
* enum constants of {@link ElementType java.lang.annotation.ElementType}.
3333
*
34-
* <p>If an {@code @Target} meta-annotation is not present on an annotation type
35-
* {@code T}, then an annotation of type {@code T} may be written as a
36-
* modifier for any declaration except a type parameter declaration.
34+
* <p>If an {@code @Target} meta-annotation is not present on an annotation
35+
* interface {@code T}, then an annotation of type {@code T} may be written as
36+
* a modifier for any declaration except a type parameter declaration.
3737
*
3838
* <p>If an {@code @Target} meta-annotation is present, the compiler will enforce
3939
* the usage restrictions indicated by {@code ElementType}
4040
* enum constants, in line with JLS 9.7.4.
4141
*
4242
* <p>For example, this {@code @Target} meta-annotation indicates that the
43-
* declared type is itself a meta-annotation type. It can only be used on
44-
* annotation type declarations:
43+
* declared interface is itself a meta-annotation interface. It can only be
44+
* used on annotation interface declarations:
4545
* <pre>
4646
* &#064;Target(ElementType.ANNOTATION_TYPE)
4747
* public &#064;interface MetaAnnotationType {
4848
* ...
4949
* }
5050
* </pre>
5151
*
52-
* <p>This {@code @Target} meta-annotation indicates that the declared type is
53-
* intended solely for use as a member type in complex annotation type
54-
* declarations. It cannot be used to annotate anything directly:
52+
* <p>This {@code @Target} meta-annotation indicates that the declared class or
53+
* interface is intended solely for use as a member class or interface in
54+
* complex annotation interface declarations. It cannot be used to annotate
55+
* anything directly:
5556
* <pre>
5657
* &#064;Target({})
57-
* public &#064;interface MemberType {
58+
* public &#064;interface MemberInterface {
5859
* ...
5960
* }
6061
* </pre>
@@ -79,9 +80,9 @@
7980
@Target(ElementType.ANNOTATION_TYPE)
8081
public @interface Target {
8182
/**
82-
* Returns an array of the kinds of elements an annotation type
83+
* Returns an array of the kinds of elements an annotation interface
8384
* can be applied to.
84-
* @return an array of the kinds of elements an annotation type
85+
* @return an array of the kinds of elements an annotation interface
8586
* can be applied to
8687
*/
8788
ElementType[] value();

0 commit comments

Comments
 (0)