org/apache/wicket/extensions/markup/html/form/DateTextField converter never null
--------------------------------------------------------------------------------
Key: WICKET-3468
URL: https://issues.apache.org/jira/browse/WICKET-3468
Project: Wicket
Issue Type: Improvement
Components: wicket-extensions
Affects Versions: 1.5-RC1
Environment: all
Reporter: Richard Emberson
Priority: Trivial
As far as I can see the
org/apache/wicket/extensions/markup/html/form/DateTextField
converter instance variable is never null, so the getConverter can be re-written
public <C> IConverter<C> getConverter(Class<C> type)
{
if (converter == null)
{
return super.getConverter(type);
}
else
{
return (IConverter<C>)converter;
}
}
to
public <C> IConverter<C> getConverter(Class<C> type)
{
return (IConverter<C>)converter;
}
And as an aside, here is another case where the Wicket code is saved by the
fact that
the JVM does generic type erasure. The converter instance variable is of
type IConverter<Date>. If someone came out with a JVM that did not do type
erasure,
then the getConverter method would throw a cast exception for all but the Date
class
as a parameter. Everywhere in Wicket that the getConverter method appears has
such
a problem. But, saved by Java's poor generic implementation (though, the cast
exception would probably appear in later code).
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira