Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-2325

IChoiceRenderer generic type parameters are wrong throughout the AbstractChoice class hierarchy

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.4-RC5
    • 1.4-RC6
    • wicket
    • None

    Description

      All the AbstractChoice components currently make use of an IChoiceRenderer<T>. They should more properly make use of an IChoiceRenderer<? super T>. The excessive strictness of the type parameter prevents users from defining a singleton choicerenderer that can be used for a variety of different choice components for different but related classes.

      Example use-case: Most of my persistent beans implement INamedPersistentObject, providing getName() and getPrimaryKey() methods. This is enough to implement an IChoiceRenderer<INamedPersistentObject>. I wish to declare a singleton instance of this and reuse it for various choice components on various concrete types, but currently can't without messy casts.

      I have set priority=blocker on this bug because it is an API issue which really needs consideration before 1.4 is released, as depending on how strict an API/ABI compatibility policy is used, it might be considered unfixable once 1.4 is released GA.

      Attachments

        1. choicerenderer-generics.patch
          13 kB
          Max Oliver Bowsher

        Activity

          People

            ivaynberg Igor Vaynberg
            maxb Max Oliver Bowsher
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: