History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: MGROOVY-143
Type: Bug Bug
Status: Closed Closed
Resolution: Not A Bug
Priority: Minor Minor
Assignee: Jason Dillon
Reporter: Stig Lau
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
GMaven

Multimethod groovy classes behave differently when called from java compared to Groovy

Created: 20/May/08 05:26 AM   Updated: 08/Aug/08 11:29 PM
Component/s: None
Affects Version/s: 1.0-rc-2
Fix Version/s: 1.0-rc-4

Time Tracking:
Not Specified

File Attachments: 1. Zip Archive groovymixedcompiler.zip (3 kb)

Environment: Maven, groovy, java

Testcase included: yes


 Description  « Hide
I have a mixed groovy/java application where the domain model is implemented in groovy, and the java utilizes the groovy classes.
I'm trying to use the multimethods functionality of groovy to do some nifty stuff, such as writing a simpler equals method.
I have two scenarios of usage;
  • The groovy and java classes are in the same module
  • The application is multimodule, where code from a module depends on the groovy code, from a jar

My problem is that the calling java code does not behave in the same way groovy calling code would. For example, different equals methods are apparently used.
Why is this? Example attached.
I guess this could be normal Groovy behavour, but is in which case something to beware of with mixed projects

Is there any special way to package the groovy code (not as compiled class files), such as uncompiled .groovy files, that makes multimodule projects behave as wished?



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Stig Lau - 24/May/08 12:27 PM
Can you confirm that this is a bug, and is scheduled fixed in rc-4?

Jason Dillon - 08/Aug/08 11:29 PM
AFAICT the project you attached is running correctly, failing on the use of <tt>==</tt> in JAVA to compare 2 different instances.
Running TestSuite
[Parser] Running:
  Command line suite

Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.392 sec <<< FAILURE!

Results :

Failed tests: 
  testEquals(EqualsJavaTest)