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

Builders: calls to owner methods from within nested closures lead to markup instead of method calling

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0-JSR-4
    • 1.0-JSR-5
    • None
    • None

    Description

      This seems similar to a problem I experience with SwingBuilder.. where
      a change made it impossible to call methods from inside the builder.
      To fix it i had to do something like:

      def self = this

      swing {
      button(action:

      { self.someMethod() }

      )
      }

      void someMethod() {
      // the method
      }

      Note the above is just psuedo code from memory but the problems seem similar

      Graeme

      On 11/02/06, Dierk Koenig <dierk.koenig@canoo.com> wrote:
      > Hi,
      >
      > the following Groovlet runs fine
      > ----
      > html.html{
      > head

      { > title 'Groovlet Demonstrator' > }
      > content()
      > }
      > void content() { > html.body 'Welcome' > }
      > ----
      >
      > This fails:
      > ----
      > html.html{
      > head {> title 'Groovlet Demonstrator'> }

      > p

      { content() }

      // <- mind the p{}
      > }
      >
      > void content()

      { > html.body 'Welcome' > }

      > ----
      >
      > It produces:
      > ----
      > <html>
      > <head>
      > <title>Groovlet Demonstrator</title>
      > </head>
      > <p>
      > <content />
      > </p>
      > </html>
      > ----
      >
      > Logs are empty.
      >
      > Has anybody an idea? Has it anything to do with the latest
      > changes to Closures?
      >
      > cheers
      > Mittie
      >

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            tug John Wilson
            codevise Dierk König
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment