Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 2.0-beta-3
-
Component/s: Static Type Checker
-
Labels:None
-
Number of attachments :
Description
When using the @TupleConstructor with the static type checking, it doesn't like when a constructor without all the fields is used.
Consider the following example:
import groovy.transform.* @TupleConstructor @TypeChecked class Person { String name, city static Person create() { new Person("Guillaume") } } Person.create()
The type checker complains because it could not find a zero-arg constructor:
[Static type checking] - Cannot find matching method Person#<init>(java.lang.String)
at line: 8, column: 9
But actually, @TupleConstructor allows to use less args than all the declared.
Person can be instantiated with new Person("Guillaume", "Paris"), new Person("Guillaume"), or even new Person()
Issue Links
- is depended upon by
-
GROOVY-5235
Static compilation of method call expressions with missing default parameters
-