Immutable containing Immutable field from other maven module

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

Immutable containing Immutable field from other maven module

Jan Bols
Hi, 
I'm using an @Immutable class containing a field of an @Immutable class 
defined in another maven module. 

If I don't specify it in the list of knownImmutableClasses, it does not 
compile due to the following reason: 
SomeValueObject.groovy: -1 Groovy:@Immutable processor doesn't know how to 
handle field 'id' of type 'SomeId' while compiling class SomeValueObject. 


class in maven module mod1: 
import groovy.transform.Immutable 
@Immutable 
class SomeId{ 
    UUID id 

class in maven module mod2 
  
import groovy.transform.Immutable 
@Immutable 
//(knownImmutableClasses = [SomeId]) 
class SomeValueObject{ 
    SomeId id 
}


Any ideas of why this happens? 
groovy is build using groovy-eclipse-compiler: 
                <plugin> 
                    <groupId>org.apache.maven.plugins</groupId> 
                    <artifactId>maven-compiler-plugin</artifactId> 
                    <version>${compiler-plugin.version}</version> 
                    <inherited>true</inherited> 
                    <configuration> 
                        <compilerId>groovy-eclipse-compiler</compilerId> 
                        <source>1.6</source> 
                        <target>1.6</target> 
                        <encoding>utf-8</encoding> 
                    </configuration> 
                    <dependencies> 
                        <dependency> 
                            <groupId>org.codehaus.groovy</groupId> 
                            <artifactId>groovy-eclipse-compiler</artifactId> 
                            <version>2.8.0-01</version> 
                        </dependency> 
                        
                        <dependency> 
                            <groupId>org.codehaus.groovy</groupId> 
                            <artifactId>groovy-eclipse-batch</artifactId> 
                            <version>2.1.8-01</version> 
                        </dependency> 
                    </dependencies> 
                </plugin> 

and version 2.1.8 of groovy is used. 

I tried this running maven 3.2.1, but also using maven 2.2.1.

I attached a zip file containing a small maven setup.

I also tried running this with gradle and that worked.



Best regards 
Jan 


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

immutableTest.zip (7K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Immutable containing Immutable field from other maven module

Andy Clement
I'd raise a jira against greclipse for that. We have a few problems with the implementation of that transform because it relies a lot on classes loaded via reflection when you don't really want to be doing that under the IDE.

Andy


On 11 April 2014 06:30, Jan Bols <[hidden email]> wrote:
Hi, 
I'm using an @Immutable class containing a field of an @Immutable class 
defined in another maven module. 

If I don't specify it in the list of knownImmutableClasses, it does not 
compile due to the following reason: 
SomeValueObject.groovy: -1 Groovy:@Immutable processor doesn't know how to 
handle field 'id' of type 'SomeId' while compiling class SomeValueObject. 


class in maven module mod1: 
import groovy.transform.Immutable 
@Immutable 
class SomeId{ 
    UUID id 

class in maven module mod2 
  
import groovy.transform.Immutable 
@Immutable 
//(knownImmutableClasses = [SomeId]) 
class SomeValueObject{ 
    SomeId id 
}


Any ideas of why this happens? 
groovy is build using groovy-eclipse-compiler: 
                <plugin> 
                    <groupId>org.apache.maven.plugins</groupId> 
                    <artifactId>maven-compiler-plugin</artifactId> 
                    <version>${compiler-plugin.version}</version> 
                    <inherited>true</inherited> 
                    <configuration> 
                        <compilerId>groovy-eclipse-compiler</compilerId> 
                        <source>1.6</source> 
                        <target>1.6</target> 
                        <encoding>utf-8</encoding> 
                    </configuration> 
                    <dependencies> 
                        <dependency> 
                            <groupId>org.codehaus.groovy</groupId> 
                            <artifactId>groovy-eclipse-compiler</artifactId> 
                            <version>2.8.0-01</version> 
                        </dependency> 
                        
                        <dependency> 
                            <groupId>org.codehaus.groovy</groupId> 
                            <artifactId>groovy-eclipse-batch</artifactId> 
                            <version>2.1.8-01</version> 
                        </dependency> 
                    </dependencies> 
                </plugin> 

and version 2.1.8 of groovy is used. 

I tried this running maven 3.2.1, but also using maven 2.2.1.

I attached a zip file containing a small maven setup.

I also tried running this with gradle and that worked.



Best regards 
Jan 


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email