Issue Details (XML | Word | Printable)

Key: GROOVY-161
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Guillaume Laforge
Reporter: Guillaume Laforge
Votes: 0
Watchers: 0
Operations

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

Refactor some methods of GroovyShell

Created: 27/Jan/04 08:43 AM   Updated: 28/Jan/04 07:17 PM   Resolved: 28/Jan/04 07:17 PM
Return to search
Component/s: None
Affects Version/s: None
Fix Version/s: 1.0-beta-4

Time Tracking:
Not Specified


 Description  « Hide

Change the signature of some of evaluate() methods

evaluate(File file)
evaluate(String script)
evaluate(File file, String scriptName)
evaluate(String script, String scriptName)



james strachan added a comment - 27/Jan/04 09:00 AM

james strachan added a comment - 27/Jan/04 09:01 AM

I've closed down the other one

here's some examples...

answer = shell.evaluate("10 * 20")
answer = shell.evaluate(new URL(...))
answer = shell.evaluate(new File(...)))
answer = shell.evaluate(readerOrWriter, String name)

we should make the second name parameter optional (its only used to help set the class name to be used)


james strachan added a comment - 28/Jan/04 08:27 AM

We should also follow the same naming / parameter conventions in the GroovyClassLoader as well.

e.g.

GroovyClassLoader loader = new GroovyClassLoader()
Class beanType = loader.parseClass("class Foo { String name; Integer age }")

i.e. use
*String = the text of the script

  • File = the file to parse
  • URL / InputStream / Reader = for where to read it from

and make the 2nd name parameter optional if you're constructing from a URL or Stream.


Guillaume Laforge added a comment - 28/Jan/04 07:17 PM

I've committed GroovyShell and GroovyClassLoader and fixed the tests.
All tests passed on my WindowsXP box.