8022190: Fix varargs lint warnings in the JDK
authordarcy
Mon, 05 Aug 2013 07:50:16 -0700
changeset 19199 4dfcc94aa1f2
parent 19198 513b533ed31a
child 19200 be4cd1d6be97
8022190: Fix varargs lint warnings in the JDK Reviewed-by: alanb, lancea, alexsch
jdk/src/share/classes/java/util/stream/Stream.java
jdk/src/share/classes/javax/swing/SwingWorker.java
jdk/src/share/classes/sun/reflect/annotation/AnnotationParser.java
jdk/src/share/classes/sun/swing/AccumulativeRunnable.java
--- a/jdk/src/share/classes/java/util/stream/Stream.java	Fri Aug 02 11:10:41 2013 -0700
+++ b/jdk/src/share/classes/java/util/stream/Stream.java	Mon Aug 05 07:50:16 2013 -0700
@@ -827,6 +827,7 @@
      * @return the new stream
      */
     @SafeVarargs
+    @SuppressWarnings("varargs") // Creating a stream from an array is safe
     public static<T> Stream<T> of(T... values) {
         return Arrays.stream(values);
     }
--- a/jdk/src/share/classes/javax/swing/SwingWorker.java	Fri Aug 02 11:10:41 2013 -0700
+++ b/jdk/src/share/classes/javax/swing/SwingWorker.java	Mon Aug 05 07:50:16 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -405,6 +405,7 @@
      *
      */
     @SafeVarargs
+    @SuppressWarnings("varargs") // Passing chunks to add is safe
     protected final void publish(V... chunks) {
         synchronized (this) {
             if (doProcess == null) {
--- a/jdk/src/share/classes/sun/reflect/annotation/AnnotationParser.java	Fri Aug 02 11:10:41 2013 -0700
+++ b/jdk/src/share/classes/sun/reflect/annotation/AnnotationParser.java	Mon Aug 05 07:50:16 2013 -0700
@@ -88,6 +88,7 @@
      * @param selectAnnotationClasses an array of annotation types to select when parsing
      */
     @SafeVarargs
+    @SuppressWarnings("varargs") // selectAnnotationClasses is used safely
     static Map<Class<? extends Annotation>, Annotation> parseSelectAnnotations(
                 byte[] rawAnnotations,
                 ConstantPool constPool,
--- a/jdk/src/share/classes/sun/swing/AccumulativeRunnable.java	Fri Aug 02 11:10:41 2013 -0700
+++ b/jdk/src/share/classes/sun/swing/AccumulativeRunnable.java	Mon Aug 05 07:50:16 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -121,6 +121,7 @@
      * @param args the arguments to accumulate
      */
     @SafeVarargs
+    @SuppressWarnings("varargs") // Copying args is safe
     public final synchronized void add(T... args) {
         boolean isSubmitted = true;
         if (arguments == null) {