Find deprecated JVM flags
Asked Answered
L

3

6

I'm using the java -XX:+PrintFlagsFinal -version as per the Print all JVM flags question, to compare results between difference JDKs on my upgrade path to JVM 11.

I've noticed though that the result of PrintFlagsFinal will still return deprecated options — e.g. PrintGC is still present, even though running -XX:+PrintGC issues a warning & runs -Xlog:gc instead.

So is there an option similar to PrintFlagsFinal that I can use to find all options that are currently deprecated so I can avoid using them?

(Know that I can manually check the release notes, but wondering if there's an in-built way of finding out from the JVM, similar to jdeprscan for deprecated module dependencies)

Lepidopterous answered 26/11, 2018 at 9:40 Comment(0)
D
4

There are multiple "levels" of deprecation: ALIASED, DEPRECATED, OBSOLETE and EXPIRED flags with the meaning described in arguments.cpp.

Besides above categories, there are also deprecated tracing flags that are replaced with Unified JVM Logging options.

Finally, there are some flags not listed above that simply have "deprecated" in the description.

I'm not aware of a single place that collects all these deprecated flags together, but it's fairly easy to extract them from JVM sources: the mentioned arguments.cpp and globals*.hpp family. I also recommend VM Options Explorer site with well structured table of HotSpot JVM flags by version.

As of JDK 11, the list of deprecated/obsolete/expired and otherwise unsupported flags includes:

AggressiveOpts
AllowNonVirtualCalls
AssumeMP
CheckAssertionStatusDirectives
CheckEndorsedAndExtDirs
CompilerThreadHintNoPreempt
CreateMinidumpOnCrash
DefaultMaxRAMFraction
DeferPollingPageLoopCount
DeferThrSuspendLoopCount
EnableTracing
FastTLABRefill
FreqCountInvocations
IgnoreUnverifiableClassesDuringDump
InitialRAMFraction
InlineNotify
MaxGCMinorPauseMillis
MaxPermSize
MaxRAMFraction
MinRAMFraction
MonitorInUseLists
MustCallLoadClassInternal
NativeMonitorFlags
NativeMonitorSpinLimit
NativeMonitorTimeout
PermSize
PrintCompressedOopsMode
PrintGC
PrintGCDetails
PrintMalloc
PrintMallocFree
PrintSafepointStatistics
PrintSafepointStatisticsCount
PrintSafepointStatisticsTimeout
PrintSharedSpaces
SafepointSpinBeforeYield
SharedMiscCodeSize
SharedMiscDataSize
SharedReadOnlySize
SharedReadWriteSize
ShowSafepointMsgs
TraceBiasedLocking
TraceClassLoading
TraceClassLoadingPreorder
TraceClassPaths
TraceClassResolution
TraceClassUnloading
TraceExceptions
TraceJVMTIObjectTagging
TraceLoaderConstraints
TraceMonitorInflation
TraceRedefineClasses
TraceSafepointCleanupTime
TraceScavenge
UnlinkSymbolsALot
UnsyncloadClass
UseAppCDS
UseConcMarkSweepGC
UseLockedTracing
UseMembar
UseUTCFileTimestamp
VMThreadHintNoPreempt

UPDATE

Thanks to @chriswhocodes, VM Options Explorer now shows deprecated JVM flags.

Dingus answered 26/11, 2018 at 11:42 Comment(0)
E
3

I've added deprecation information to the VM Options Explorer at https://chriswhocodes.com/hotspot_option_differences.html Differences between JDK11 and JDK12 VM options

Enneahedron answered 1/12, 2018 at 11:58 Comment(0)
P
1

If you can run a Java Flight Recording on the application (e.g. in a development setting) and open it with Java/JDK Mission Control (>= 6.0.0) then JMC will analyze the flags you use to start your JVM and tell you which of them are deprecated.

Penstock answered 26/11, 2018 at 14:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.