The Matcher interface contains the
_dont_implement_Matcher___instead_extend_BaseMatcher_() method to
"encourage" users to extend BaseMatcher when writing their own custom
matchers. This is fine.
A while ago Issue 35 suggested to mark this method as @Deprecated to hide
it from the suggestions of auto code completion in IDEs. This is also
fine. This change was committed in r281 (so the first release with this
change was hamcrest 1.2).
However, this change leads to deprecation warnings when someone writes his
own matchers. Matchers have a factory method
public static <T> Matcher<Double> notANumber() {
and, compiling a matcher with such a factory method (e.g. the IsNotANumber
example from the tutorial page) produces the following warning:
$ javac -Xlint:deprecation -cp build/hamcrest-all-SNAPSHOT.jar
IsNotANumber.java
org/hamcrest/BaseMatcher.java(org/hamcrest:BaseMatcher.java):15: warning:
[deprecation] _dont_implement_Matcher___instead_extend_BaseMatcher_() in
org.hamcrest.Matcher has been deprecated
public final void _dont_implement_Matcher___instead_extend_BaseMatcher_() {
^
1 warning
because, of course, BaseMatcher implements the deprecated
_dont_implement_Matcher___instead_extend_BaseMatcher_() method from the
Matcher interface.
This warning could be avoided by deprecating
BaseMatcher._dont_implement_Matcher___instead_extend_BaseMatcher_(), too.
Original issue reported on code.google.com by sze...@ira.uka.de on 29 Apr 2010 at 3:57
Original issue reported on code.google.com by
sze...@ira.uka.de
on 29 Apr 2010 at 3:57