On Sat, 25 Jun 2022 19:08:48 GMT, Joe Darcy <da...@openjdk.org> wrote:
>> This is an early review of changes to better model JVM access flags, that is >> "modifiers" like public, protected, etc. but explicitly at a VM level. >> >> Language level modifiers and JVM level access flags are closely related, but >> distinct. There are concepts that overlap in the two domains (public, >> private, etc.), others that only have a language-level modifier (sealed), >> and still others that only have an access flag (synthetic). >> >> The existing java.lang.reflect.Modifier class is inadequate to model these >> subtleties. For example, the bit positions used by access flags on different >> kinds of elements overlap (such as "volatile" for fields and "bridge" for >> methods. Just having a raw integer does not provide sufficient context to >> decode the corresponding language-level string. Methods like >> Modifier.methodModifiers() were introduced to cope with this situation. >> >> With additional modifiers and flags on the horizon with projects like >> Valhalla, addressing the existent modeling deficiency now ahead of time is >> reasonable before further strain is introduced. >> >> This PR in its current form is meant to give the overall shape of the API. >> It is missing implementations to map from, say, method modifiers to access >> flags, taking into account overlaps in bit positions. >> >> The CSR https://bugs.openjdk.java.net/browse/JDK-8281660 will be filled in >> once the API is further along. > > Joe Darcy has updated the pull request with a new target base due to a merge > or a rebase. The incremental webrev excludes the unrelated changes brought in > by the merge/rebase. The pull request contains 53 additional commits since > the last revision: > > - Expand testing of Class access flags. > - Merge branch 'master' into JDK-8266670 > - Merge branch 'master' into JDK-8266670 > - Respond to review feedback from Mandy and Roger. > - Remove implSpec tag from Executable.accessFlags since the class is sealed. > - Improve support and tests for Class objects representing arrays and > primitives. > - Expand scope of tests. > - Merge branch 'master' into JDK-8266670 > - Add module-related tests. > - Fix typo Exe-Boss spotted in review feedback. > - ... and 43 more: https://git.openjdk.org/jdk/compare/74b04508...e2cccc16 src/java.base/share/classes/java/lang/module/ModuleDescriptor.java line 217: > 215: /** > 216: * {@return an unmodifiable set of the module {@linkplain > AccessFlag > 217: * requires flags, possibly empty}} Did you mean to include "possibly empty" in the link? Also a minor nit is that the accessFlags methods put "possibly empty" in first sentence of the method description but the other methods have "possibly-empty" in the (more detailed) return description. ------------- PR: https://git.openjdk.org/jdk/pull/7445