groovy

Should be possible to declare a class in a script and use it in another script with JSR223

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 1.7-beta-2, 1.6.6
  • Component/s: None
  • Labels:
    None
  • Number of attachments :
    0

Description

This is very useful for use case like XWiki where you want to put a groovy script containing a class in a wiki page and include this page in other documents to use the class.

Here is a possible test case:

def engine = new ScriptEngineManager().getEngineByName('groovy')

def clazz = engine.eval('class Foo {}')
def instance = engine.eval('new Foo()')

assert instance.class.isAssignableFrom(clazz)

Issue Links

Activity

Hide
Roshan Dawrani added a comment -

Duplicate JIRA - of GROOVY-3707?

Show
Roshan Dawrani added a comment - Duplicate JIRA - of GROOVY-3707?
Hide
Guillaume Laforge added a comment -

Ah good point, yes, it's a duplicate.

Show
Guillaume Laforge added a comment - Ah good point, yes, it's a duplicate.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: