On 19.10.2016 14:12, daniel_sun wrote:
Hi Rémi,

     Groovy can choose the right method to call :)

assert ['1', '2', '3'] == [1, 2, 3].collect(Integer.&toString)

I am sure that works only because the static Integer.toString(int) and the virtual Integer.toString() return the same values. If you look at

class X {
  def foo() {1}
  static foo(X x) {2}
}

Then for a X.&foo covering virtual and static methods, there is no way of knowing if we want to call the virtual foo or the static foo method. Both would take and instance of X as argument.

bye Jochen

Reply via email to