Uploaded image for project: 'Pivot'
  1. Pivot
  2. PIVOT-1047

Make sure that as many listener interfaces as possible can be used with lambdas



    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 2.1.0
    • Component/s: core, wtk, wtk-terra
    • Labels:


      Earlier we had (for Java 8 compatibility) made most/all interfaces implement default methods so that the Adapter classes could be deprecated. But in working with these, it appears that defaulting ALL the methods makes them unusable as lambdas.

      For instance, DialogCloseListener has just one interface method, perfect for a lambda, except with default it isn't eligible. By simply making it pure abstract there are no negative consequences, and makes it much more useful. By this I mean, with only one method, the only reason to instantiate one would be to implement the one, so "default" doesn't really make sense, while abstract/lambda is perfect.

      Investigate this for other interfaces, as some are more problematic, such as TextInputContentListener, which has multiple "useful" methods, so the trick would be picking just one (the most commonly implemented one?) to make abstract. Or ListButtonSelectionListener which has two roughly equally useful methods, where we would typically use one or the other, but not both. So, making it lambda-compatible doesn't really help much, in terms of usability.

      Others such as Validator are already abstract and need no change, except they could be marked with the @FunctionalInterface annotation to make this clear.

      Careful investigation is needed, since it is possible that making one method abstract means the Adapter class might not be suitable for Deprecation anymore either; not sure.




            • Assignee:
              rwhitcomb Roger Lee Whitcomb
              rwhitcomb Roger Lee Whitcomb
            • Votes:
              0 Vote for this issue
              1 Start watching this issue


              • Created: