-
Type:
CSR
-
Resolution: Approved
-
Priority:
P4
-
Component/s: core-libs
-
None
-
behavioral
-
minimal
-
Making implied requirements of the method more explicit; no behavioral change.
-
Java API
-
SE
Summary
Make the correspondence between the different possible kinds of objects returned by AnnotationValue.getValue() and cases listed in JLS 9.6.1 more explicit.
Problem
The specification of the behavior in question didn't state the intention of the mapping directly.
Solution
Refine the specification and the cite the JLS section in question.
Specification
diff --git a/src/java.compiler/share/classes/javax/lang/model/element/AnnotationValue.java b/src/java.compiler/share/classes/javax/lang/model/element/AnnotationValue.java
index 77521dac19165..71594d3115017 100644
--- a/src/java.compiler/share/classes/javax/lang/model/element/AnnotationValue.java
+++ b/src/java.compiler/share/classes/javax/lang/model/element/AnnotationValue.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,14 +27,16 @@
/**
* Represents a value of an annotation interface element.
- * A value is of one of the following types:
- * <ul><li> a wrapper class (such as {@link Integer}) for a primitive type
- * <li> {@code String}
- * <li> {@code TypeMirror}
- * <li> {@code VariableElement} (representing an enum constant)
- * <li> {@code AnnotationMirror}
+ * A value is of one of the following types (JLS {@jls 9.6.1}):
+ * <ul><li> a {@linkplain java.lang##wrapperClass wrapper class} to hold a
+ * primitive type, such as an {@code Integer} object to hold an
+ * {@code int}
+ * <li> {@code String} representing a {@code String}
+ * <li> {@link javax.lang.model.type.TypeMirror TypeMirror} representing a {@code Class} literal
+ * <li> {@link VariableElement} representing an enum constant
+ * <li> {@link AnnotationMirror} representing an annotation
* <li> {@code List<? extends AnnotationValue>}
- * (representing the elements, in declared order, if the value is an array)
+ * representing the elements, in declared order, if the value is an array
* </ul>
*
* @since 1.6
- csr of
-
JDK-8374749 Clarify AnnotationValue specification
-
- Resolved
-