[ 
https://issues.apache.org/jira/browse/GROOVY-7599?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14909645#comment-14909645
 ] 

Paul King commented on GROOVY-7599:
-----------------------------------

I had a quick look at this on a recent plane flight. There are numerous 
immutable classes within the {{java.time}} package. I thought there might be a 
shortcut we could use looking at just the package but there are various mutable 
classes as well within the respective package hierarchies, so it looks like 
just adding the list of all relevant class names is the way to go. Does this 
list below sound right to you or should we ask for more feedback from the 
mailing list? It might be worthwhile doing that anyway.
{noformat}
java.time.DayOfWeek
java.time.Duration
java.time.Instant
java.time.LocalDate
java.time.LocalDateTime
java.time.LocalTime
java.time.Month
java.time.MonthDay
java.time.OffsetDateTime
java.time.OffsetTime
java.time.Period
java.time.Year
java.time.YearMonth
java.time.ZonedDateTime
java.time.ZoneOffset
java.time.ZoneRegion
// all interfaces from java.time.chrono.*
java.time.format.DecimalStyle
java.time.format.FormatStyle
java.time.format.ResolverStyle
java.time.format.SignStyle
java.time.format.TextStyle
java.time.temporal.IsoFields
java.time.temporal.JulianFields
java.time.temporal.ValueRange
java.time.temporal.WeekFields
// nothing from java.time.zone.*
{noformat}
I have indicated that all interfaces from {{java.time.chrono}} should be 
included. This is based on the assumption that all implementations follow the 
javadoc guidelines for those interfaces, e.g. for 
{{java.time.chrono.ChronoPeriod}}: "All implementations that can be 
instantiated must be final, immutable and thread-safe" and that the interface 
would be used as the explicit type for any respective properties. Does this 
sound reasonable (otherwise special coding might need to be used).

> @Immutable should recognize JSR-310 classes
> -------------------------------------------
>
>                 Key: GROOVY-7599
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7599
>             Project: Groovy
>          Issue Type: Improvement
>    Affects Versions: 2.4.4
>            Reporter: Christopher Smith
>            Priority: Minor
>
> The JSR-310 classes ({{java.time}}) were designed specifically as an 
> immutable API. The {{@Immutable}} transform should be updated to recognize 
> them out of the box.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to