Groovy and Maven: CompileStatic with generics -


simple generic class in groovy

@compilestatic class foo<t> {      t member } 

and specific subclass works on lists of doubles. easy enough, right?

@compilestatic class doublelistfoo extends foo<list<double>> {      void bar() {         println member.size()     } } 

won't compile in maven:

[error] doublelistfoo.groovy:[12,9] 3. error in doublelistfoo.groovy (at line 12) [error] println member.size() [error] ^^^^^^^^^^^^^ [error] groovy:[static type checking] - cannot find matching method java.lang.object#size(). please check if declared type right , if method exists. 

compiles fine within intellij. what's going on?

maven version:

mvn -version apache maven 3.2.3 (33f8c3e1027c3ddde99d3cdebad2656a31e8fdf4; 2014-08-11t13:58:10-07:00) maven home: /usr/local/apache-maven-3.2.3 java version: 1.7.0_71, vendor: oracle corporation java home: /library/java/javavirtualmachines/jdk1.7.0_71.jdk/contents/home/jre default locale: en_us, platform encoding: utf-8 os name: "mac os x", version: "10.9.5", arch: "x86_64", family: "mac" 

groovy version:

groovyc -version groovy compiler version 2.4.3 copyright 2003-2013 codehaus. http://groovy.codehaus.org/ 

fwiw, simple test case made when more complicated class wouldn't compile error "cannot assign value of type t variable of type double[]".

solved: official groovy documentation on maven integration says latest available version of groovy-batch compiler 2.3.7. that's not true, 2.4.3 is available.

the issue found reported bug against 2.3.7 compiler, , bug fixed in 2.3.11 , 2.4.3.


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -