https://github.com/openjdk/jdk/blob/adb3d4f14af1974e7fc9461eb59f98131f0d33f7/src/hotspot/share/runtime/globals.hpp#L37-L41
// develop flags are settable / visible only during development and are constant in the PRODUCT version
// product flags are always settable / visible
// notproduct flags are settable / visible only during development and are not declared in the PRODUCT version
// develop_pd/product_pd flags are the same as develop/product, except that their default values
// are specified in platform-dependent header files.
However, we declare the notproduct flags in a product build anyway:
https://github.com/openjdk/jdk/blob/adb3d4f14af1974e7fc9461eb59f98131f0d33f7/src/hotspot/share/runtime/globals_shared.hpp#L77
#ifdef PRODUCT
#define DECLARE_DEVELOPER_FLAG(type, name, value, ...) const type name = value;
#define DECLARE_PD_DEVELOPER_FLAG(type, name, ...) const type name = pd_##name;
#define DECLARE_NOTPRODUCT_FLAG(type, name, value, ...) const type name = value;
#else
...
After JDK-8292590, we will have a non-consistent behavior such that:
[1] Reading the flag works:
if (UseDebuggerErgo) {
[2] But setting the flag will cause a C++ compile error
FLAG_SET_ERGO_IF_DEFAULT(UseDebuggerErgo1, true);