Skip to content

Commit

Permalink
AbstractMap inner classes should be marked as Serializable
Browse files Browse the repository at this point in the history
Unmodifiable types in Collections as well.
  • Loading branch information
niloc132 committed Aug 23, 2023
1 parent 9b9e888 commit 7e32721
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions user/super/com/google/gwt/emul/java/util/AbstractMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

import jsinterop.annotations.JsNonNull;

import java.io.Serializable;

/**
* Skeletal implementation of the Map interface. <a
* href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/AbstractMap.html">[Sun
Expand All @@ -32,7 +34,7 @@ public abstract class AbstractMap<K, V> implements Map<K, V> {
/**
* A mutable {@link Map.Entry} shared by several {@link Map} implementations.
*/
public static class SimpleEntry<K, V> extends AbstractEntry<K, V> {
public static class SimpleEntry<K, V> extends AbstractEntry<K, V> implements Serializable {
public SimpleEntry(K key, V value) {
super(key, value);
}
Expand All @@ -45,7 +47,8 @@ public SimpleEntry(Entry<? extends K, ? extends V> entry) {
/**
* An immutable {@link Map.Entry} shared by several {@link Map} implementations.
*/
public static class SimpleImmutableEntry<K, V> extends AbstractEntry<K, V> {
public static class SimpleImmutableEntry<K, V> extends AbstractEntry<K, V> implements
Serializable {
public SimpleImmutableEntry(K key, V value) {
super(key, value);
}
Expand Down
4 changes: 2 additions & 2 deletions user/super/com/google/gwt/emul/java/util/Collections.java
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ public static <T> SortedSet<T> synchronizedSortedSet(SortedSet<T> s) {
* TODO: make the unmodifiable collections serializable.
*/

static class UnmodifiableCollection<T> implements Collection<T> {
static class UnmodifiableCollection<T> implements Collection<T>, Serializable {
protected final Collection<? extends T> coll;

public UnmodifiableCollection(Collection<? extends T> coll) {
Expand Down Expand Up @@ -523,7 +523,7 @@ public List<T> subList(int fromIndex, int toIndex) {
}
}

static class UnmodifiableMap<K, V> implements Map<K, V> {
static class UnmodifiableMap<K, V> implements Map<K, V>, Serializable {

static class UnmodifiableEntrySet<K, V> extends
UnmodifiableSet<Map.Entry<K, V>> {
Expand Down

0 comments on commit 7e32721

Please sign in to comment.