While while testing a thing with AppCDS on/off, I found if you just switch to -XX:-UseAppCDS and leave all the other AppCDS options in place, you get an error about
Error: VM option 'SharedArchiveFile' is diagnostic and must be enabled via -XX:+UnlockDiagnosticVMOptions.
which is weird since you dont need explicit +UnlockDiagnosticVMOptions to use AppCDS.
$ /tmp/jdk/bin/java -Xshare:on -XX:+UnlockCommercialFeatures -XX:SharedArchiveFile=Netty.jsa -XX:+UseAppCDS --add-modules=java.se.ee --upgrade-module-path /home/eric/views/javax.annotation-api-1.2/target/javax.annotation-api-1.2.jar -jar target/jersey-netty-app-1.0-SNAPSHOT.jar
Jun 22, 2017 4:57:45 PM app.App main
INFO: Prometheus intializing JVM metrics
Jun 22, 2017 4:57:45 PM app.App main
INFO: Netty starting
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by io.netty.util.internal.ReflectionUtil (file:/home/eric/views/ccc-jersey-netty-app/target/jersey-netty-app-1.0-SNAPSHOT.jar) to constructor java.nio.DirectByteBuffer(long,int)
WARNING: Please consider reporting this to the maintainers of io.netty.util.internal.ReflectionUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Jun 22, 2017 4:57:45 PM app.App main
INFO: Netty started
[In the above case the app worked with AppCDS on]
$ /tmp/jdk/bin/java -Xshare:on -XX:+UnlockCommercialFeatures -XX:SharedArchiveFile=Netty.jsa -XX:-UseAppCDS --add-modules=java.se.ee --upgrade-module-path /home/eric/views/javax.annotation-api-1.2/target/javax.annotation-api-1.2.jar -jar target/jersey-netty-app-1.0-SNAPSHOT.jar
Error: VM option 'SharedArchiveFile' is diagnostic and must be enabled via -XX:+UnlockDiagnosticVMOptions.
Error: The unlock option must precede 'SharedArchiveFile'.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.