Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-11168

Ability to `@DelegatesTo` the return type

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • None
    • None

    Description

      With a method

      public <T> T Stub(Closure interactions); 

      that is then used like

      Foo foo = Stub { /* configure the foo here */ } 

      I'd like to be able to specify that the delegate is of type T so in the given example of type Foo.

      Currently we do this in Spock via IDE-specific gdsl/dsld Scripts.
      But it would be nice if this would be supported out of the box.

      (Ideally in 2.5 already, as we still have a 2.5 compatible artifact. )

      Attachments

        1. screenshot-1.png
          34 kB
          Eric Milles
        2. screenshot-2.png
          69 kB
          Eric Milles

        Issue Links

          Activity

            People

              emilles Eric Milles
              vampire Björn Kautler
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: