Java 和 Groovy区别
Because Groovy uses Objects for everything, it autowraps references to primitives. Because of this, it does not follow Java’s behavior of widening taking priority over boxing. Here’s an example using int
int i
m(i)
void m(long l) {
println "in m(long)"
}
void m(Integer i) {
println "in m(Integer)"
}
This is the method that Java would call, since widening has precedence over unboxing.
This is the method Groovy actually calls, since all primitive references use their wrapper class.