-
Bug
-
Resolution: Fixed
-
P4
-
16
If a class loader L derives a class C, as described in 5.3.5, L will be recorded as an initiating loader of C.
If that loader then discards C and returns some other class with the same name C' (which must have been derived by a different class loader), L will also be recorded as an initiating loader of C' (5.3.2).
HotSpot responds to this situation with a LinkageError when it checks loader constraints.
The rule being violated is specified as:
---
A loading constraint is violated if, and only if, all the following four conditions hold:
• There exists a loader L such that L has been recorded by the Java Virtual Machine as an initiating loader of a class C named N.
• There exists a loader L' such that L' has been recorded by the Java Virtual Machine as an initiating loader of a class C' named N.
• The equivalence relation defined by the (transitive closure of the) set of imposed constraints implies N^L = N^L'.
• C ≠ C'.
---
This almost addresses the scenario above, except that we need a *reflexive* closure to infer that N^L = N^L from a possibly-empty constraint relation. (The closure is presumably over the domain of all class loaders.) Reflexive closure is implied by "equivalence relation", but we should spell it out:
---
• The equivalence relation defined by the (**reflexive,** transitive closure of the) set of imposed constraints implies N^L = N^L'.
---
If that loader then discards C and returns some other class with the same name C' (which must have been derived by a different class loader), L will also be recorded as an initiating loader of C' (5.3.2).
HotSpot responds to this situation with a LinkageError when it checks loader constraints.
The rule being violated is specified as:
---
A loading constraint is violated if, and only if, all the following four conditions hold:
• There exists a loader L such that L has been recorded by the Java Virtual Machine as an initiating loader of a class C named N.
• There exists a loader L' such that L' has been recorded by the Java Virtual Machine as an initiating loader of a class C' named N.
• The equivalence relation defined by the (transitive closure of the) set of imposed constraints implies N^L = N^L'.
• C ≠ C'.
---
This almost addresses the scenario above, except that we need a *reflexive* closure to infer that N^L = N^L from a possibly-empty constraint relation. (The closure is presumably over the domain of all class loaders.) Reflexive closure is implied by "equivalence relation", but we should spell it out:
---
• The equivalence relation defined by the (**reflexive,** transitive closure of the) set of imposed constraints implies N^L = N^L'.
---