MissingMethodException Date.format() in GroovyDoc root template

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

MissingMethodException Date.format() in GroovyDoc root template

keeganwitt
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)

Reply | Threaded
Open this post in threaded view
|

Re: MissingMethodException Date.format() in GroovyDoc root template

paulk_asert
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, <[hidden email]> 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)

Reply | Threaded
Open this post in threaded view
|

Re: MissingMethodException Date.format() in GroovyDoc root template

keeganwitt
Ah.  Thank you.  That's what I was missing.

On Tue, Jun 12, 2018 at 1:31 AM Paul King <[hidden email]> 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, <[hidden email]> 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)

Reply | Threaded
Open this post in threaded view
|

Re: MissingMethodException Date.format() in GroovyDoc root template

keeganwitt
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 <[hidden email]> wrote:
Ah.  Thank you.  That's what I was missing.

On Tue, Jun 12, 2018 at 1:31 AM Paul King <[hidden email]> 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, <[hidden email]> 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)

Reply | Threaded
Open this post in threaded view
|

Re: MissingMethodException Date.format() in GroovyDoc root template

paulk_asert
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 <[hidden email]> 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 <[hidden email]> wrote:
Ah.  Thank you.  That's what I was missing.

On Tue, Jun 12, 2018 at 1:31 AM Paul King <[hidden email]> 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, <[hidden email]> 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)


Reply | Threaded
Open this post in threaded view
|

Re: MissingMethodException Date.format() in GroovyDoc root template

keeganwitt
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 <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> wrote:
Ah.  Thank you.  That's what I was missing.

On Tue, Jun 12, 2018 at 1:31 AM Paul King <[hidden email]> 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, <[hidden email]> 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)