You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Sam Gleske (Jira)" <ji...@apache.org> on 2020/09/01 15:11:00 UTC

[jira] [Closed] (GROOVY-9709) Date.format throws groovy.lang.MissingMethodException

     [ https://issues.apache.org/jira/browse/GROOVY-9709?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sam Gleske closed GROOVY-9709.
------------------------------
    Resolution: Not A Bug

> Date.format throws groovy.lang.MissingMethodException
> -----------------------------------------------------
>
>                 Key: GROOVY-9709
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9709
>             Project: Groovy
>          Issue Type: Bug
>          Components: groovy-runtime
>    Affects Versions: 3.0.5, 2.5.13
>         Environment: Ubuntu 18.04.5 LTS
> OpenJDK Java 1.8.0_265 (Private Build 25.265-b01)
> Gradle 5.6.3
>            Reporter: Sam Gleske
>            Priority: Major
>
> h2. Description
> [Date.format|http://docs.groovy-lang.org/latest/html/groovy-jdk/java/util/Date.html#format(java.lang.String,%20java.util.TimeZone)] appears broken in Groovy 2.5 and later.
> h2. Example code
> {code:java}
> // Works in Groovy 2.4.20 but throws groovy.lang.MissingMethodException
> // in Groovy 2.5.13 and 3.0.5
> new Date().format('YYYYMMdd'){code}
> h2. Expected behavior
> Returns the current date formatted as a string.  e.g. 20200901
> h2. Actual behavior
> Throws exception.
> {noformat}
> groovy.lang.MissingMethodException: No signature of method: java.util.Date.format() is applicable for argument types: (String) values: [YYYYMMdd]
> Possible solutions: from(java.time.Instant), stream(), getAt(java.lang.String), parse(java.lang.String), print(java.lang.Object), print(java.io.PrintWriter){noformat}
> h2. Groovy version matrix
> ||Groovy version||Behavior||
> |2.4.20|Returns date|
> |2.5.13|throws exception|
> |3.0.5|throws exception|



--
This message was sent by Atlassian Jira
(v8.3.4#803005)