mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8236850: Operations on constant List/Set.of(element) instances does not consistently constant fold
Reviewed-by: smarks, jrose, rriggs, psandoz
This commit is contained in:
parent
631b4d2694
commit
de96aeddf5
6 changed files with 219 additions and 100 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -1288,7 +1288,7 @@ public interface Map<K, V> {
|
|||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
static <K, V> Map<K, V> of() {
|
||||
return (Map<K,V>) ImmutableCollections.MapN.EMPTY_MAP;
|
||||
return (Map<K,V>) ImmutableCollections.EMPTY_MAP;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1606,7 +1606,7 @@ public interface Map<K, V> {
|
|||
static <K, V> Map<K, V> ofEntries(Entry<? extends K, ? extends V>... entries) {
|
||||
if (entries.length == 0) { // implicit null check of entries array
|
||||
@SuppressWarnings("unchecked")
|
||||
var map = (Map<K,V>) ImmutableCollections.MapN.EMPTY_MAP;
|
||||
var map = (Map<K,V>) ImmutableCollections.EMPTY_MAP;
|
||||
return map;
|
||||
} else if (entries.length == 1) {
|
||||
// implicit null check of the array slot
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue