BINARY COMPATIBILITY
Class Body and Member Declarations
13.4.5
then the first method in the method table for
Super
 will now be
peek
, not
zero
.
Using the new binary code for
Super
 with the old binary code for
Hyper
 and
Test
 will cause the method invocation
as.zero(as)
 to dispatch to the method
peek
 in
Super
, rather than the method
zero
 in
Hyper
. This is a type violation, of
course; the argument is of type
Super
 but the parameter is of type
int
. With a few
plausible assumptions about internal data representations and the consequences of
the type violation, execution of this incorrect program might produce the output:
Super@ee300848
ee300848
A
poke
 method, capable of altering any location in memory, could be concocted
in a similar manner. This is left as an exercise for the reader.
The lesson is that a implementation of Java that lacks a verifier or fails to use
it will not maintain type safety and is, therefore, not a valid Java implementation.
13.4.5   Class Body and Member Declarations
No incompatibility with pre existing binaries is caused by adding a class member
that has the same name (for fields) or same name, signature, and return type (for
methods) as a member of a superclass or subclass. References to the original field
or method were resolved at compile time to a symbolic reference containing the
name of the class in which they were declared. This makes compiled Java code
more robust against changes than it might otherwise be. No error occurs even if
the set of classes being linked would encounter a compile time error. As an exam 
ple, if the program:
class Hyper { String h = "Hyper"; }
class Super extends Hyper { }
class Test extends Super {
public static void main(String[] args) {
String s = new Test().h;
System.out.println(s);
}
}
is compiled and executed, it produces the output:
Hyper
Suppose that a new version of class
Super
 is then compiled:
class Super extends Hyper { char h =  h ; }
If the resulting binary is used with the existing binaries for
Hyper
 and
Test
, then
the output is still:
245






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