RFR: 8253402: Convert vmSymbols::SID to enum class [v2]
Ioi Lam
iklam at openjdk.java.net
Fri Sep 25 22:23:34 UTC 2020
On Fri, 25 Sep 2020 19:15:48 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:
>> How about having a new header file utilities/vmEnums.hpp that looks like this:
>>
>> // Include this header file if you just need the following enum types and
>> // you don't use their members directly. This way you don't need to include the
>> // complex header files that have the full definitions of these enums.
>> enum JVMFlagsEnum : int;
>> enum class vmSymbolID : int;
>>
>> My plan is to have at least 2 more such enums (one for `vmIntrinsics::ID`, and one for `SystemDictionary::WKID`).
>>
>> `: int` is the base type of the enum. I think that's part of the type's implementation so it shouldn't be exposed to
>> the user of these types. If we litter `enum class vmSymbolID : int;` all over, when we decide to change the base type
>> to something else, we would need to edit all such places. Worse, if your forward declaration is wrong, like
>>
>> enum class vmSymbolID : char;
>>
>> the compiler won't detect this if your source file doesn't *also* include vmSymbols.hpp, so it could be dangerous.
>
> I am okay with this suggestion.
I've moved the forward declarations into vmEnum.hpp in the latest version.
-------------
PR: https://git.openjdk.java.net/jdk/pull/276
More information about the hotspot-dev
mailing list