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

Object.bindProperties with bean binding fails when underlying object has a @CS method

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 8
    • 8
    • core-libs
    • None
    • b106
    • generic
    • generic

      File: test.js

      jjs test.js

      Exception in thread "main" java.lang.IllegalAccessError: Failed to unreflect method public java.lang.ClassLoader java.lang.Thread.getContextClassLoader()
      at jdk.internal.dynalink.support.Lookup.unreflect(Lookup.java:140)
      at jdk.internal.dynalink.beans.CallerSensitiveDynamicMethod.getTarget(CallerSensitiveDynamicMethod.java:149)
      at jdk.internal.dynalink.beans.SingleDynamicMethod.getInvocation(SingleDynamicMethod.java:128)
      at jdk.internal.dynalink.beans.AbstractJavaLinker$AnnotatedDynamicMethod.getInvocation(AbstractJavaLinker.java:806)
      at jdk.internal.dynalink.beans.AbstractJavaLinker.getPropertyGetter(AbstractJavaLinker.java:605)
      at jdk.internal.dynalink.beans.AbstractJavaLinker.getGuardedInvocationComponent(AbstractJavaLinker.java:363)
      at jdk.internal.dynalink.beans.BeanLinker.getGuardedInvocationComponent(BeanLinker.java:132)
      at jdk.internal.dynalink.beans.AbstractJavaLinker.getGuardedInvocation(AbstractJavaLinker.java:345)
      at jdk.nashorn.internal.objects.NativeObject.getBeanOperation(NativeObject.java:662)
      at jdk.nashorn.internal.objects.NativeObject.bindBeanProperties(NativeObject.java:637)
      at jdk.nashorn.internal.objects.NativeObject.bindProperties(NativeObject.java:607)
      at jdk.nashorn.internal.scripts.Script$test.runScript(test.js:2)
      at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:518)
      at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:204)
      at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:364)
      at jdk.nashorn.tools.Shell.apply(Shell.java:386)
      at jdk.nashorn.tools.Shell.runScripts(Shell.java:315)
      at jdk.nashorn.tools.Shell.run(Shell.java:179)
      at jdk.nashorn.tools.Shell.main(Shell.java:143)
      at jdk.nashorn.tools.Shell.main(Shell.java:122)
      Caused by: java.lang.IllegalAccessException: Attempt to lookup caller-sensitive method using restricted lookup object
      at java.lang.invoke.MethodHandles$Lookup.findBoundCallerClass(MethodHandles.java:1041)
      at java.lang.invoke.MethodHandles$Lookup.unreflect(MethodHandles.java:901)
      at jdk.internal.dynalink.support.Lookup.unreflect(Lookup.java:138)
      ... 19 more


      While we'd like to definitely avoid binding @CS methods or bean properties to script object, we'd still like to bind other safe properties and methods. Currently, Object.bindProperties terminates with throwing error.

            attila Attila Szegedi
            sundar Sundararajan Athijegannathan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: