Stripes is a Java framework with the goal of making Servlet/JSP based web development in Java as easy, intuitive and straight-forward as it should be. It's stripey and it doesn't suck.
I wrote formatters and type converters for Java Time API (here is the repo).
I tried to let Stripes auto-detect them via Extension.Packages, but it failed with warnings like below.
2017/05/22 16:09:27,988 WARN (stripes.config.RuntimeConfiguration#warn) - Type parameter for non-abstract Formatter [class net.harawata.stripes.jsr310.format.LocalDateFormatter] is not a class.
Basically, I created an abstract class that contains the common code ...
public abstract class
TemporalAccessorFormatter<T extends TemporalAccessor>
implements Formatter<T> {}
... and extend it to create the actual implementations.
public class LocalDateFormatter
extends TemporalAccessorFormatter<LocalDate> {}
With this structure, ReflectUtil#getActualTypeParameters(LocalDateFormatter.class, Formatter.class) returns the type variable T instead of LocalDate.
With this PR applied, the method returns the correct type.
This change should be backward compatible.
Here is the background:
I wrote formatters and type converters for Java Time API (here is the repo). I tried to let Stripes auto-detect them via
Extension.Packages
, but it failed with warnings like below.Basically, I created an abstract class that contains the common code ...
... and extend it to create the actual implementations.
With this structure,
ReflectUtil#getActualTypeParameters(LocalDateFormatter.class, Formatter.class)
returns the type variableT
instead ofLocalDate
.With this PR applied, the method returns the correct type. This change should be backward compatible.