Details
-
CSR
-
Resolution: Approved
-
P4
-
None
-
binary, behavioral
-
minimal
-
If there were other potential subclasses of Executable, this change would be source incompatible, but Executable is now sealed so that is not a concern.
-
Java API
-
SE
Description
Summary
Change Executable.getParameterCount
to be declared to be an abstract
method, matching its semantics.
Problem
While Executable.getParameterCount
is conceptually an abstract method, it is not coded as such, which is confusing. Since Executable
is now sealed
, only the implementation in Mehtod
and Constructor
are relevant.
Solution
Change the method to be declared as abstract
.
Specification
--- a/src/java.base/share/classes/java/lang/reflect/Executable.java
+++ b/src/java.base/share/classes/java/lang/reflect/Executable.java
@@ -253,9 +253,7 @@ public abstract sealed class Executable extends AccessibleObject
* @return The number of formal parameters for the executable this
* object represents
*/
- public int getParameterCount() {
- throw new AbstractMethodError();
- }
+ public abstract int getParameterCount();
/**
Attachments
Issue Links
- csr of
-
JDK-8288573 Make Executable.getParameterCount() actually abstract
-
- Resolved
-