JavaScript2Java Bridge cannot resolve overloaded methods properly

XMLWordPrintable

    • web

      JavaScript2Java Bridge cannot resolve overloaded methods properly.

      Consider the following example.

      I've got the following dummy class:
      public class MyClass {
        int method(String a) {
          return 1;
        }
        int method(int a) {
          return 2;
        }
      }

      I expose it to JS:
      webEngine.addJavaScriptBinding("test", myObject);

      Then I try to call the "string" method (the first one):
      Object o = webEngine.executeScript("test.method('aaa');");
      System.out.println(o);
      And "2" is printed.

      Seems like Bridge always selects the last overloaded method to invoke; if I change places of the methods in my dummy class, everything works perfectly.
      However, this is probably not what developers expect from Java.

            Assignee:
            Per Bothner (Inactive)
            Reporter:
            Irina Grineva (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: