groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Keegan Witt <keeganw...@gmail.com>
Subject Re: MissingMethodException Date.format() in GroovyDoc root template
Date Thu, 14 Jun 2018 00:20:02 GMT
You could just do this
"${new java.text.SimpleDateFormat('yyy-MM-dd').format(new Date())}"

Instead of
"${new Date().format('yyyy-MM-dd')}"

That should work everywhere.

On Wed, Jun 13, 2018 at 2:35 AM Paul King <paulk@asert.com.au> wrote:

> In 2.6 we can't assume that the java time stuff will be there.
>
> On Wed, Jun 13, 2018 at 2:01 PM, Keegan Witt <keeganwitt@gmail.com> wrote:
>
>> We should make the change to remove that dependency in both 2.6 and 3.0,
>> right?
>>
>> On Tue, Jun 12, 2018 at 11:49 PM Keegan Witt <keeganwitt@gmail.com>
>> wrote:
>>
>>> Ah.  Thank you.  That's what I was missing.
>>>
>>> On Tue, Jun 12, 2018 at 1:31 AM Paul King <paulk@asert.com.au> wrote:
>>>
>>>> You might need to add groovy-dateutil dependency. Possibly a bug if we
>>>> don't have that listed as a dependency of groovy-groovydoc. For Groovy 3.0
>>>> we should probably change template to use datetime equivalent.
>>>>
>>>> On Tue., 12 Jun. 2018, 6:13 am Keegan Witt, <keeganwitt@gmail.com>
>>>> wrote:
>>>>
>>>>> Have we made any breaking changes to GroovyDoc?  The GroovyDoc root
>>>>> template is failing to find a GDK method now, but I'm not seeing what
>>>>> changed.  Using the same template in a console works
>>>>>
>>>>> new groovy.text.GStringTemplateEngine().createTemplate("${new
>>>>> Date().format('yyyy-MM-dd')}").make([:]).toString()
>>>>>
>>>>> -Keegan
>>>>>
>>>>> groovy.lang.MissingMethodException: No signature of method:
>>>>> java.util.Date.format() is applicable for argument types: (String) values:
>>>>> [yyyy-MM-dd]
>>>>> Possible solutions: from(java.time.Instant), getAt(java.lang.String),
>>>>> parse(java.lang.String), print(java.lang.Object), print(java.io.PrintWriter)
>>>>>         at
>>>>> org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:72)
>>>>>         at
>>>>> org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:48)
>>>>>         at
>>>>> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
>>>>>         at
>>>>> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
>>>>>         at
>>>>> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128)
>>>>>         at
>>>>> groovy.tmp.templates.GStringTemplateScript5$_getTemplate_closure1.doCall(GStringTemplateScript5.groovy:39)
>>>>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>>         at
>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>>>>>         at
>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>>>         at java.lang.reflect.Method.invoke(Method.java:498)
>>>>>         at
>>>>> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:104)
>>>>>         at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:326)
>>>>>         at
>>>>> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:264)
>>>>>         at
>>>>> groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1041)
>>>>>         at groovy.lang.Closure.call(Closure.java:421)
>>>>>         at
>>>>> groovy.lang.Closure$WritableClosure.writeTo(Closure.java:861)
>>>>>         at
>>>>> groovy.lang.Closure$WritableClosure.toString(Closure.java:987)
>>>>>         at
>>>>> org.codehaus.groovy.tools.groovydoc.GroovyDocTemplateEngine.applyRootDocTemplate(GroovyDocTemplateEngine.java:131)
>>>>>
>>>>
>

Mime
View raw message