hardayal / hamcrest

Automatically exported from code.google.com/p/hamcrest
0 stars 0 forks source link

XmlConfiguration includes factory methods from superclasses #42

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago

 If a Matcher implementation subclasses another matcher implementation
(e.g. a subclass of AnyOf that passes specific matchers to the AnyOf
constructor), then the @Factory methods from the parent class will be
included during sugar generation. This can lead to conflicts between
methods imported from the Matchers and CoreMatchers sugar classes when used
in the same code.

Perhaps the ReflectiveFactoryReader should be calling
Class.getDeclaredMethods() instead of Class.getMethods().

I've worked around this by delegating to the core AnyOf matcher instead of
subclassing, but my preferred implementation would have been to subclass.

Original issue reported on code.google.com by mdillon....@gmail.com on 25 Aug 2008 at 8:18

GoogleCodeExporter commented 8 years ago
Just to be clear, I don't mean conflict between Matchers and CoreMatchers, I 
mean
conflict between user-generated sugar and the sugar in Matchers/CoreMatchers 
(e.g.
"anyOf()").

Original comment by mdillon....@gmail.com on 25 Aug 2008 at 8:19

GoogleCodeExporter commented 8 years ago
Do you get the conflict when you do both "import static Matchers.*" and "import
static SomethingElse.*".  In which case, the solution is to import the methods 
you
want explicitly.

Original comment by nat.pr...@gmail.com on 15 Oct 2008 at 9:20

GoogleCodeExporter commented 8 years ago
tagging

Original comment by t.denley on 12 May 2012 at 11:03