RFR: 8325217: MethodSymbol.getModifiers() returns SEALED for restricted methods
Vicente Romero
vromero at openjdk.org
Tue Apr 2 15:04:00 UTC 2024
On Tue, 2 Apr 2024 09:13:03 GMT, ExE Boss <duke 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.
yep we could have other instances of this same issue in the future
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/18543#discussion_r1548068147
More information about the compiler-dev
mailing list