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

JShell: method cannot call method with different number of arguments

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P3 P3
    • tbd
    • 9
    • tools
    • None

      JShell API: method cannot call method with different number of arguments.

      -> void f() { f(10); }
      | Error:
      | method f in class cannot be applied to given types;
      | required: no arguments
      | found: int
      | reason: actual and formal argument lists differ in length
      | void f() { f(10); }
      |

      -Andrei

      This is true even if the other version is already defined.

      -> int f(int x) { return x; }
      | Added method f(int)

      -> void f() { f(10); }
      | Error:
      | method f in class cannot be applied to given types;
      | required: no arguments
      | found: int
      | reason: actual and formal argument lists differ in length
      | void f() { f(10); }
      | ^

      -Robert

            rfield Robert Field (Inactive)
            aeremeev Andrei Eremeev
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: