changeset 3381:dbfc1e419cb2

7006578: Project Coin: Retrofit JDK libraries with @SafeVarargs Reviewed-by: mduigou, alexp
author darcy
date Mon, 24 Jan 2011 20:04:08 -0800
parents 4cc447291326
children 6e7bed89ce84
files src/share/classes/java/util/Arrays.java src/share/classes/java/util/Collections.java src/share/classes/java/util/EnumSet.java src/share/classes/javax/swing/SwingWorker.java src/share/classes/sun/swing/AccumulativeRunnable.java
diffstat 5 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/util/Arrays.java	Mon Jan 24 11:47:06 2011 -0800
+++ b/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/src/share/classes/java/util/Collections.java	Mon Jan 24 11:47:06 2011 -0800
+++ b/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/src/share/classes/java/util/EnumSet.java	Mon Jan 24 11:47:06 2011 -0800
+++ b/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/src/share/classes/javax/swing/SwingWorker.java	Mon Jan 24 11:47:06 2011 -0800
+++ b/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/src/share/classes/sun/swing/AccumulativeRunnable.java	Mon Jan 24 11:47:06 2011 -0800
+++ b/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) {