Tell me more ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I just tried IntelliJ-Idea 11.x and 12.x (EPA), but when I use Groovy 2.0.1 or 2.0.5, the code can't be run and there are some errors out there.

The Groovy plugin of idea has little information about which version of Groovy has been supported.

Does idea support Groovy 2.x? I want to try the new @TypeChecked annotation of Groovy 2.


UPDATE

My groovy code:

class X {
    def hello() {
        println("hello, groovy")
    }
    def static main(String[] args) {
        new X().hello()
    }
}

It uses groovy 2.0.5:

enter image description here

And the error thrown:

E:\java\jdk1.6.0_29_x64\bin\java -Didea.launcher.port=7532 "-Didea.launcher.bin.path=E:\java\IntelliJ IDEA 11.1.4\bin" -Dfile.encoding=UTF-8 -classpath "E:\java\jdk1.6.0_29_x64\jre\lib\charsets.jar;E:\java\jdk1.6.0_29_x64\jre\lib\deploy.jar;E:\java\jdk1.6.0_29_x64\jre\lib\javaws.jar;E:\java\jdk1.6.0_29_x64\jre\lib\jce.jar;E:\java\jdk1.6.0_29_x64\jre\lib\jsse.jar;E:\java\jdk1.6.0_29_x64\jre\lib\management-agent.jar;E:\java\jdk1.6.0_29_x64\jre\lib\plugin.jar;E:\java\jdk1.6.0_29_x64\jre\lib\resources.jar;E:\java\jdk1.6.0_29_x64\jre\lib\rt.jar;E:\java\jdk1.6.0_29_x64\jre\lib\ext\dcevm.jar;E:\java\jdk1.6.0_29_x64\jre\lib\ext\dnsns.jar;E:\java\jdk1.6.0_29_x64\jre\lib\ext\localedata.jar;E:\java\jdk1.6.0_29_x64\jre\lib\ext\sunjce_provider.jar;E:\WORKSPACE\TestGroovy2\out\production\TestGroovy2;E:\java\groovy-2.0.5\lib\ant-1.8.4.jar;E:\java\groovy-2.0.5\lib\ant-antlr-1.8.4.jar;E:\java\groovy-2.0.5\lib\ant-junit-1.8.4.jar;E:\java\groovy-2.0.5\lib\ant-launcher-1.8.4.jar;E:\java\groovy-2.0.5\lib\antlr-2.7.7.jar;E:\java\groovy-2.0.5\lib\asm-4.0.jar;E:\java\groovy-2.0.5\lib\asm-analysis-4.0.jar;E:\java\groovy-2.0.5\lib\asm-commons-4.0.jar;E:\java\groovy-2.0.5\lib\asm-tree-4.0.jar;E:\java\groovy-2.0.5\lib\asm-util-4.0.jar;E:\java\groovy-2.0.5\lib\bsf-2.4.0.jar;E:\java\groovy-2.0.5\lib\commons-cli-1.2.jar;E:\java\groovy-2.0.5\lib\commons-logging-1.1.1.jar;E:\java\groovy-2.0.5\lib\gpars-1.0-beta-3.jar;E:\java\groovy-2.0.5\lib\groovy-2.0.5.jar;E:\java\groovy-2.0.5\lib\groovy-ant-2.0.5.jar;E:\java\groovy-2.0.5\lib\groovy-bsf-2.0.5.jar;E:\java\groovy-2.0.5\lib\groovy-console-2.0.5.jar;E:\java\groovy-2.0.5\lib\groovy-docgenerator-2.0.5.jar;E:\java\groovy-2.0.5\lib\groovy-groovydoc-2.0.5.jar;E:\java\groovy-2.0.5\lib\groovy-groovysh-2.0.5.jar;E:\java\groovy-2.0.5\lib\groovy-jmx-2.0.5.jar;E:\java\groovy-2.0.5\lib\groovy-json-2.0.5.jar;E:\java\groovy-2.0.5\lib\groovy-jsr223-2.0.5.jar;E:\java\groovy-2.0.5\lib\groovy-servlet-2.0.5.jar;E:\java\groovy-2.0.5\lib\groovy-sql-2.0.5.jar;E:\java\groovy-2.0.5\lib\groovy-swing-2.0.5.jar;E:\java\groovy-2.0.5\lib\groovy-templates-2.0.5.jar;E:\java\groovy-2.0.5\lib\groovy-test-2.0.5.jar;E:\java\groovy-2.0.5\lib\groovy-testng-2.0.5.jar;E:\java\groovy-2.0.5\lib\groovy-xml-2.0.5.jar;E:\java\groovy-2.0.5\lib\hamcrest-core-1.1.jar;E:\java\groovy-2.0.5\lib\ivy-2.2.0.jar;E:\java\groovy-2.0.5\lib\jansi-1.6.jar;E:\java\groovy-2.0.5\lib\jcommander-1.12.jar;E:\java\groovy-2.0.5\lib\jline-1.0.jar;E:\java\groovy-2.0.5\lib\jsp-api-2.0.jar;E:\java\groovy-2.0.5\lib\jsr166y-1.7.0.jar;E:\java\groovy-2.0.5\lib\junit-4.10.jar;E:\java\groovy-2.0.5\lib\qdox-1.12.jar;E:\java\groovy-2.0.5\lib\servlet-api-2.4.jar;E:\java\groovy-2.0.5\lib\testng-6.5.2.jar;E:\java\groovy-2.0.5\lib\xmlpull-1.1.3.1.jar;E:\java\groovy-2.0.5\lib\xstream-1.4.2.jar;E:\java\IntelliJ IDEA 11.1.4\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain X
Exception in thread "main" java.lang.IncompatibleClassChangeError: Found interface org.objectweb.asm.MethodVisitor, but class was expected
    at org.codehaus.groovy.runtime.callsite.CallSiteGenerator.genConstructor(CallSiteGenerator.java:141)
    at org.codehaus.groovy.runtime.callsite.CallSiteGenerator.genPogoMetaMethodSite(CallSiteGenerator.java:162)
    at org.codehaus.groovy.runtime.callsite.CallSiteGenerator.compilePogoMethod(CallSiteGenerator.java:215)
    at org.codehaus.groovy.reflection.CachedMethod.createPogoMetaMethodSite(CachedMethod.java:228)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.createCachedMethodSite(PogoMetaMethodSite.java:212)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.createPogoMetaMethodSite(PogoMetaMethodSite.java:188)
    at groovy.lang.MetaClassImpl.createPogoCallSite(MetaClassImpl.java:3035)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.createPogoSite(CallSiteArray.java:147)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallSite(CallSiteArray.java:161)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)
    at X.main(sta.groovy:6)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)

Process finished with exit code 1
share|improve this question
I believe your code has to be recompiled since you've changed Groovy vesions ... ref IncompatibleClassChangeError – Eddie B Nov 18 '12 at 3:18
Checkout jira.codehaus.org/browse/GROOVY-5163 ... also search for 'IncompatibleClassChangeError' nearly all the threads mention recompiling as the fix :-) – Eddie B Nov 18 '12 at 3:25
1  
Another reference ... I'm not sure - but you may have need to be running java7_JDK for some of those features checkout New in Groovy for more info ... HTH! – Eddie B Nov 18 '12 at 3:29

closed as off topic by MichaelT, gnat, Dynamic, Kilian Foth, Bart van Ingen Schenau 23 hours ago

Questions on Programmers Stack Exchange are expected to relate to software development within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.

1 Answer

I'm using 11.1.4 and it does support Groovy 2.x. However, I had to downgrade to Groovy 1.8.8 as I'm running Grails 2.1.1 which depends on Groovy 1.8.8. Note that you may receive some reference errors with Groovy DSL under certain conditions ... This is due to Intellij requiring Dynamic Properties to be set properly.

UPDATE Regarding the IncompatibleClassChangeError - Upgrading to Java JDK7 may be required to support some of the new features of Groovy 2.x.

share|improve this answer
Thanks, I just read that question, but it seems not the same as mine. Please see my updated question. – Freewind Nov 18 '12 at 2:32
This problem fixed by changing the jdk to 1.7.x, please update your answer and I will accept it. Thanks again – Freewind Nov 18 '12 at 3:42
@Freewind Good News! Glad I could help :-) Answer updated accordingly. – Eddie B Nov 18 '12 at 3:58

Not the answer you're looking for? Browse other questions tagged or ask your own question.