You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
|---|
|
From: David S. <sa...@mi...> - 2006-12-20 21:56:30
|
Hi all,
I was bit by a bug that caused ReflectiveFactoryMatcher to miss
factory methods that return a subclass of Matcher. That is, I believe
this test should pass:
public static class SubclassOfMatcher {
@Factory
public static BaseMatcher subclassMethod() {
return null;
}
}
public void testCatchesSubclasses() {
Iterable<FactoryMethod> reader = new
ReflectiveFactoryReader(SubclassOfMatcher.class);
Iterator<FactoryMethod> methods = reader.iterator();
assertTrue("Expected first method", methods.hasNext());
}
And I think all it takes to do it is reversing the way that
isAssignableFrom is used in ReflectiveFactoryMatcher:
protected boolean isFactoryMethod(Method javaMethod) {
return isStatic(javaMethod.getModifiers())
&& isPublic(javaMethod.getModifiers())
&& javaMethod.getAnnotation(Factory.class) != null
&& Matcher.class.isAssignableFrom(javaMethod.getReturnType());
}
Sorry not to submit a patch--I seem to have hosed my local subversion
checkout. Thanks,
David Saff
|