News for hackers. Stuff that matters.
Re:Bytecode features not available in the Java language by peeters on Friday April 17, 2015 @04:35PM (#9397057)
True. 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:
	      ...

There are no comments on this comment yet.