hcoles/pitest — pull request #98 by artspb (2014-02-20 12:50:47+00:00)
Title: avoid mutating of try-with-resources auto generated finally block

This commit relates to issue #48: JDK7 try-with-resources with catch produces failing mutations for autoclose code. The main purpose of it is avoid mutating of try-with-resources auto generated finally block.

- The TryWithResourcesMethodVisitor class is responsible for determining auto generated finally blocks and storing information about it into context. Most popular compilers are supported like javac and eclipse compiler for java.
- The TryWithResourcesFilter class is used to exclude mutations that refers to code lines that was found by previos class.
- The TestTryWithResources class is intended to test appropriate logic. It uses 6 examples that was compiled by 6 different compilers (javac, ecj, aspectj). You can find source code of the examples in this repo: https://github.com/artspb/try-with-resources-examples.

I have some concerns about this commit:
- For now TryWithResourcesFilter always on. Should it be configurable option?
- I suppose that GregorMutater class shoud be refactored to replace InlinedCodeFilter and TryWithResourcesFilter with list of some filters. It allows us to create additional filters for mutations without significant code changes in the future.

I tested this code on my project (15k code lines) and it looks like stable. This changes helped me to exclude almost 200 mutaions of auto generated code. So I hope this commit will helpful for somebody else.