So I am migrating from Grails 3.3.x to 4.0.13. When I try to compile my app I am getting compilation errors when I try to use the format method for any Date property. For exmaple
class Event {
Date startDateTime
Date regDeadline
}
Then in my GSON class I have this
model {
Event event
}
json {
eventDate event.startDateTime.format("MM/dd/yyyy hh:mm a")
regDeadline event.regDeadline.format("MM/dd/yyyy hh:mm a")
}
I get the following compiling error
Exception in thread "main" org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
raa_domain_grid__event_gson: 10: [Static type checking] - Cannot find matching method java.util.Date#format(java.lang.String). Please check if the declared type is correct and if the method exists.
@ line 10, column 15.
eventDate event.startDateTime.format("MM/dd/yyyy hh:mm a")
^
raa_domain_grid__event_gson: 11: [Static type checking] - Cannot find matching method java.util.Date#format(java.lang.String). Please check if the declared type is correct and if the method exists.
@ line 11, column 17.
regDeadline event.regDeadline.format("MM/dd/yyyy hh:mm a")
This worked without issues before. I suspect it has something to do with the Groovy upgrade to 2.5.6 but I don't see what that issue would be. This is happening throughout my entire app. All my Classes that have Dates as properties throw this error when I try to apply formatting to them. The above is just a simple example of that.