Overriding Java generic methods
问题 I wanted to create an interface for copying an object to a destination object of the same class. The simple way is to use casting: import org.junit.Test; import org.junit.internal.runners.JUnit4ClassRunner; import org.junit.runner.RunWith; @RunWith(JUnit4ClassRunner.class) public class TestGenerics { public static interface Copyable { public void copy(Copyable c); } public static class A implements Copyable { private String aField = "--A--"; protected void innerCopy(Copyable c) { A a = (A)c;