Why does this throw a “groovy.lang.GroovyRuntimeException: Could not find matchi...
kimapr ☭ 🇺🇿 ⚧ ⚢ ❤️🧡🤍🩷💜 @kimapr@ublog.kimapr.net
Why does this throw a “groovy.lang.GroovyRuntimeException: Could not find matching constructor for: Sussy$Vec2(Integer, Integer)” error at line “dirs[i] = new Vec2(x,y)”? Groovy 4 and 3
class Sussy {
class Vec2 {
public final int x;
public final int y;
public Vec2(int x, int y) {
this.x = x;
this.y = y;
}
}
static final Vec2[] DIRS = ({
def dirs = new Vec2[4];
def (int x, int y) = [1, 0];
for (int i=0; i<4; i++) {
dirs[i] = new Vec2(x,y);
(x,y) = [-y,x];
}
dirs
})()
}
Like the constructor is right there isn’t it. whats going on here