Java implements generics by erasing. This means that at runtime there is almost no knowledge of generics. Instead, the compiler checks the generics, but under the cover, it converts everything to Object (or to the closest border of the generics).
If you decompile this method using javap, you will see that it reads:
public Object search(...
Each reference to T is deleted.
This is a serious limitation of generics in Java, which is often found in JRE classes with constructs like:
SomeClass<String> x = new SomeClass<String>(String.class);
String (String.class), , .
, , , .
.class, . , , , , ORM getters. , Hibernate, :
public List<Group> getGroups() {
Hibernate, , Group, .
( , generics, , T , , String instanceof String . , (T.equals(String.class)))