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

Nashorn's ScriptLoader split delegation has to be adjusted

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b122
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description

        Nashorn's ScriptLoader uses Context's "appLoader" as it's parent loader. But it's loadClass delegates to StructureLoader first for nashorn and nashorn generated classes.

        With the new parent/child Layer of Modules, StructureLoader created Layer is parent layer of ScriptLoader created Layer. So, it is better if the class loader delegation is from ScriptLoader to StructureLoader. And then split delegation to non-nashorn classes (from findClass) to Context's appLoader. Note that the split delegation is still needed. Without that certain caller class loader based class resolutions will not work.

          Activity

          Hide
          sundar Sundararajan Athijegannathan added a comment -
          Currently, ScriptLoader's parent loader is the Context's appLoader - but it "split delegates" to StructureLoader (the) instance for Nashorn classes.This has to be adjusted it to mirror the Module Layer parent/child relation. Script Module Layer's parent layer is structure Module layer.

          Note that split delegation to Context's appLoader is still needed - without that certain caller loader based Class resolutions (from script code) won't work..
          But the split delegation to context's appLoader is a fallback and should not be the "main" parent loader delegation. Parent/child loader delegation chain should mimic the corresponding parent/child module Layer.
          Show
          sundar Sundararajan Athijegannathan added a comment - Currently, ScriptLoader's parent loader is the Context's appLoader - but it "split delegates" to StructureLoader (the) instance for Nashorn classes.This has to be adjusted it to mirror the Module Layer parent/child relation. Script Module Layer's parent layer is structure Module layer. Note that split delegation to Context's appLoader is still needed - without that certain caller loader based Class resolutions (from script code) won't work.. But the split delegation to context's appLoader is a fallback and should not be the "main" parent loader delegation. Parent/child loader delegation chain should mimic the corresponding parent/child module Layer.
          Hide
          hgupdate HG Updates added a comment -
          URL: http://hg.openjdk.java.net/jdk9/dev/nashorn/rev/782aca1c11f6
          User: sundar
          Date: 2016-06-01 09:48:10 +0000
          Show
          hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/dev/nashorn/rev/782aca1c11f6 User: sundar Date: 2016-06-01 09:48:10 +0000
          Hide
          hgupdate HG Updates added a comment -
          URL: http://hg.openjdk.java.net/jdk9/jdk9/nashorn/rev/782aca1c11f6
          User: lana
          Date: 2016-06-08 20:34:55 +0000
          Show
          hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/jdk9/nashorn/rev/782aca1c11f6 User: lana Date: 2016-06-08 20:34:55 +0000

            People

            • Assignee:
              sundar Sundararajan Athijegannathan
              Reporter:
              sundar Sundararajan Athijegannathan
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: