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 05:17:00 UTC
[jira] [Created] (GROOVY-9709) Date.format throws
groovy.lang.MissingMethodException
Sam Gleske created GROOVY-9709:
----------------------------------
Summary: 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: 2.5.13, 3.0.5
Environment: Ubuntu 18.04.5 LTS
OpenJDK Java 1.8.0_265 (Private Build 25.265-b01)
Gradle 5.6.3
Reporter: Sam Gleske
h2. Description
Date.format 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}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)