RFR: 8254090: Collectors.toUnmodifiableList exposes shared secret
Paul Sandoz
psandoz at openjdk.java.net
Thu Oct 8 22:29:22 UTC 2020
On Thu, 8 Oct 2020 20:52:01 GMT, Stuart Marks <smarks at openjdk.org> wrote:
> Add check for ArrayList.class before passing it to the shared secret.
Marked as reviewed by psandoz (Reviewer).
src/java.base/share/classes/java/util/stream/Collectors.java line 303:
> 301: list -> {
> 302: if (list.getClass() == ArrayList.class) { // ensure it's trusted
> 303: return (List<T>)SharedSecrets.getJavaUtilCollectionAccess()
While we are in this method i think it should be possible to remove the all casts and the `@SuppressWarnings` (javac's
type inference got better after this method was added?).
-------------
PR: https://git.openjdk.java.net/jdk/pull/569
More information about the core-libs-dev
mailing list