Skip to content

Commit 8c8f0d8

Browse files
committed
8339260: Move rarely used constants out of ClassFile
Reviewed-by: asotona
1 parent 47c1069 commit 8c8f0d8

37 files changed

+1545
-1916
lines changed

src/java.base/share/classes/java/lang/classfile/AnnotationValue.java

Lines changed: 56 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public sealed interface AnnotationValue {
6060

6161
/**
6262
* Models an annotation value of an element-value pair.
63-
* The {@linkplain #tag tag} of this value is {@value ClassFile#AEV_ANNOTATION}.
63+
* The {@linkplain #tag tag} of this value is {@value TAG_ANNOTATION}.
6464
*
6565
* @since 22
6666
*/
@@ -73,7 +73,7 @@ sealed interface OfAnnotation extends AnnotationValue
7373

7474
/**
7575
* Models an array value of an element-value pair.
76-
* The {@linkplain #tag tag} of this value is {@value ClassFile#AEV_ARRAY}.
76+
* The {@linkplain #tag tag} of this value is {@value TAG_ARRAY}.
7777
*
7878
* @since 22
7979
*/
@@ -131,7 +131,7 @@ sealed interface OfConstant extends AnnotationValue {
131131

132132
/**
133133
* Models a string value of an element-value pair.
134-
* The {@linkplain #tag tag} of this value is {@value ClassFile#AEV_STRING}.
134+
* The {@linkplain #tag tag} of this value is {@value TAG_STRING}.
135135
*
136136
* @since 22
137137
*/
@@ -159,7 +159,7 @@ default String resolvedValue() {
159159

160160
/**
161161
* Models a double value of an element-value pair.
162-
* The {@linkplain #tag tag} of this value is {@value ClassFile#AEV_DOUBLE}.
162+
* The {@linkplain #tag tag} of this value is {@value TAG_DOUBLE}.
163163
*
164164
* @since 22
165165
*/
@@ -187,7 +187,7 @@ default Double resolvedValue() {
187187

188188
/**
189189
* Models a float value of an element-value pair.
190-
* The {@linkplain #tag tag} of this value is {@value ClassFile#AEV_FLOAT}.
190+
* The {@linkplain #tag tag} of this value is {@value TAG_FLOAT}.
191191
*
192192
* @since 22
193193
*/
@@ -215,7 +215,7 @@ default Float resolvedValue() {
215215

216216
/**
217217
* Models a long value of an element-value pair.
218-
* The {@linkplain #tag tag} of this value is {@value ClassFile#AEV_LONG}.
218+
* The {@linkplain #tag tag} of this value is {@value TAG_LONG}.
219219
*
220220
* @since 22
221221
*/
@@ -243,7 +243,7 @@ default Long resolvedValue() {
243243

244244
/**
245245
* Models an int value of an element-value pair.
246-
* The {@linkplain #tag tag} of this value is {@value ClassFile#AEV_INT}.
246+
* The {@linkplain #tag tag} of this value is {@value TAG_INT}.
247247
*
248248
* @since 22
249249
*/
@@ -271,7 +271,7 @@ default Integer resolvedValue() {
271271

272272
/**
273273
* Models a short value of an element-value pair.
274-
* The {@linkplain #tag tag} of this value is {@value ClassFile#AEV_SHORT}.
274+
* The {@linkplain #tag tag} of this value is {@value TAG_SHORT}.
275275
*
276276
* @since 22
277277
*/
@@ -302,7 +302,7 @@ default Short resolvedValue() {
302302

303303
/**
304304
* Models a char value of an element-value pair.
305-
* The {@linkplain #tag tag} of this value is {@value ClassFile#AEV_CHAR}.
305+
* The {@linkplain #tag tag} of this value is {@value TAG_CHAR}.
306306
*
307307
* @since 22
308308
*/
@@ -333,7 +333,7 @@ default Character resolvedValue() {
333333

334334
/**
335335
* Models a byte value of an element-value pair.
336-
* The {@linkplain #tag tag} of this value is {@value ClassFile#AEV_BYTE}.
336+
* The {@linkplain #tag tag} of this value is {@value TAG_BYTE}.
337337
*
338338
* @since 22
339339
*/
@@ -364,7 +364,7 @@ default Byte resolvedValue() {
364364

365365
/**
366366
* Models a boolean value of an element-value pair.
367-
* The {@linkplain #tag tag} of this value is {@value ClassFile#AEV_BOOLEAN}.
367+
* The {@linkplain #tag tag} of this value is {@value TAG_BOOLEAN}.
368368
*
369369
* @since 22
370370
*/
@@ -395,7 +395,7 @@ default Boolean resolvedValue() {
395395

396396
/**
397397
* Models a class value of an element-value pair.
398-
* The {@linkplain #tag tag} of this value is {@value ClassFile#AEV_CLASS}.
398+
* The {@linkplain #tag tag} of this value is {@value TAG_CLASS}.
399399
*
400400
* @since 22
401401
*/
@@ -413,7 +413,7 @@ default ClassDesc classSymbol() {
413413

414414
/**
415415
* Models an enum value of an element-value pair.
416-
* The {@linkplain #tag tag} of this value is {@value ClassFile#AEV_ENUM}.
416+
* The {@linkplain #tag tag} of this value is {@value TAG_ENUM}.
417417
*
418418
* @since 22
419419
*/
@@ -432,9 +432,52 @@ default ClassDesc classSymbol() {
432432
Utf8Entry constantName();
433433
}
434434

435+
/** The {@link #tag() tag} indicating the value of an element-value pair is {@link OfByte}. */
436+
int TAG_BYTE = 'B';
437+
438+
/** The {@link #tag() tag} indicating the value of an element-value pair is {@link OfChar}. */
439+
int TAG_CHAR = 'C';
440+
441+
/** The {@link #tag() tag} indicating the value of an element-value pair is {@link OfDouble}. */
442+
int TAG_DOUBLE = 'D';
443+
444+
/** The {@link #tag() tag} indicating the value of an element-value pair is {@link OfFloat}. */
445+
int TAG_FLOAT = 'F';
446+
447+
/** The {@link #tag() tag} indicating the value of an element-value pair is {@link OfInt}. */
448+
int TAG_INT = 'I';
449+
450+
/** The {@link #tag() tag} indicating the value of an element-value pair is {@link OfLong}. */
451+
int TAG_LONG = 'J';
452+
453+
/** The {@link #tag() tag} indicating the value of an element-value pair is {@link OfShort}. */
454+
int TAG_SHORT = 'S';
455+
456+
/** The {@link #tag() tag} indicating the value of an element-value pair is {@link OfBoolean}. */
457+
int TAG_BOOLEAN = 'Z';
458+
459+
/** The {@link #tag() tag} indicating the value of an element-value pair is {@link OfString}. */
460+
int TAG_STRING = 's';
461+
462+
/** The {@link #tag() tag} indicating the value of an element-value pair is {@link OfEnum}. */
463+
int TAG_ENUM = 'e';
464+
465+
/** The {@link #tag() tag} indicating the value of an element-value pair is {@link OfClass}. */
466+
int TAG_CLASS = 'c';
467+
468+
/** The {@link #tag() tag} indicating the value of an element-value pair is {@link OfAnnotation}. */
469+
int TAG_ANNOTATION = '@';
470+
471+
/** The {@link #tag() tag} indicating the value of an element-value pair is {@link OfArray}. */
472+
int TAG_ARRAY = '[';
473+
435474
/**
436475
* {@return the tag character for this value as per JVMS {@jvms 4.7.16.1}}
437476
* The tag characters have a one-to-one mapping to the types of annotation element values.
477+
*
478+
* @apiNote
479+
* {@code TAG_}-prefixed constants in this class, such as {@link #TAG_INT},
480+
* describe the possible return values of this method.
438481
*/
439482
char tag();
440483

0 commit comments

Comments
 (0)