Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.6-beta-2
-
Fix Version/s: 1.6-rc-1, 1.7-beta-1
-
Component/s: None
-
Labels:None
-
Number of attachments :
Description
The call new Foo([:]) below will lead to infinite recursion.
@Immutable final class Foo { Map bar } new Foo([:])
I guess the above code corresponds to
final class Foo { final Map bar Foo(Map bar) { this(['bar':bar]) } Foo(HashMap args) { this.bar = args['bar'].asImmutable() } } new Foo([:])
It will never reach the termitating HashMap constructor.
Solution1: Generate only tuple-based ctor if single field. Do field initializations in this ctor.
Workaround: call Map-based ctor (HashMap) explicity
new Foo((HashMap) [bar:[:]])