In the actual compiled bytecode of the method, no custom was performed due to the type of erasure .
When generating bytecode, the compiler treats any variable of the parameter type as having the same type as the upper bound of the parameter type, or Object if the type is unlimited. Therefore, if S in your method has a <S extends Integer> constraint, the compiler would have to add cast to Integer . However, since S unlimited, any references to S processed in byte code as a type of type Object - thus, it is not executed.
Using your method, as written, you can get rid of a compilation error by filling in the type parameters when calling the method:
YourClass.<MyDTO, Integer>getValues(list, "id")
Although, since this looks awkward, you will probably be able to get rid of a parameter of type T
source share