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

Overload resolution ambiguity involving ConsString

    XMLWordPrintable

    Details

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

      Backports

        Description

        File: test.js

        var BufferedWriter = java.io.BufferedWriter;
        var StringWriter = java.io.StringWriter;
        var w = new BufferedWriter(new StringWriter());
        var s = "hello";
        w.write(s + "world");

        Exception in thread "main" java.lang.RuntimeException: java.lang.NoSuchMethodException: Can't unambiguously select between fixed arity signatures [(java.lang.String), (int)] of the method java.io.BufferedWriter.write for argument types [jdk.nashorn.internal.runtime.ConsString]
        at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:385)
        at jdk.nashorn.tools.Shell.apply(Shell.java:394)
        at jdk.nashorn.tools.Shell.runScripts(Shell.java:323)
        at jdk.nashorn.tools.Shell.run(Shell.java:169)
        at jdk.nashorn.tools.Shell.main(Shell.java:133)
        at jdk.nashorn.tools.Shell.main(Shell.java:112)
        Caused by: java.lang.NoSuchMethodException: Can't unambiguously select between fixed arity signatures [(java.lang.String), (int)] of the method java.io.BufferedWriter.write for argument types [jdk.nashorn.internal.runtime.ConsString]
        at jdk.internal.dynalink.beans.OverloadedMethod.throwAmbiguousMethod(OverloadedMethod.java:225)
        at jdk.nashorn.internal.scripts.Script$Recompilation$3$test$cu2$restOf.:program(test.js:5)
        at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:636)
        at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:636)
        at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:632)
        at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:226)
        at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:381)
        ... 5 more

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  Created:
                  Updated:
                  Resolved: