Groovy
  1. Groovy
  2. GROOVY-3816

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

    Details

    • Type: Improvement Improvement
    • Status: 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

      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

          Thomas Mortagne created issue -
          Guillaume Delcroix made changes -
          Field Original Value New Value
          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:
          {code}
          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:
          {code}
          def engine = new ScriptEngineManager().getEngineByName('groovy')

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

          assert instance.class.isAssignableFrom(clazz)
          {code}
          Guillaume Delcroix made changes -
          Comment [ Sorry wrong key, i can't modify the description so here is the test case:
          {code}
          def engine = new ScriptEngineManager().getEngineByName('groovy')

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

          assert instance.class.isAssignableFrom(clazz)
          {code} ]
          Guillaume Delcroix made changes -
          Assignee Guillaume Laforge [ guillaume ]
          Hide
          Roshan Dawrani added a comment -

          Duplicate JIRA - of GROOVY-3707?

          Show
          Roshan Dawrani added a comment - Duplicate JIRA - of GROOVY-3707 ?
          Guillaume Delcroix made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Fix Version/s 1.7-beta-2 [ 15540 ]
          Fix Version/s 1.6.6 [ 15781 ]
          Resolution Fixed [ 1 ]
          Hide
          Guillaume Delcroix added a comment -

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

          Show
          Guillaume Delcroix added a comment - Ah good point, yes, it's a duplicate.
          Guillaume Delcroix made changes -
          Link This issue duplicates GROOVY-3707 [ GROOVY-3707 ]
          Paul King made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Mark Thomas made changes -
          Project Import Sun Apr 05 13:32:57 UTC 2015 [ 1428240777691 ]
          Mark Thomas made changes -
          Workflow jira [ 12732785 ] Default workflow, editable Closed status [ 12744555 ]
          Mark Thomas made changes -
          Project Import Mon Apr 06 02:11:23 UTC 2015 [ 1428286283443 ]
          Mark Thomas made changes -
          Workflow jira [ 12970484 ] Default workflow, editable Closed status [ 12978258 ]
          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open Resolved Resolved
          1h 56m 1 Guillaume Delcroix 08/Oct/09 10:31
          Resolved Resolved Closed Closed
          7d 6h 46m 1 Paul King 15/Oct/09 17:17

            People

            • Assignee:
              Guillaume Delcroix
              Reporter:
              Thomas Mortagne
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development