Java Reference
In-Depth Information
efficient. One particularly useful data structure is a “method table” or other data struc-
ture 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
The binary representation of a class or interface references other classes and interfaces and
their fields, methods, and constructors symbolically, using the binary names (§ 13.1 ) of the
other classes and interfaces (§ 13.1 ) . For fields and methods, these symbolic references in-
clude the name of the class or interface type of which the field or method is a member, 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 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 typically, 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 with private , protected , 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.7 ) .
InstantiationError : A symbolic reference has been encountered that is used in class in-
stance 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 specif-
ic field of a specific class or interface, but the class or interface does not contain a
field of that name.
Search WWH ::




Custom Search