13.4.13
Method and Constructor Parameters
BINARY COMPATIBILITY
should have as much or more access if compatibility with pre existing binaries is
to be preserved.
13.4.13 Method and Constructor Parameters
Changing the name of a formal parameter of a method or constructor does not
impact pre existing binaries. Changing the name of a method, the type of a formal
parameter to a method or constructor, or adding a parameter to or deleting a
parameter from a method or constructor declaration creates a method or construc
tor with a new signature, and has the combined effect of deleting the method or
constructor with the old signature and adding a method or constructor with the
new signature (see 13.4.12).
13.4.14 Method Result Type
Changing the result type of a method, replacing a result type with
void
, or replac
ing
void
with a result type has the combined effect of deleting the old method or
constructor and adding a new method or constructor with the new result type or
newly
void
result (see 13.4.12).
13.4.15
abstract
Methods
Changing a method that is declared
abstract
to no longer be declared
abstract
does not break compatibility with pre existing binaries.
Changing a method that is not declared
abstract
to be declared
abstract
will break compatibility with pre existing binaries that previously invoked the
method, causing an
AbstractMethodError
. If the example program:
class Super { void out() { System.out.println("Out"); } }
class Test extends Super {
public static void main(String[] args) {
Test t = new Test();
System.out.println("Way ");
t.out();
}
}
is compiled and executed, it produces the output:
Way
Out
Suppose that a new version of class
Super
is produced:
254
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