Consider this example:
import groovy.transform.TupleConstructor
@TupleConstructor
class TestRecord {
String foo
String bar
}
and the following Java class:
public class Test {
public static void main(String[] args) {
TestRecord t = new TestRecord("a", "b");
System.out.println(t.getFoo());
}
}
The editor shows a compilation error on the constructor call, but not on the Project Explorer. If you run this code, it works fine at runtime, so there seems to be some discrepancy between what the compiler does and what the parser says.
The same applies if you replace @TupleConstructor with @Canonical.
However, with @Immutable all works fine instead!
Consider this example:
and the following Java class:
The editor shows a compilation error on the constructor call, but not on the Project Explorer. If you run this code, it works fine at runtime, so there seems to be some discrepancy between what the compiler does and what the parser says.
The same applies if you replace
@TupleConstructorwith@Canonical.However, with
@Immutableall works fine instead!