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

Misleading error message when explicit signature constructor is called with wrong arguments

    XMLWordPrintable

    Details

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

      Backports

        Description

        var File = Java.type("java.io.File");
        var f = new File['(String,String)']();


        results in

        x.js:2 TypeError: Java method [jdk.internal.dynalink.beans.SimpleDynamicMethod File java.io.File.java.io.File(String,String)] cannot be used as a constructor.

        Actually, it is a constructor - just that number of actual arguments do not match signature.

        Similar issue with explicit constructor selection via Native java package as well:


        var Color = java.awt["Color(int,int,int)"]
        var c = new Color(255, 255)

        t.js:2 TypeError: Java method [jdk.internal.dynalink.beans.SimpleDynamicMethod Color java.awt.Color.java.awt.Color(int,int,int)] cannot be used as a constructor.


          Attachments

            Issue Links

              Activity

                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: