RFR: JDK-8266670: Better modeling of access flags in core reflection [v20]

ExE Boss duke at openjdk.java.net
Wed Jun 1 05:13:35 UTC 2022


On Wed, 1 Jun 2022 05:01:33 GMT, ExE Boss <duke at openjdk.java.net> wrote:

>> src/java.base/share/classes/java/lang/reflect/Member.java line 96:
>> 
>>> 94:      */
>>> 95:     public default Set<AccessFlag> accessFlags() {
>>> 96:         return Set.of();
>> 
>> Is is not better to throw a NoSuchMethodError instead of Set.of() if there is no implementation.
>
> Or `AbstractMethodError`, which is what `Executable::getParameterCount()` does:
> https://github.com/openjdk/jdk/blob/e751b7b1b6f7269a1fe20c07748c726536388f6d/src/java.base/share/classes/java/lang/reflect/Executable.java#L248-L258

Actually, it should probably be `UnsupportedOperationException` instead.

-------------

PR: https://git.openjdk.java.net/jdk/pull/7445


More information about the core-libs-dev mailing list