BINARY COMPATIBILITY
Superclasses and Superinterfaces
13.4.4
13.4.4   Superclasses and Superinterfaces
A
ClassCircularityError
 is thrown at load time if a class would be a super 
class of itself. Changes to the class hierarchy that could result in such a circularity
when newly compiled binaries are loaded with pre existing binaries are not rec 
ommended for widely distributed classes.
Changing the direct superclass or the set of direct superinterfaces of a class
type will not break compatibility with pre existing binaries, provided that the total
set of superclasses or superinterfaces, respectively, of the class type loses no
members.
Changes to the set of superclasses of a class will not break compatibility with
pre existing binaries simply because of uses of class variables and class methods.
This is because uses of class variables and class methods are resolved at compile
time to symbolic references to the name of the class that declares them. Such uses
therefore depend only on the continuing existence of the class declaring the vari 
able or method, not on the shape of the class hierarchy.
If a change to the direct superclass or the set of direct superinterfaces results
in any class or interface no longer being a superclass or superinterface, respec 
tively, then link time errors may result if pre existing binaries are loaded with the
binary of the modified class. Such changes are not recommended for widely dis 
tributed classes. The resulting errors are detected by the verifier of the Java Virtual
Machine when an operation that previously compiled would violate the type sys 
tem. For example, suppose that the following test program:
class Hyper { char h =  h ; }
class Super extends Hyper { char s =  s ; }
class Test extends Super {
    public static void main(String[] args) {
        Hyper h = new Super();
        System.out.println(h.h);
    }
}
is compiled and executed, producing the output:
h
Suppose that a new version of class
Super
 is then compiled:
class Super { char s =  s ; }
This version of class
Super
 is not a subclass of
Hyper
. If we then run the existing
binaries of
Hyper
 and
Test
 with the new version of
Super
, then a
VerifyError
is thrown at link time. The verifier objects because the result of
new Super()
243






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