public class foo {
/* main method doesn't change, to show source compatibility */
public static void main (String[] args) {
SomeThirdClass factory = new SomeThirdClass();
NameWithTypo instance = factory.getNameWithTypoInstance();
}
}
class NameWithTypo {
}
class SomeThirdClass {
public NameWithTypo getNameWithTypoInstance() {
return new NameWithTypo();
}
}
and
public class other {
/* main method doesn't change, to show source compatibility */
public static void main (String[] args) {
SomeThirdClass factory = new SomeThirdClass();
NameWithTypo instance = factory.getNameWithTypoInstance();
}
}
To be binary compatible we have to be able to find the same methods later:
Busbey-MBA:Downloads busbey$ javac foo.java
Busbey-MBA:Downloads busbey$ javac other.java
Busbey-MBA:Downloads busbey$ javap NameWithTypo
Compiled from "foo.java"
class NameWithTypo {
NameWithTypo();
}
Busbey-MBA:Downloads busbey$ javap SomeThirdClass
Compiled from "foo.java"
class SomeThirdClass {
SomeThirdClass();
public NameWithTypo getNameWithTypoInstance();
}
Busbey-MBA:Downloads busbey$ java foo
Busbey-MBA:Downloads busbey$ java other