12.3.4
Linking: Implications for Code Generation
EXECUTION
or default access (not
public
), or because the class was not declared
public
.
This can occur, for example, if a field that is originally declared
public
is
changed to be
private
after another class that refers to the field has been
compiled ( 13.4.6).
InstantiationError
: A symbolic reference has been encountered that is
used in a class instance creation expression, but an instance cannot be created
because the reference turns out to refer to an interface or to an
abstract
class. This can occur, for example, if a class that is originally not
abstract
is
changed to be
abstract
after another class that refers to the class in question
has been compiled ( 13.4.1).
NoSuchFieldError
: A symbolic reference has been encountered that refers
to a specific field of a specific class or interface, but the class or interface does
not declare a field of that name (it is specifically not sufficient for it simply to
be an inherited field of that class or interface). This can occur, for example, if
a field declaration was deleted from a class after another class that refers to
the field was compiled ( 13.4.7).
NoSuchMethodError
: A symbolic reference has been encountered that refers
to a specific method of a specific class or interface, but the class or interface
does not declare a method of that signature (it is specifically not sufficient for
it simply to be an inherited method of that class or interface). This can occur,
for example, if a method declaration was deleted from a class after another
class that refers to the method was compiled ( 13.4.12).
Additionally, an
UnsatisfiedLinkError
(a subclass of
LinkageError
)
may be thrown if a class declares a
native
method for which no implementation
can be found. The error will occur if the method is used, or earlier depending on
what kind of resolution strategy is being used by the virtual machine ( 12.3).
12.3.4 Linking: Implications for Code Generation
The symbolic references within a group of types may be resolved even before the
group is loaded ( 12.2.2), in an implementation that uses a special (non standard)
binary format ( 13.1). This corresponds to the traditional practice of linkage
editing. Even if this is not done, a Java implementation has a lot of flexibility. It
may resolve all symbolic references from a type at the point of the first linkage
activity on the type, or defer the resolution of each symbolic reference to the first
use of that reference.
We note that the flexibility accorded the Java implementation in the linkage
process does not affect correctly formed Java programs, which should never
encounter linkage errors.
222
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