RFR [12] 8209454: [error-prone] TypeParameterUnusedInFormals in jdk.net

Daniel Fuchs daniel.fuchs at oracle.com
Mon Oct 1 15:38:53 UTC 2018


Hi Chris,

I believe you should get rid of the parameter U: I do not
see it's purpose in this class. I suggest simplifying into:

  <T> T checkValueType(Object value, Class<T>) { }


best regards,

-- daniel

On 01/10/2018 15:02, Chris Hegarty wrote:
> The declaration of the implementation private method `checkValueType`,
> has a misuse of generics by only using a naked type parameter as a
> return type. One solution is to ensure that the return type is a subtype
> of the known SocketFlow type, by passing the expected class literal.
> 
> http://cr.openjdk.java.net/~chegar/8209454.00/
> 
> -Chris.



More information about the net-dev mailing list