JDK-8251327 : Improve DecoratorSet type safety
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 16
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2020-08-09
  • Updated: 2024-02-19
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Description
DecoratorSet is currently just a typedef for uint64_t.  We could provide better type safety by using C++14 features.  It could be either a scoped enum or (with C++20) a literal type with a suite of constexpr operations.

Comments
The MSVC bug that is blocking this was fixed in Visual Studio 2022 version 17.9. It will likely be some time before the JDK requires that or a later version.
19-02-2024

In order to retain concise operations on DecoratorSets in template arguments, I was going to provide some short-named operations on DecoratorSet that would be found by ADL. So to go along with operator& (intersection), operator+ (union), operator- (set difference), there would be empty, any, disjoint, intersects, and contains; all of these and the enum in AccessDecorators namespace. Unfortunately, that runs into a bug in MSVC: https://developercommunity.visualstudio.com/content/problem/1034539/adl-fails-for-constexpr-function-in-function-param.html I've verified this bug is still present through VS2019 16.7.1. [later] Still fails as of MSVC v19.33. [later still - 2023-09-25: Received notification that the above MSVC bug has been fixed in dev and will be released soon. So unlikely for JDK 22.]
25-09-2023

I have a prototype for this. It works fine for gcc/clang, but it's running into problems with what appear to be MSVC bugs.
10-08-2020