I have a Java application that is running embedded groovy scripts using a GroovyClassLoader. Everything is working great until I hit an odd error while passing Java types to a Groovy script.
My issue is thus: I am passing a java.util.Date as a parameter into a groovy script. I found that Groovy’s java.util.Date has a fantastic clearTime() function. However when I try to call this function i get this exception:
groovy.lang.MissingMethodException: No signature of method: java.util.Date.clearTime() is applicable for argument types: () values: []
I assume this because I have a Java Date and not a Groovy Date. Is there a way to convert between the two.
I do admit I don’t fully understand how Groovy seems to be overriding jdk types. (So much so I don’t even know if this is the correct terminology to use here.) Please correct me if I am completely wrong about what happens when you create a java.util.Date inside of Groovy vs. when you pass one in to a function from Java.
Ok I found out my malfunction here. My test app was bound to groovy 1.8.6 as desired, but my main program was using 1.6.5 (the function I happened to be trying to call was introduced in 1.6.7). Eclipse decided not to run with the new version when I updated my pom.xml.