Java Reference
In-Depth Information
Example 13.5.3-1. Deleting An Interface Member
Click here to view code image
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"); }
}
This program 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 .
13.5.4. Interface Type Parameters
The effects of changes to the type parameters of an interface are the same as those of ana-
logous changes to the type parameters of a class.
13.5.5. 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.8 and § 13.4.9 .
13.5.6. abstract Methods
The considerations for changing abstract method declarations in interfaces are the same
as those for abstract methods in classes, as described in § 13.4.14 , § 13.4.15 , § 13.4.21 , and
§ 13.4.23 .
13.5.7. Evolution of Annotation Types
Annotation types behave exactly like any other interface. Adding or removing an element
from an annotation type is analogous to adding or removing a method. There are important
considerations governing other changes to annotation types, but these have no effect on the
linkage of binaries by the Java Virtual Machine. Rather, such changes affect the behavior
Search WWH ::




Custom Search