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

Sven Meier commented on WICKET-6189:
------------------------------------

Actually just changing the return type of #find(Class) might lead to unnoticed 
regressions.

The following if-cause will compile happily, but lead to a false result:

{code}
if (RequestCycle.get().find(AjaxRequestTarget.class) == null) {
    // executed for non-ajax-request in Wicket 7
    // never executed in Wicket 8
    ...
}
{code}

IMHO deprecating the old method and introducing a new one will be easier for 
migration.

> Return Optional<T> from RequestCycle.find(Class<T>)
> ---------------------------------------------------
>
>                 Key: WICKET-6189
>                 URL: https://issues.apache.org/jira/browse/WICKET-6189
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 8.0.0-M1
>            Reporter: Sven Meier
>            Assignee: Sven Meier
>            Priority: Minor
>
> RequestCycle.find(Class<T>) is mostly used to get the current 
> AjaxRequestTarget.
> Since the returned reference might be null (in case of a non-Ajax request), 
> it would be better to return an Optional<AjaxRequestHandler>.



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

Reply via email to