RFR: 8176188: jdk/internal/misc/JavaLangAccess/NewUnsafeString.java failing since 9-b93
claes.redestad at oracle.com
Sun Dec 3 19:53:01 UTC 2017
the compact strings JEP changed semantics of the package-private
constructor to do the same as the public String(char) constructor.
Previously the former was used in trusted, internal code to avoid
copying the given char,
but since the char now has to be converted to a byte that
optimization is no longer
possible via this method, and tests that checked that the returned
string shared the
given char naturally stopped working.
To fix this bug I propose the following clean-up:
- change all uses of JavaLangAccess.newUnsafeString(char) to new
- remove the package-private String(char, boolean) constructor
- remove the newUnsafeString from JavaLangAccess
- remove the now unnecessary NewUnsafeString test
 For some of the usages here we could improve somewhat by exposingthe
constructor, but I think that's out of scope here and I think we'd best
avoid leaking the
coder byte implementation detail outside of java.lang.
More information about the core-libs-dev