BINARY COMPATIBILITY
Method and Constructor Declarations
13.4.12
13.4.9
static
Fields
If a field that is not declared
private
 was not declared
static
 and is changed to
be declared
static
, or vice versa, then a linkage time error, specifically an
IncompatibleClassChangeError
, will result if the field is used by a preexisting
binary which expected a field of the other kind. Such changes are not recom 
mended in code that has been widely distributed.
13.4.10
transient
Fields
Adding or deleting a
transient
 modifier of a field does not break compatibility
with pre existing binaries.
13.4.11
volatile
Fields
If a field that is not declared
private
 was not declared
volatile
 and is changed
to be declared
volatile
, or vice versa, then a linkage time error, specifically an
IncompatibleClassChangeError
, may result if the field is used by a preexisting
binary that expected a field of the opposite volatility. Such changes are not recom 
mended in code that has been widely distributed.
13.4.12   Method and Constructor Declarations
Adding a method or constructor declaration to a class will not break compatibility
with any pre existing binaries, even in the case where a type could no longer be
recompiled because a method invocation previously referenced a method of a
superclass with an incompatible type. The previously compiled class with such a
reference will continue to reference the method declared in a superclass.
Deleting a method or constructor from a class will break compatibility with
any pre existing binary that referenced this method or constructor; a
NoSuchMethodError
will be thrown when such a reference from a pre existing
binary is linked. Only
private
 methods or constructors may be safely deleted
from a widely distributed class.
If the source code for a class contains no declared constructors, the Java com 
piler automatically supplies a constructor with no parameters. Adding one or more
constructor declarations to the source code of such a class will prevent this default
constructor from being supplied automatically, effectively deleting a constructor,
unless one of the new constructors also has no parameters, thus replacing the
default constructor. The automatically supplied constructor with no parameters is
given the same access modifier as the class of its declaration, so any replacement
253






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

java hosting

 

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