Unlike synthetic accessor methods, these synthetic covariant methods are hard or impossible to kill. Generics anyone?
interface Thing<T> { | |
T thing(); | |
} | |
class CharSequenceThing implements Thing<CharSequence> { | |
@Override public CharSequence thing() { | |
return "CharSequence!"; | |
} | |
} |
$ javap -p Thing CharSequenceThing | |
Compiled from "GenericCovariants.java" | |
interface Thing<T> { | |
public abstract T thing(); | |
} | |
Compiled from "GenericCovariants.java" | |
class CharSequenceThing implements Thing<java.lang.CharSequence> { | |
CharSequenceThing(); | |
public java.lang.CharSequence thing(); | |
public java.lang.Object thing(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment