arashja / hamcrest

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

Matchers to be java.io.Serializable #156

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago

What if matchers were Serializable?

I'm thinking of using hamcrest infrastructure as rule predicate matching (to 
see if a rule should fire or not), but the resulting composite predicate 
*SHOULD* have some way to be exported.

For my custom matchers I could made them Serializable, but the core matchers 
are so useful, and I'll have to reimplement them just for serializability.

I'm wondering whether there is a down side, and what it looks like. Any ideas?

Original issue reported on code.google.com by rsle...@gmail.com on 31 Jul 2011 at 9:48

GoogleCodeExporter commented 8 years ago
tagging

Original comment by t.denley on 12 May 2012 at 10:32

GoogleCodeExporter commented 8 years ago
Although I can see merit in what you are trying to achieve, we are not going to 
impose a serializability constraint on hamcrest matchers.  There are several 
ways of creating serializable classes composed of non-serializable components 
and I suggest you have a look at one of those.  Josh Bloch's book "Effective 
Java" has good chapter on this.

Original comment by t.denley on 29 Jul 2012 at 9:45