groovy

Refactor some methods of GroovyShell

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 1.0-beta-4
  • Component/s: None
  • Labels:
    None
  • Number of attachments :
    0

Description

Change the signature of some of evaluate() methods

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

Activity

Hide
james strachan added a comment -
Show
james strachan added a comment - this is a duplicate of... http://jira.codehaus.org/secure/ViewIssue.jspa?key=GROOVY-147
Hide
james strachan added a comment -

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)

Show
james strachan added a comment - 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)
Hide
james strachan added a comment -

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.

Show
james strachan added a comment - 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.
Hide
Guillaume Laforge added a comment -

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

Show
Guillaume Laforge added a comment - I've committed GroovyShell and GroovyClassLoader and fixed the tests. All tests passed on my WindowsXP box.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: