Clean backport of JDK-8333542. After this, we need a backport for JDK-8335134 to fix the test.
------------- Commit messages: - Backport b3bf31a0a08da679ec2fd21613243fb17b1135a9 Changes: https://git.openjdk.org/jdk/pull/19938/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19938&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8333542 Stats: 516 lines in 16 files changed: 339 ins; 129 del; 48 mod Patch: https://git.openjdk.org/jdk/pull/19938.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19938/head:pull/19938 PR: https://git.openjdk.org/jdk/pull/19938