JDK-8197963 : Make the UseAppCDS option obsolete
  • Type: CSR
  • Component: hotspot
  • Sub-Component: runtime
  • Priority: P2
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 11
  • Submitted: 2018-02-14
  • Updated: 2018-04-18
  • Resolved: 2018-04-17
Related Reports
CSR :  
Description
Summary
-------

Make the UseAppCDS option obsolete in JDK 11 because it is no longer needed to separate the functionality for archiving non-system classes. The support for archiving non-system classes was open-sourced in JDK 10. Also, make SharedArchiveFile a product flag in JDK 11.

Problem
-------

The UseAppCDS flag was useful when AppCDS feature was in the closed and we wanted a separation of the feature from the basic CDS. Now AppCDS is in the open, the UseAppCDS flag is no longer serving its original purpose and complicates code unnecessarily.

The SharedArchiveFile flag is for specifying an alternative location of the generated shared archive file. It is a diagnostic flag for base CDS and requires -XX:+UnlockDiagnosticVMOptions by default, but a product flag when UseAppCDS is specified. The usage is inconsistent.

The benefit of removing the usage of UseAppCDS flag: 

 - Cleaner code 
 - Less confusion in the community about CDS and AppCDS. AppCDS is CDS but with application classes supported in the archive. It adds extra complexity to force the separation of the two. 
 - Users no longer need to specify -XX:+UseAppCDS to archive non-system classes. Simpler usage, which will result more adoptions.


Solution
--------

- Remove various 'if (UseAppCDS)' checks from CDS code. 
- Make the UseAppCDS flag obsolete in JDK 11 and remove in JDK 12. 
- Make SharedArchiveFile a product flag in JDK 11.

Specification
-------------

The UseAppCDS flag will be marked as obsolete and the SharedArchiveFile flag will be a product flag in JDK 11.


Comments
Thanks!
18-04-2018

Moving to Approved.
17-04-2018

Did basic editing pass and added myself as Reviewer. The "App" part of CDS is now always enabled and is controlled by the content of the class list file(s). There is no need to specifically opt-in any more, so deprecation makes no sense and so we just render the flag obsolete. The ability to control the location of the shared archive file is an integral part of using full CDS so it makes sense that the flag is simply a product flag. There is a somewhat convoluted history around this flag due to differences with Java SE Embedded requirements.
16-04-2018