Issue Details (XML | Word | Printable)

Key: SPR-4168
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Juergen Hoeller
Reporter: Dave Syer
Votes: 0
Watchers: 0
Operations

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

Dynamic objects in Groovy cannot be defined as script inline

Created: 27/Nov/07 03:01 AM   Updated: 20/Jan/08 03:31 PM   Resolved: 27/Nov/07 07:43 AM
Component/s: None
Affects Version/s: 2.5 final
Fix Version/s: 2.5.1

Time Tracking:
Not Specified

File Attachments: 1. Zip Archive SPR-4168.zip (6 kB)

Issue Links:
Related


 Description  « Hide

Dynamic objects in Groovy cannot be defined as script inline. It works with a class definition inline (as it would with a file containing the Groovy class definition), but a script that returns a GroovyObject only works if it is defined in a file.



Dave Syer added a comment - 27/Nov/07 03:03 AM

Test case attached as Eclipse / Maven project (the spring-2.5.jar will have to be manually installed because of a bug in the 25 distro). Two tests with identical Groovy code - one passes and the other (inlined script) fails.


Juergen Hoeller added a comment - 27/Nov/07 07:43 AM

This was introduced as a side effect of providing more context to the Groovy class parser. Apparently Groovy sometimes tries to derive a class name from the passed-in resource descriptor... Hence, I've revised StaticScriptSource to expose "StaticScript" as toString result (instead of "static script"), in order for Groovy to derive a valid class name from it.

Thanks for pointing this out, Dave! Should be fixed in tonight's 2.5.1 snapshot.

Juergen

P.S.: I'm always reproducing test cases in my local IDE, so no Maven problems here Seriously, we need to make sure that the uploaded Maven POMs and jars for 2.5.1 will be correct. The 2.5 zip distro itself was fine, as far as I see; only the jars/POMs as uploaded to the Maven repository were buggy.