groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Kasanicky (JIRA)" <>
Subject [jira] [Created] (GROOVY-8752) "gradle run" throws groovy.lang.MissingMethodExcpeption after 2.5.1->2.5.2 groovy upgrade
Date Tue, 14 Aug 2018 17:16:00 GMT
Robert Kasanicky created GROOVY-8752:

             Summary: "gradle run" throws groovy.lang.MissingMethodExcpeption after 2.5.1->2.5.2
groovy upgrade
                 Key: GROOVY-8752
             Project: Groovy
          Issue Type: Bug
    Affects Versions: 2.5.2
         Environment: ubuntu 18.04, oracle java 1.8.0_181, groovy 2.5.2, gradle 4.9
            Reporter: Robert Kasanicky

Initializing a class field using a GDK method somehow became problematic in combination with
gradle's application plugin. There was no such problem until the 2.5.2 groovy version (also
switching gradle versions doesn't make a difference).
 * This Groovy source file was generated by the Gradle 'init' task.
class App {

    def today = new Date().format('yyyy-MM-dd')

    String getGreeting() {
        return 'Hello world.'

    static void main(String[] args) {
        println new App().greeting
$ groovy src/main/groovy/App.groovy 
Hello world.
$ ./gradlew run
Exception in thread "main" 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),
toYear(), getAt(java.lang.String), parse(java.lang.String), print(java.lang.Object), print(
        at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(
        at App.<init>(App.groovy:6)         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)         at sun.reflect.NativeConstructorAccessorImpl.newInstance(
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
        at java.lang.reflect.Constructor.newInstance(        
at org.codehaus.groovy.reflection.CachedConstructor.invoke(        
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(
        at App.main(App.groovy:13)

Runnable project including the code listed above is attached.

This message was sent by Atlassian JIRA

View raw message