13.4
Evolution of Classes
BINARY COMPATIBILITY
within the package in which they are declared. Such types may be deleted or oth
erwise changed, even if incompatibilities are otherwise described here, provided
that the affected binaries of that package are updated together.
13.4 Evolution of Classes
This section describes the effects of changes to the declaration of a class and its
members and constructors on pre existing binaries.
13.4.1
abstract
Classes
If a class that was not
abstract
is changed to be declared
abstract
, then pre
existing binaries that attempt to create new instances of that class will throw either
an
InstantiationError
at link time, or an
InstantiationException
at run
time (if the method
newInstance
( 20.3.6) of class
Class
is used); such a change
is therefore not recommended for widely distributed classes.
Changing a class that was declared
abstract
to no longer be declared
abstract
does not break compatibility with pre existing binaries.
13.4.2
final
Classes
If a class that was not declared
final
is changed to be declared
final
, then a
VerifyError
is thrown if a binary of a pre existing subclass of this class is
loaded, because
final
classes can have no subclasses; such a change is not rec
ommended for widely distributed classes.
Changing a class that was declared
final
to no longer be declared
final
does not break compatibility with pre existing binaries.
13.4.3
public
Classes
Changing a class that was not declared
public
to be declared
public
does not
break compatibility with pre existing binaries.
If a class that was declared
public
is changed to not be declared
public
,
then an
IllegalAccessError
is thrown if a pre existing binary is linked that
needs but no longer has access to the class type; such a change is not recom
mended for widely distributed classes.
242
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