Adds JsType to some common JRE types.

Bug: #9365
Bug-Link: http://github.com/gwtproject/gwt/issues/9365
Change-Id: I88ee6092ed0801de2f63c132a10d1c4edd6f3a3e
Review-Link: https://gwt-review.googlesource.com/#/c/15191/
diff --git a/user/super/com/google/gwt/emul/java/lang/Enum.java b/user/super/com/google/gwt/emul/java/lang/Enum.java
index 4330052..715ec69 100644
--- a/user/super/com/google/gwt/emul/java/lang/Enum.java
+++ b/user/super/com/google/gwt/emul/java/lang/Enum.java
@@ -22,14 +22,18 @@
 
 import java.io.Serializable;
 
+import jsinterop.annotations.JsIgnore;
+import jsinterop.annotations.JsType;
+
 /**
  * The first-class representation of an enumeration.
  *
  * @param <E>
  */
-public abstract class Enum<E extends Enum<E>> implements Comparable<E>,
-    Serializable {
+@JsType
+public abstract class Enum<E extends Enum<E>> implements Comparable<E>, Serializable {
 
+  @JsIgnore
   public static <T extends Enum<T>> T valueOf(Class<T> enumType, String name) {
     JavaScriptObject enumValueOfFunc = checkNotNull(enumType).enumValueOfFunc;
     checkCriticalArgument(enumValueOfFunc != null);
@@ -92,6 +96,7 @@
     return this == other;
   }
 
+  @JsIgnore
   @SuppressWarnings("unchecked")
   public final Class<E> getDeclaringClass() {
     Class clazz = getClass();
diff --git a/user/super/com/google/gwt/emul/java/util/Collection.java b/user/super/com/google/gwt/emul/java/util/Collection.java
index d678e05..c93f686 100644
--- a/user/super/com/google/gwt/emul/java/util/Collection.java
+++ b/user/super/com/google/gwt/emul/java/util/Collection.java
@@ -21,6 +21,9 @@
 import java.util.stream.Stream;
 import java.util.stream.StreamSupport;
 
+import jsinterop.annotations.JsIgnore;
+import jsinterop.annotations.JsType;
+
 /**
  * General-purpose interface for storing collections of objects.
  * See <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Collection.html">
@@ -28,6 +31,7 @@
  *
  * @param <E> element type
  */
+@JsType
 public interface Collection<E> extends Iterable<E> {
 
   boolean add(E o);
@@ -48,9 +52,11 @@
 
   boolean isEmpty();
 
+  @JsIgnore
   @Override
   Iterator<E> iterator();
 
+  @JsIgnore
   default Stream<E> parallelStream() {
     // no parallelism in gwt
     return stream();
@@ -60,6 +66,7 @@
 
   boolean removeAll(Collection<?> c);
 
+  @JsIgnore
   default boolean removeIf(Predicate<? super E> filter) {
     checkNotNull(filter);
     boolean removed = false;
@@ -76,16 +83,19 @@
 
   int size();
 
+  @JsIgnore
   @Override
   default Spliterator<E> spliterator() {
     return Spliterators.spliterator(this, 0);
   }
 
+  @JsIgnore
   default Stream<E> stream() {
     return StreamSupport.stream(spliterator(), false);
   }
 
   Object[] toArray();
 
+  @JsIgnore
   <T> T[] toArray(T[] a);
 }
diff --git a/user/super/com/google/gwt/emul/java/util/List.java b/user/super/com/google/gwt/emul/java/util/List.java
index 794515c..87e49bf 100644
--- a/user/super/com/google/gwt/emul/java/util/List.java
+++ b/user/super/com/google/gwt/emul/java/util/List.java
@@ -19,6 +19,10 @@
 
 import java.util.function.UnaryOperator;
 
+import jsinterop.annotations.JsIgnore;
+import jsinterop.annotations.JsMethod;
+import jsinterop.annotations.JsType;
+
 /**
  * Represents a sequence of objects.
  * See <a href="https://docs.oracle.com/javase/8/docs/api/java/util/List.html">
@@ -26,57 +30,31 @@
  *
  * @param <E> element type
  */
+@JsType
 public interface List<E> extends Collection<E> {
 
-  @Override
-  boolean add(E o);
-
+  @JsMethod(name = "addAtIndex")
   void add(int index, E element);
 
-  @Override
-  boolean addAll(Collection<? extends E> c);
-
+  @JsMethod(name = "addAllAtIndex")
   boolean addAll(int index, Collection<? extends E> c);
 
-  @Override
-  void clear();
-
-  @Override
-  boolean contains(Object o);
-
-  @Override
-  boolean containsAll(Collection<?> c);
-
-  @Override
-  boolean equals(Object o);
-
   E get(int index);
 
-  @Override
-  int hashCode();
-
   int indexOf(Object o);
 
-  @Override
-  boolean isEmpty();
-
-  @Override
-  Iterator<E> iterator();
-
   int lastIndexOf(Object o);
 
+  @JsIgnore
   ListIterator<E> listIterator();
 
+  @JsIgnore
   ListIterator<E> listIterator(int from);
 
+  @JsMethod(name = "removeAtIndex")
   E remove(int index);
 
-  @Override
-  boolean remove(Object o);
-
-  @Override
-  boolean removeAll(Collection<?> c);
-
+  @JsIgnore
   default void replaceAll(UnaryOperator<E> operator) {
     checkNotNull(operator);
     for (int i = 0, size = size(); i < size; i++) {
@@ -84,14 +62,9 @@
     }
   }
 
-  @Override
-  boolean retainAll(Collection<?> c);
-
   E set(int index, E element);
 
-  @Override
-  int size();
-
+  @JsIgnore
   @SuppressWarnings("unchecked")
   default void sort(Comparator<? super E> c) {
     Object[] a = toArray();
@@ -101,17 +74,11 @@
     }
   }
 
+  @JsIgnore
   @Override
   default Spliterator<E> spliterator() {
     return Spliterators.spliterator(this, Spliterator.ORDERED);
   }
 
   List<E> subList(int fromIndex, int toIndex);
-
-  @Override
-  Object[] toArray();
-
-  @Override
-  <T> T[] toArray(T[] array);
-
 }
diff --git a/user/super/com/google/gwt/emul/java/util/Map.java b/user/super/com/google/gwt/emul/java/util/Map.java
index 41e6449..75bb871 100644
--- a/user/super/com/google/gwt/emul/java/util/Map.java
+++ b/user/super/com/google/gwt/emul/java/util/Map.java
@@ -22,12 +22,16 @@
 import java.util.function.BiFunction;
 import java.util.function.Function;
 
+import jsinterop.annotations.JsIgnore;
+import jsinterop.annotations.JsType;
+
 /**
  * Abstract interface for maps.
  *
  * @param <K> key type.
  * @param <V> value type.
  */
+@JsType
 public interface Map<K, V> {
 
   /**
@@ -69,6 +73,7 @@
 
   void clear();
 
+  @JsIgnore
   default V compute(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
     checkNotNull(remappingFunction);
 
@@ -81,6 +86,7 @@
     return value;
   }
 
+  @JsIgnore
   default V computeIfAbsent(K key, Function<? super K, ? extends V> remappingFunction) {
     checkNotNull(remappingFunction);
 
@@ -94,8 +100,9 @@
     return value;
   }
 
-  default V computeIfPresent(K key,
-                             BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
+  @JsIgnore
+  default V computeIfPresent(
+      K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
     checkNotNull(remappingFunction);
 
     V value = get(key);
@@ -114,11 +121,13 @@
 
   boolean containsValue(Object value);
 
+  @JsIgnore
   Set<Entry<K, V>> entrySet();
 
   @Override
   boolean equals(Object o);
 
+  @JsIgnore
   default void forEach(BiConsumer<? super K, ? super V> consumer) {
     checkNotNull(consumer);
     for (Entry<K, V> entry : entrySet()) {
@@ -140,6 +149,7 @@
 
   Set<K> keySet();
 
+  @JsIgnore
   default V merge(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction) {
     checkNotNull(remappingFunction);
     checkNotNull(value);
@@ -165,6 +175,7 @@
 
   V remove(Object key);
 
+  @JsIgnore
   default boolean remove(Object key, Object value) {
     Object currentValue = get(key);
     if (!Objects.equals(currentValue, value) || (currentValue == null && !containsKey(key))) {
@@ -178,6 +189,7 @@
     return containsKey(key) ? put(key, value) : null;
   }
 
+  @JsIgnore
   default boolean replace(K key, V oldValue, V newValue) {
     Object currentValue = get(key);
     if (!Objects.equals(currentValue, oldValue) || (currentValue == null && !containsKey(key))) {
@@ -187,6 +199,7 @@
     return true;
   }
 
+  @JsIgnore
   default void replaceAll(BiFunction<? super K, ? super V, ? extends V> function) {
     checkNotNull(function);
     for (Entry<K, V> entry : entrySet()) {
diff --git a/user/super/com/google/gwt/emul/java/util/Set.java b/user/super/com/google/gwt/emul/java/util/Set.java
index 07e6c18..8a5bf8c 100644
--- a/user/super/com/google/gwt/emul/java/util/Set.java
+++ b/user/super/com/google/gwt/emul/java/util/Set.java
@@ -15,62 +15,20 @@
  */
 package java.util;
 
+import jsinterop.annotations.JsIgnore;
+import jsinterop.annotations.JsType;
+
 /**
  * Represents a set of unique objects. <a
  * href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Set.html">[Sun docs]</a>
  *
  * @param <E> element type.
  */
+@JsType
 public interface Set<E> extends Collection<E> {
-
-  @Override
-  boolean add(E o);
-
-  @Override
-  boolean addAll(Collection<? extends E> c);
-
-  @Override
-  void clear();
-
-  @Override
-  boolean contains(Object o);
-
-  @Override
-  boolean containsAll(Collection<?> c);
-
-  @Override
-  boolean equals(Object o);
-
-  @Override
-  int hashCode();
-
-  @Override
-  boolean isEmpty();
-
-  @Override
-  Iterator<E> iterator();
-
-  @Override
-  boolean remove(Object o);
-
-  @Override
-  boolean removeAll(Collection<?> c);
-
-  @Override
-  boolean retainAll(Collection<?> c);
-
-  @Override
-  int size();
-
+  @JsIgnore
   @Override
   default Spliterator<E> spliterator() {
     return Spliterators.spliterator(this, Spliterator.DISTINCT);
   }
-
-  @Override
-  Object[] toArray();
-
-  @Override
-  <T> T[] toArray(T[] a);
-
 }