Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
The following example currently fails.
record Bar(String name) { } def bars = [new Bar(name: 'A'), new Bar(name: 'B')] assert bars.stream().map(Bar::name).toList() == ['A', 'B']
The error message is:
java.lang.IllegalArgumentException: Can not set final java.lang.String field Bar.name to java.lang.Class
This is because the metaclass is picking the private field as a property ahead of the same-named accessor method.
Workaround is to use @CompileStatic.
Attachments
Issue Links
- links to