7006578: Project Coin: Retrofit JDK libraries with @SafeVarargs
authordarcy
Mon, 24 Jan 2011 20:04:08 -0800
changeset 8151 88b01a6d5f51
parent 8005 5bc99c45810a
child 8155 03e638d615c0
7006578: Project Coin: Retrofit JDK libraries with @SafeVarargs Reviewed-by: mduigou, alexp
jdk/src/share/classes/java/util/Arrays.java
jdk/src/share/classes/java/util/Collections.java
jdk/src/share/classes/java/util/EnumSet.java
jdk/src/share/classes/javax/swing/SwingWorker.java
jdk/src/share/classes/sun/swing/AccumulativeRunnable.java
--- a/jdk/src/share/classes/java/util/Arrays.java	Mon Jan 24 11:47:06 2011 -0800
+++ b/jdk/src/share/classes/java/util/Arrays.java	Mon Jan 24 20:04:08 2011 -0800
@@ -2823,6 +2823,7 @@
      * @param a the array by which the list will be backed
      * @return a list view of the specified array
      */
+    @SafeVarargs
     public static <T> List<T> asList(T... a) {
         return new ArrayList<>(a);
     }
--- a/jdk/src/share/classes/java/util/Collections.java	Mon Jan 24 11:47:06 2011 -0800
+++ b/jdk/src/share/classes/java/util/Collections.java	Mon Jan 24 20:04:08 2011 -0800
@@ -3827,6 +3827,7 @@
      * @see Collection#addAll(Collection)
      * @since 1.5
      */
+    @SafeVarargs
     public static <T> boolean addAll(Collection<? super T> c, T... elements) {
         boolean result = false;
         for (T element : elements)
--- a/jdk/src/share/classes/java/util/EnumSet.java	Mon Jan 24 11:47:06 2011 -0800
+++ b/jdk/src/share/classes/java/util/EnumSet.java	Mon Jan 24 20:04:08 2011 -0800
@@ -317,6 +317,7 @@
      *     or if <tt>rest</tt> is null
      * @return an enum set initially containing the specified elements
      */
+    @SafeVarargs
     public static <E extends Enum<E>> EnumSet<E> of(E first, E... rest) {
         EnumSet<E> result = noneOf(first.getDeclaringClass());
         result.add(first);
--- a/jdk/src/share/classes/javax/swing/SwingWorker.java	Mon Jan 24 11:47:06 2011 -0800
+++ b/jdk/src/share/classes/javax/swing/SwingWorker.java	Mon Jan 24 20:04:08 2011 -0800
@@ -404,6 +404,7 @@
      * @see #process
      *
      */
+    @SafeVarargs
     protected final void publish(V... chunks) {
         synchronized (this) {
             if (doProcess == null) {
--- a/jdk/src/share/classes/sun/swing/AccumulativeRunnable.java	Mon Jan 24 11:47:06 2011 -0800
+++ b/jdk/src/share/classes/sun/swing/AccumulativeRunnable.java	Mon Jan 24 20:04:08 2011 -0800
@@ -120,6 +120,7 @@
      * {@code Runnable} for execution.
      * @param args the arguments to accumulate
      */
+    @SafeVarargs
     public final synchronized void add(T... args) {
         boolean isSubmitted = true;
         if (arguments == null) {