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

ClassFormatError thrown when arrow function is used

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 9
    • 9
    • core-libs
    • None
    • b118
    • generic
    • generic

    Description

      File: test.js

      print((x=>x+1)(33))

      Output:

      Exception in thread "main" java.lang.ClassFormatError: Illegal method name "=>:1" in class jdk/nashorn/internal/scripts/Script$Recompilation$2$7I$test
              at java.lang.ClassLoader.defineClass1(java.base@9-internal/Native Method)
              at java.lang.ClassLoader.defineClass(java.base@9-internal/ClassLoader.java:942)
              at java.security.SecureClassLoader.defineClass(java.base@9-internal/SecureClassLoader.java:152)
              at jdk.nashorn.internal.runtime.ScriptLoader.installClass(jdk.scripting.nashorn@9-internal/ScriptLoader.java:102)
              at jdk.nashorn.internal.runtime.Context$NamedContextCodeInstaller.install(jdk.scripting.nashorn@9-internal/Context.java:286)
              at jdk.nashorn.internal.codegen.CompilationPhase$InstallPhase.transform(jdk.scripting.nashorn@9-internal/CompilationPhase.java:501)
              at jdk.nashorn.internal.codegen.CompilationPhase.apply(jdk.scripting.nashorn@9-internal/CompilationPhase.java:630)
              at jdk.nashorn.internal.codegen.Compiler.compile(jdk.scripting.nashorn@9-internal/Compiler.java:656)
              at jdk.nashorn.internal.runtime.RecompilableScriptFunctionData.compileTypeSpecialization(jdk.scripting.nashorn@9-internal/RecompilableScriptFunctionData.java:717)
              at jdk.nashorn.internal.runtime.RecompilableScriptFunctionData.getBest(jdk.scripting.nashorn@9-internal/RecompilableScriptFunctionData.java:897)
              at jdk.nashorn.internal.runtime.ScriptFunctionData.getBest(jdk.scripting.nashorn@9-internal/ScriptFunctionData.java:392)
              at jdk.nashorn.internal.runtime.ScriptFunctionData.getBestInvoker(jdk.scripting.nashorn@9-internal/ScriptFunctionData.java:254)
              at jdk.nashorn.internal.runtime.ScriptFunction.findCallMethod(jdk.scripting.nashorn@9-internal/ScriptFunction.java:917)
              at jdk.nashorn.internal.runtime.ScriptObject.lookup(jdk.scripting.nashorn@9-internal/ScriptObject.java:1861)
              at jdk.nashorn.internal.runtime.linker.NashornLinker.getGuardedInvocation(jdk.scripting.nashorn@9-internal/NashornLinker.java:104)
              at jdk.nashorn.internal.runtime.linker.NashornLinker.getGuardedInvocation(jdk.scripting.nashorn@9-internal/NashornLinker.java:96)
              at jdk.dynalink.linker.support.CompositeTypeBasedGuardingDynamicLinker.getGuardedInvocation(jdk.dynalink@9-internal/CompositeTypeBasedGuardingDynamicLinker.java:184)
              at jdk.dynalink.linker.support.CompositeGuardingDynamicLinker.getGuardedInvocation(jdk.dynalink@9-internal/CompositeGuardingDynamicLinker.java:132)
              at jdk.dynalink.LinkerServicesImpl.lambda$getGuardedInvocation$0(jdk.dynalink@9-internal/LinkerServicesImpl.java:160)
              at jdk.dynalink.LinkerServicesImpl.getWithLookupInternal(jdk.dynalink@9-internal/LinkerServicesImpl.java:191)
              at jdk.dynalink.LinkerServicesImpl.getGuardedInvocation(jdk.dynalink@9-internal/LinkerServicesImpl.java:158)
              at jdk.dynalink.DynamicLinker.relink(jdk.dynalink@9-internal/DynamicLinker.java:262)
              at jdk.nashorn.internal.scripts.Script$Recompilation$1$test.:program(jdk.scripting.nashorn.scripts/test.js:1)
              at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(jdk.scripting.nashorn@9-internal/ScriptFunctionData.java:654)
              at jdk.nashorn.internal.runtime.ScriptFunction.invoke(jdk.scripting.nashorn@9-internal/ScriptFunction.java:513)
              at jdk.nashorn.internal.runtime.ScriptRuntime.apply(jdk.scripting.nashorn@9-internal/ScriptRuntime.java:471)
              at jdk.nashorn.tools.Shell.apply(jdk.scripting.nashorn@9-internal/Shell.java:519)
              at jdk.nashorn.tools.Shell.runScripts(jdk.scripting.nashorn@9-internal/Shell.java:448)
              at jdk.nashorn.tools.Shell.run(jdk.scripting.nashorn@9-internal/Shell.java:186)
                                                                                             

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: