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

@Lazy has incorrect behavior for static fields

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

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.7.2
    • 1.7.3, 1.8-beta-1
    • None
    • None

    Description

      The fragment:

      @Lazy static Type myField
      

      is transformed into a static private field $myField but an instance method getMyField(). The method should be static and in the case of synchronization, would need to synch on the class not 'this'. But there is also a question as to whether double checked locking is best for static, perhaps holder class idiom is better.

      Attachments

        Activity

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

          People

            paulk Paul King
            paulk Paul King
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment