Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6523122

LinkageError is thrown when ClassCircularityError should be reported

XMLWordPrintable

    • b10
    • generic
    • generic

        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

              acorn Karen Kinnear (Inactive)
              vlivanov Vladimir Ivanov
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: