Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
1.8.8, 2.0.2
-
None
-
JDK 1.6, Linux, Groovy 1.8.8 and 2.0.2
Description
Classes like the following:
@Immutable public class Cell {
Cloneable data;
Cell next;
}
fail to compile with this error message:
@Immutable processor doesn't know how to handle field 'data' of type 'java.lang.Cloneable' while compiling class Cell.
@Immutable classes only support properties with effectively immutable types including:
- Strings, primitive types, wrapper types, BigInteger and BigDecimal, enums
- other @Immutable classes and known immutables (java.awt.Color, java.net.URI)
- Cloneable classes, collections, maps and arrays, and other classes with special handling (java.util.Date)
Other restrictions apply, please see the groovydoc for @Immutable for further details
The implementation should be able to guarantee immutability for the Cloneable member by using the clone() method appropriately.