3 ms·
You can define two methods that differ only by return type. That's how covariant returns work. Check the javap output and recoil in horror.
by quotemstr 12y ago
You can define two methods that differ only by return type. That's how covariant returns work. Check the javap output and recoil in horror.
- peeters 12y agoTrue. One of them is a bridge method. Here's an example: class CovariantReturn extends CovariantReturnBase { public Integer produce() { return 5; } } class CovariantReturnBase { public Number produce() { return 4.5; } } And the relevant javap output for CovariantReturn: public java.lang.Integer produce(); flags: ACC_PUBLIC Code: ... public java.lang.Number produce(); flags: ACC_PUBLIC, ACC_BRIDGE, ACC_SYNTHETIC Code: ...