mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8257845: Integrate JEP 390
8254047: [JEP 390] Revise "value-based class" & apply to wrappers 8252181: [JEP 390] Define & apply annotation jdk.internal.ValueBased 8252183: [JEP 390] Add 'lint' warning for @ValueBased classes 8257027: [JEP 390] Diagnose synchronization on @ValueBased classes 8252180: [JEP 390] Deprecate wrapper class constructors for removal Co-authored-by: Roger Riggs <rriggs@openjdk.org> Co-authored-by: Srikanth Adayapalam <sadayapalam@openjdk.org> Co-authored-by: Lois Foltan <lfoltan@openjdk.org> Reviewed-by: rriggs, hseigel, mchung, darcy
This commit is contained in:
parent
ed4c4ee73b
commit
48d8650ae1
113 changed files with 695 additions and 327 deletions
|
@ -141,6 +141,7 @@ class ImmutableCollections {
|
|||
|
||||
static UnsupportedOperationException uoe() { return new UnsupportedOperationException(); }
|
||||
|
||||
@jdk.internal.ValueBased
|
||||
static abstract class AbstractImmutableCollection<E> extends AbstractCollection<E> {
|
||||
// all mutating methods throw UnsupportedOperationException
|
||||
@Override public boolean add(E e) { throw uoe(); }
|
||||
|
@ -247,6 +248,7 @@ class ImmutableCollections {
|
|||
|
||||
// ---------- List Implementations ----------
|
||||
|
||||
@jdk.internal.ValueBased
|
||||
static abstract class AbstractImmutableList<E> extends AbstractImmutableCollection<E>
|
||||
implements List<E>, RandomAccess {
|
||||
|
||||
|
@ -540,6 +542,7 @@ class ImmutableCollections {
|
|||
}
|
||||
}
|
||||
|
||||
@jdk.internal.ValueBased
|
||||
static final class List12<E> extends AbstractImmutableList<E>
|
||||
implements Serializable {
|
||||
|
||||
|
@ -646,6 +649,7 @@ class ImmutableCollections {
|
|||
}
|
||||
}
|
||||
|
||||
@jdk.internal.ValueBased
|
||||
static final class ListN<E> extends AbstractImmutableList<E>
|
||||
implements Serializable {
|
||||
|
||||
|
@ -737,6 +741,7 @@ class ImmutableCollections {
|
|||
|
||||
// ---------- Set Implementations ----------
|
||||
|
||||
@jdk.internal.ValueBased
|
||||
static abstract class AbstractImmutableSet<E> extends AbstractImmutableCollection<E>
|
||||
implements Set<E> {
|
||||
|
||||
|
@ -764,6 +769,7 @@ class ImmutableCollections {
|
|||
public abstract int hashCode();
|
||||
}
|
||||
|
||||
@jdk.internal.ValueBased
|
||||
static final class Set12<E> extends AbstractImmutableSet<E>
|
||||
implements Serializable {
|
||||
|
||||
|
@ -889,6 +895,7 @@ class ImmutableCollections {
|
|||
* least one null is always present.
|
||||
* @param <E> the element type
|
||||
*/
|
||||
@jdk.internal.ValueBased
|
||||
static final class SetN<E> extends AbstractImmutableSet<E>
|
||||
implements Serializable {
|
||||
|
||||
|
@ -1055,6 +1062,7 @@ class ImmutableCollections {
|
|||
|
||||
// ---------- Map Implementations ----------
|
||||
|
||||
@jdk.internal.ValueBased
|
||||
abstract static class AbstractImmutableMap<K,V> extends AbstractMap<K,V> implements Serializable {
|
||||
@Override public void clear() { throw uoe(); }
|
||||
@Override public V compute(K key, BiFunction<? super K,? super V,? extends V> rf) { throw uoe(); }
|
||||
|
@ -1085,6 +1093,7 @@ class ImmutableCollections {
|
|||
}
|
||||
}
|
||||
|
||||
@jdk.internal.ValueBased
|
||||
static final class Map1<K,V> extends AbstractImmutableMap<K,V> {
|
||||
@Stable
|
||||
private final K k0;
|
||||
|
@ -1151,6 +1160,7 @@ class ImmutableCollections {
|
|||
* @param <K> the key type
|
||||
* @param <V> the value type
|
||||
*/
|
||||
@jdk.internal.ValueBased
|
||||
static final class MapN<K,V> extends AbstractImmutableMap<K,V> {
|
||||
|
||||
@Stable
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue