On 07/03/2013 04:40 PM, Brian Burkhalter wrote:
OK, this is ready to go now.

This error

src/share/classes/java/lang/ThreadLocal.java:139: warning: no @param for <T>
     public static <T> ThreadLocal<T> withInitial(Supplier<? extends T> 
supplier) {
                                      ^
Note: src/share/classes/java/lang/Boolean.java uses unchecked or unsafe 
operations.
Note: Recompile with -Xlint:unchecked for details.
1 warning

is still reported but I don't see the problem so perhaps it's a bug in the 
doclint option?

I believe the doclint option is correct, the T in that method is *not* the T in the class declaration; it is a local type variable on the method. Therefore, this change would resolve the warning:

diff -r a49208237599 src/share/classes/java/lang/ThreadLocal.java
--- a/src/share/classes/java/lang/ThreadLocal.java Wed Jul 03 13:30:46 2013 -0700 +++ b/src/share/classes/java/lang/ThreadLocal.java Wed Jul 03 16:57:54 2013 -0700
@@ -131,12 +131,13 @@
* Creates a thread local variable. The initial value of the variable is * determined by invoking the {@code get} method on the {@code Supplier}.
      *
+     * @param <S> the type of the thread local's value
* @param supplier the supplier to be used to determine the initial value
      * @return a new thread local variable
      * @throws NullPointerException if the specified supplier is null
      * @since 1.8
      */
- public static <T> ThreadLocal<T> withInitial(Supplier<? extends T> supplier) { + public static <S> ThreadLocal<S> withInitial(Supplier<? extends S> supplier) {
         return new SuppliedThreadLocal<>(supplier);
     }

as would

diff -r a49208237599 src/share/classes/java/lang/ThreadLocal.java
--- a/src/share/classes/java/lang/ThreadLocal.java Wed Jul 03 13:30:46 2013 -0700 +++ b/src/share/classes/java/lang/ThreadLocal.java Wed Jul 03 16:58:38 2013 -0700
@@ -131,6 +131,7 @@
* Creates a thread local variable. The initial value of the variable is * determined by invoking the {@code get} method on the {@code Supplier}.
      *
+     * @param <T> the type of the thread local's value
* @param supplier the supplier to be used to determine the initial value
      * @return a new thread local variable
      * @throws NullPointerException if the specified supplier is null

However, I would recommend the first of these.

Otherwise, the change looks good to go back.

-Joe


Brian

On Jul 3, 2013, at 3:21 PM, Brian Burkhalter wrote:

Reviewers:

For this issue

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=8019862 (should be public 
"soon").

here is the proposed update

http://cr.openjdk.java.net/~bpb/8019862/

Thanks,

Brian

Reply via email to