Given this Java code:
interface I {
Object getId();
}
class A implements I {
public Long getId() {
return null;
}
}
javac I.java A.java
It compiles successfully. When disassembled the class files produces the following output:
javap I.class
javap A.class
Compiled from "I.java"
interface I {
public abstract java.lang.Object getId();
}
Compiled from "A.java"
class A implements I {
A();
public java.lang.Long getId(); <--- (1)
public java.lang.Object getId(); <--- (2)
}
Question is why two methods with the same signature (1) & (2) are present in the disassembled output ? Having two methods with the same signature - isn't it not something JLS disallows ?