Rawtypes warning in sun.nio.ch.CompletedFuture

Alan Bateman Alan.Bateman at oracle.com
Fri May 28 06:45:25 PDT 2010


Andrew John Hughes wrote:
> The static method withFailure in sun.nio.ch.CompletedFuture creates a
> CompletedFuture as a raw type rather than with the V type introduced
> in the method signature:
>
>      static <V> CompletedFuture<V> withFailure(Throwable exc) {
>          // exception must be IOException or SecurityException
>          if (!(exc instanceof IOException) && !(exc instanceof
> SecurityException))
>              exc = new IOException(exc);
>         return new CompletedFuture(null, exc);
>      }
>
> This causes a rawtypes warning and the build to fail (due to the use
> of -Werror) when JAVAC_MAX_WARNINGS is turned on.  Adding the
> appropriate type to the creation of CompletedFuture (as I assumed was
> originally intended by its introduction) fixes the issue.
>
> I also removed the SuppressWarnings annotations as they don't actually
> suppress any warnings.
>
> The webrev is:
>
> http://cr.openjdk.java.net/~andrew/warnings/webrev.02/
>
> created against current tl.
>
> Is this ok to push?  If so, can I have a bug ID for it?
>
> Thanks,
>   
Thanks for catching this (and the unnecessary SuppressWarnings too - 
they may have been left over from a previous version where they were 
needed).

Your change looks good to me and I've created this bug to track it:
  6956840: (ch) Rawtype warning when compiling sun.nio.ch.CompletedFuture

Regards,
Alan.



More information about the nio-dev mailing list