You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Sven Meier (JIRA)" <ji...@apache.org> on 2015/03/04 09:27:04 UTC

[jira] [Commented] (WICKET-5846) Widen generic definition on AbstractRangeValidator

    [ https://issues.apache.org/jira/browse/WICKET-5846?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14346595#comment-14346595 ] 

Sven Meier commented on WICKET-5846:
------------------------------------

WICKET-5182 fixed this with 7.0.0-M1 already.

Please check you Wicket version.

> Widen generic definition on AbstractRangeValidator 
> ---------------------------------------------------
>
>                 Key: WICKET-5846
>                 URL: https://issues.apache.org/jira/browse/WICKET-5846
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 7.0.0-M5
>            Reporter: Andrew Geery
>            Priority: Minor
>
> I ran into a problem extending {{org.apache.wicket.validation.validator.AbstractRangeValidator}} to work with {{java.time.LocalDate}} in Java 8.
> The problem is the generic R parameter in {{AbstractRangeValidator}}:
> {code:java}
> public abstract class AbstractRangeValidator<R extends Comparable<R> & Serializable, V extends Serializable> { ... }
> {code}
> The issue is that while {{LocalDate}} is both {{Serializable}} and {{Comparable}}, it doesn't implement {{Comparable<LocalDate>}}, as required by {{AbstractRangeValidator}}.  Instead, it implements {{Comparable<ChronoLocalDate>}}.
> In order to get {{AbstractRangeValidator}} to work with {{LocalDate}}, we need to relax/widen the definition of R to extend Comparable that is bound to a super of R:
> {code:java}
> public abstract class AbstractRangeValidator<R extends Comparable<? super R> & Serializable, V extends Serializable>
> {code}
> As this definition is slightly wider than the previous definition, all previous uses will continue to be valid.  The advantage to making this change is that it allows the {{AbstractRangeValidator}} to work with other classes like {{LocalDate}}.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)