Is it possible to solve the “A generic array of T is created for a varargs parameter” compiler warning?

前端 未结 8 1644
Happy的楠姐
Happy的楠姐 2020-11-28 04:31

This is a simplified version of the code in question, one generic class uses another class with generic type parameters and needs to pass one of the generic types to a metho

8条回答
  •  孤城傲影
    2020-11-28 05:09

    When workings with arrays of generic type, I am forced to pass a reference to the generic type. With that, I can actually do the generic code, using java.lang.reflect.Array.

    http://java.sun.com/javase/6/docs/api/java/lang/reflect/Array.html

提交回复
热议问题