On Mon, 14 Feb 2022 18:12:13 GMT, Joe Darcy <da...@openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/reflect/AccessFlag.java line 206:
>> 
>>> 204:      * modifier in the Java programming language}
>>> 205:      */
>>> 206:     public boolean sourceModifer() {
>> 
>> probably a typo - should be sourceModifier
>
> Thanks for catching the typo Adam; I'll fix it in the next push.

> Looks promising, some comments:
> 
> The terminology in the JVMS is about modifiers; can the class name include 
> the word Modifier, perhaps ModifierFlag(s)? Several of the modifiers are not 
> related to "access".
> 
> The `getXXXFlags()` methods in Class, etc. should mention the Set is 
> immutable/unmodifiable. The post-Beans API signature would be just "flags()" 
> without the Get prefix. Consistency with the current methods may tend to keep 
> the prefix.
> 
> The Set manipulation functions are not very smooth (but true for all Sets). 
> Checking for `anyOf` or `allOf` a set of modifiers has to be written out as a 
> boolean expression. Though `allOf` could create an intermediate set.

The JVMS uses "access flags" terminology:

JVMS 4.7 Attributes "The value of the access_flags item is a mask of flags used 
to denote access permissions to and properties of this class or interface. "

JVMS 4.5 Fields "The value of the access_flags item is a mask of flags used to 
denote access permission to and properties of this field."

JVMS 4.6 Methods "The value of the access_flags item is a mask of flags used to 
denote access permission to and properties of this method."

JVMS 4.7.6 The InnerClasses Attribute "The value of the 
inner_class_access_flags item is a mask of flags used to denote access 
permissions to and properties of class or interface C as declared in the source 
code from which this class file was compiled."

JVMS 4.7.24 The MethodParameters Attribute "The value of the access_flags item 
is as follows: ..."

This consistent usage was the motivation to rename the enum class to 
"AccessFlags" compared to "ModifierFlag" as initially sketched in the bug.

Agreed that the returned sets should be specified to be immutable.

Some newer methods added to Class omit the "get" prefix while many older 
methods include it.

I linked the RFE of this issue to the RFE for an ImmutableEnumSet.

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

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

Reply via email to