-
Type:
CSR
-
Resolution: Approved
-
Priority:
P4
-
Component/s: core-libs
-
None
-
behavioral
-
minimal
-
This is the existing behavior of this API.
-
Java API
-
SE
Summary
Document that java.lang.classfile.CodeBuilder::parameterSlot(int) method throws an IndexOutOfBoundsException when the input argument is not a valid parameter slot.
Problem
In an inspection for all int-accepting methods in ClassFile API, I found this method validates its argument via an ArrayIndexOutOfBoundsException, which is good, but does not document this behavior.
Solution
Include this exceptional behavior in the assertions about this method in the specification; specify IOOBE instead of AIOOBE to allow for implementation freedom.
Specification
--- a/src/java.base/share/classes/java/lang/classfile/CodeBuilder.java
+++ b/src/java.base/share/classes/java/lang/classfile/CodeBuilder.java
@@ -132,6 +132,7 @@ public sealed interface CodeBuilder
* values require two slots.
*
* @param paramNo the index of the parameter
+ * @throws IndexOutOfBoundsException if the parameter index is out of bounds
*/
int parameterSlot(int paramNo);
- csr of
-
JDK-8361615 CodeBuilder::parameterSlot throws undocumented IOOBE
-
- Resolved
-