RFR: 8325217: MethodSymbol.getModifiers() returns SEALED for restricted methods
ExE Boss
duke at openjdk.org
Tue Apr 2 09:16:01 UTC 2024
On Fri, 29 Mar 2024 01:17:42 GMT, Vicente Romero <vromero at openjdk.org> wrote:
> Please review this simple fix, basically javadoc is showing the `sealed` modifier for methods annotated with the `jdk.internal.javac.Restricted` annotation. This is because the `SEALED` and `RESTRICTED` flags share the same bit. The proposed solution is to drop the `RESTRICTED` flag at MethodSymbol::getModifiers before converting the flags to modifiers,
>
> TIA,
> Vicente
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java line 1999:
> 1997: // just in case the method is restricted but that is not a modifier
> 1998: long flags = flags() & ~RESTRICTED;
> 1999: return Flags.asModifierSet((flags & DEFAULT) != 0 ? flags & ~ABSTRACT : flags);
Maybe `Flags::asModifierSet` could be extended in another PR to take a parameter for the different modifier kinds, which would then be used to disambiguate overloaded `Flags` bits.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/18543#discussion_r1547464269
More information about the compiler-dev
mailing list