United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-6523122 : LinkageError is thrown when ClassCircularityError should be reported

Details
Type:
Bug
Submit Date:
2007-02-08
Status:
Closed
Updated Date:
2012-10-08
Project Name:
JDK
Resolved Date:
2007-03-15
Component:
hotspot
OS:
generic
Sub-Component:
runtime
CPU:
generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
6,6u2,6u3
Fixed Versions:
hs10 (b10)

Related Reports
Backport:
Backport:
Backport:
Backport:

Sub Tasks

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.
                                     
2007-03-15



Hardware and Software, Engineered to Work Together