To resolve an unresolved symbolic reference from D to a class or interface C denoted by N, the following steps are performed:
-
The defining class loader of D is used to create a class or interface denoted by
N. This class or interface is C. The details of the process are given in §5.3.Any exception that can be thrown as a result of failure of class or interface creation can thus be thrown as a result of failure of class and interface resolution.
-
If C is an array class and its element type is a
referencetype, then a symbolic reference to the class or interface representing the element type is resolved by invoking the algorithm in §5.4.3.1 recursively. -
Finally, access permissions to C are checked.
-
If C is not accessible (§5.4.4) to D, class or interface resolution throws an
IllegalAccessError.This condition can occur, for example, if C is a class that was originally declared to be
publicbut was changed to be non-publicafter D was compiled.
-
If steps 1 and 2 succeed but step 3 fails, C is still valid and usable. Nevertheless, resolution fails, and D is prohibited from accessing C.