13.5.2
Superinterfaces
BINARY COMPATIBILITY
13.5.2 Superinterfaces
Changes to the interface hierarchy cause errors in the same way that changes to
the class hierarchy do, as described in 13.4.4. In particular, changes that result in
any previous superinterface of a class no longer being a superinterface can break
compatibility with pre existing binaries, resulting in a
VerifyError
.
13.5.3 The Interface Members
Adding a member to an interface does not break compatibility with pre existing
binaries.
Deleting a member from an interface may cause linkage errors in pre existing
binaries. If the example program:
interface I { void hello(); }
class Test implements I {
public static void main(String[] args) {
I anI = new Test();
anI.hello();
}
public void hello() { System.out.println("hello"); }
}
is compiled and executed, it produces the output:
hello
Suppose that a new version of interface
I
is compiled:
interface I { }
If
I
is recompiled but not
Test
, then running the new binary with the existing
binary for
Test
will result in a
NoSuchMethodError
. (In some early implementa
tions of Java this program still executed; the fact that the method
hello
no longer
exists in interface
I
was not correctly detected.)
13.5.4 Field Declarations
The considerations for changing field declarations in interfaces are the same as
those for
static final
fields in classes, as described in 13.4.7 and 13.4.8.
260
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved