JDK-6523122 : LinkageError is thrown when ClassCircularityError should be reported
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 6,6u2,6u3
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2007-02-08
  • Updated: 2012-10-08
  • Resolved: 2007-03-15
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other JDK 6 JDK 7 Other
5.0u33,hs10Fixed 6u2Resolved 7Fixed hs10Fixed
Description
When circular hierarchy is loaded using 2 class loaders delegating the loading of particular classes to each other, when the circularity is detected, in spite of ClassCircularityError, LinkageError is thrown. The peculiarity is that the loading should be initiated by calling to Class.forName(), not ClassLoader.loadClass().

The following test is affected:
	runtime/ParallelClassLoading/ClassCircularityError/delegation/forName

Test debug output:
Main Thread: Starting...
Main Thread: Starting classloading...
Loading Thread #1: Ready to start. Waiting for command.
Main Thread: Waiting for threads. Threads running: 1
Loading Thread #1: Starting...
Loading Thread #1: [Delegate custom.A to Loader #2.]
Loading Thread #1: [runtime.ParallelClassLoading.shared.CustomLoader@743399: Loading custom.A from file]
Loading Thread #1: [Delegate custom.B to Loader #1.]
Loading Thread #1: [runtime.ParallelClassLoading.shared.CustomLoader@a981ca: Loading custom.B from file]
Loading Thread #1: Error "java.lang.LinkageError" during defining class "custom.B":
Loading Thread #1:      java.lang.LinkageError: custom/A
Loading Thread #1:      Calling findLoadedClass("custom.B")...
Loading Thread #1:      Returning from findLoadedClass("custom.B")...
Loading Thread #1:      ERROR: findLoadedClass("custom.B") returns null when
               LinkageError due to class duplication is caught!
Loading Thread #1: Error "java.lang.NoClassDefFoundError" during defining class "custom.A":
Loading Thread #1:      java.lang.NoClassDefFoundError: custom/B
Loading Thread #1:      Calling findLoadedClass("custom.A")...
Loading Thread #1:      Returning from findLoadedClass("custom.A")...
Loading Thread #1:      ERROR: findLoadedClass("custom.A") returns null when
               LinkageError due to class duplication is caught!
Loading Thread #1: Exception is caught: java.lang.ClassNotFoundException
Loading Thread #1: Finished: false
Main Thread: Waiting for 0 threads
java.lang.ClassNotFoundException exception is caught in "Loading Thread #1": null
1 threads failed during execution.
Main Thread: TEST FAILED

Comments
EVALUATION Check for class circularity during parallel loading threw generic LinkageError rather than ClassCircularityError. Also clean up LOAD_INSTANCE seen_thread in placeholder entry.
15-03-2007