EXECUTION
Resolution of Symbolic References
12.3.3
12.3.2 Preparation of a Class or Interface Type
Preparation
involves creating the
static
fields (class variables and constants) for
a class or interface and initializing such fields to the standard default values
( 4.5.4). This does not require the execution of any Java code; explicit initializers
for
static
fields are executed as part of initialization ( 12.4), not preparation.
Java implementations must detect the following error during preparation:
AbstractMethodError
: A class that is not declared to be
abstract
has an
abstract
method. This can occur, for example, if a method that is originally
not
abstract
is changed to be
abstract
after another class that inherits the
now
abstract
method declaration has been compiled ( 13.4.15).
If such an error is detected, then an instance of
AbstractMethodError
should be
thrown at the point in the Java program that caused the class to be prepared.
Implementations of the Java Virtual Machine may precompute additional data
structures at preparation time in order to make later operations on a class or inter
face more efficient. One particularly useful data structure is a method table or
other data structure that allows any method to be invoked on instances of a class
without requiring a search of superclasses at invocation time.
12.3.3 Resolution of Symbolic References
A Java binary file references other classes and interfaces and their fields, methods,
and constructors symbolically, using the fully qualified names of the other classes
and interfaces ( 13.1). For fields and methods, these symbolic references include
the name of the class or interface type that declares the field or method as well as
the name of the field or method itself, together with appropriate type information.
Before a symbolic reference can be used it must be undergo
resolution
,
wherein a symbolic reference is checked to be correct and, typically, replaced with
a direct reference that can be more efficiently processed if the reference is used
repeatedly.
If an error occurs during resolution, then an error will be thrown. Most typi
cally, this will be an instance of one of the following subclasses of the class
IncompatibleClassChangeError
, but it may also be an instance of some other
subclass of
IncompatibleClassChangeError
or even an instance of the class
IncompatibleClassChangeError
itself. This error may be thrown at any point
in the program that uses a symbolic reference to the type, directly or indirectly:
IllegalAccessError
: A symbolic reference has been encountered that
specifies a use or assignment of a field, or invocation of a method, or creation
of an instance of a class, to which the code containing the reference does not
have access because the field or method was declared
private
,
protected
,
221
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