Ensure subList and keySet overrides are consistent with List.subList and map.keySet w.r.t. returning @JsNonNull. Change-Id: Iaaaaba2af2d269b413aa5e1484257fa040c08caa
diff --git a/user/super/com/google/gwt/emul/java/util/AbstractList.java b/user/super/com/google/gwt/emul/java/util/AbstractList.java index 1455e86..9ec2487 100644 --- a/user/super/com/google/gwt/emul/java/util/AbstractList.java +++ b/user/super/com/google/gwt/emul/java/util/AbstractList.java
@@ -22,6 +22,8 @@ import static javaemul.internal.InternalPreconditions.checkPositionIndex; import static javaemul.internal.InternalPreconditions.checkState; +import jsinterop.annotations.JsNonNull; + /** * Skeletal implementation of the List interface. <a * href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/AbstractList.html">[Sun @@ -281,6 +283,7 @@ } @Override + @JsNonNull public List<E> subList(int fromIndex, int toIndex) { return new SubList<E>(this, fromIndex, toIndex); }
diff --git a/user/super/com/google/gwt/emul/java/util/AbstractMap.java b/user/super/com/google/gwt/emul/java/util/AbstractMap.java index 03c0343..e8c317c 100644 --- a/user/super/com/google/gwt/emul/java/util/AbstractMap.java +++ b/user/super/com/google/gwt/emul/java/util/AbstractMap.java
@@ -17,6 +17,8 @@ import static javaemul.internal.InternalPreconditions.checkNotNull; +import jsinterop.annotations.JsNonNull; + /** * Skeletal implementation of the Map interface. <a * href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/AbstractMap.html">[Sun @@ -191,6 +193,7 @@ } @Override + @JsNonNull public Set<K> keySet() { return new AbstractSet<K>() { @Override
diff --git a/user/super/com/google/gwt/emul/java/util/AbstractNavigableMap.java b/user/super/com/google/gwt/emul/java/util/AbstractNavigableMap.java index 2e7411c..219af93 100644 --- a/user/super/com/google/gwt/emul/java/util/AbstractNavigableMap.java +++ b/user/super/com/google/gwt/emul/java/util/AbstractNavigableMap.java
@@ -15,6 +15,8 @@ */ package java.util; +import jsinterop.annotations.JsNonNull; + /** * Skeletal implementation of a NavigableMap. */ @@ -377,6 +379,7 @@ } @Override + @JsNonNull public Set<K> keySet() { return navigableKeySet(); }
diff --git a/user/super/com/google/gwt/emul/java/util/Collections.java b/user/super/com/google/gwt/emul/java/util/Collections.java index 498b321..8ad6e6b 100644 --- a/user/super/com/google/gwt/emul/java/util/Collections.java +++ b/user/super/com/google/gwt/emul/java/util/Collections.java
@@ -24,6 +24,8 @@ import java.util.function.Predicate; import java.util.function.UnaryOperator; +import jsinterop.annotations.JsNonNull; + /** * Utility methods that operate on collections. * See <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Collections.html"> @@ -186,6 +188,7 @@ } @Override + @JsNonNull public Set keySet() { return EMPTY_SET; } @@ -458,6 +461,7 @@ } @Override + @JsNonNull public List<T> subList(int fromIndex, int toIndex) { return new UnmodifiableList<T>(list.subList(fromIndex, toIndex)); } @@ -626,6 +630,7 @@ } @Override + @JsNonNull public Set<K> keySet() { if (keySet == null) { keySet = new UnmodifiableSet<K>(map.keySet());
diff --git a/user/super/com/google/gwt/emul/java/util/Vector.java b/user/super/com/google/gwt/emul/java/util/Vector.java index 5d510bf..a71b5e3 100644 --- a/user/super/com/google/gwt/emul/java/util/Vector.java +++ b/user/super/com/google/gwt/emul/java/util/Vector.java
@@ -22,6 +22,8 @@ import java.util.function.Predicate; import java.util.function.UnaryOperator; +import jsinterop.annotations.JsNonNull; + /** * To keep performance characteristics in line with Java community expectations, * <code>Vector</code> is a wrapper around <code>ArrayList</code>. @@ -246,6 +248,7 @@ } @Override + @JsNonNull public List<E> subList(int fromIndex, int toIndex) { return arrayList.subList(fromIndex, toIndex); }