[url]http://docs.oracle.com/javase/tutorial/java/generics/bridgeMethods.html
[/url]
桥方法是 test:[class java.lang.Object]
[/url]
import java.lang.reflect.Method;
import java.util.Arrays;
public class TestBridgeMethod {
public static void main(String[] args) {
Class<?> clazz = S.class;
Method[] methods = clazz.getMethods();
for(Method method : methods) {
if (method.isBridge())
{
System.out.println(method.getName() + ":" + Arrays.toString(method.getParameterTypes()) );
}
}
}
}
class P<T> {
public T test (T t){
return t;
}
}
class S extends P<String> {
@Override
public String test(String t) {
return t;
}
}
桥方法是 test:[class java.lang.Object]