And people accuse _me_ of using long method names

JMock logo

MJ tipped me to this amazing method name in the Matcher interface in JMock2:

void _dont_implement_Matcher___instead_extend_BaseMatcher_()

Yeah, I’m not making that up.

As the documentation goes on to explain:

This method simply acts a friendly reminder not to implement Matcher directly and instead extend BaseMatcher. It’s easy to ignore JavaDoc, but a bit harder to ignore compile errors :).

The third grader in me loves stuff like that. To be honest, I’m not entirely convinced that this is a great idea - it smells like a workaround instead of a solution. Still, it’s clever and funny and accomplishes a meaningful task, which is more than I can say for most code in this world.

Makes me want to go do this just for fun. I just need to create an interface you shouldn’t implement … Well, like I said, I’m not sure it’s such a good idea after all…

No tag for this post.

Related posts

Leave a Reply