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

Overload resolution ambiguity involving ConsString

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 9
    • 8u40, 9
    • core-libs
    • None
    • b32
    • generic
    • generic

        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

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

                Created:
                Updated:
                Resolved: