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

Handle @Immutable in class hierarchy?

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.3.7
    • 2.5.0-alpha-1
    • xforms
    • None

    Description

      I have an abstract class that represents a base Command (with a generic type for one argument), and the implementing classes ought to be immutable. I can't use @Immutable on the base class because it implicitly adds final, and I can't use it on the concrete classes because then I get a constructor that takes the class's immediate fields but nothing for the superclass's.

      I'm not sure exactly what semantics would be correct in dealing with an immutable subclass of an abstract class, but it would be useful to be able to use @Immutable on the concrete type and get a constructor that accepted values for the superclass properties as well as the immediate ones. Perhaps also permit @Immutable on abstract classes, with the usual semantics but not adding final?

      Attachments

        Activity

          People

            paulk Paul King
            chrylis Christopher Smith
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: