github hcoles/pitest pitest-parent-1.2.1
1.2.1

latest releases: 1.18.2, 1.18.1, 1.18.0...
7 years ago

#347 - Avoid autogenerated code (e.g by lombok) anotated with @generated
#285 - Avoid compiler generated conditionals in switch on string. (thanks @Kwaq)
#218 - New "naked receiver" / method chain mutator. (thanks @UrsMetz)
#354/#356 - New extension point plus changes to reduce cost of random access to bytecode for static analysis
#353 - Improved static initializer code detection
#364 - Filter infinite loops via static analysis
#365 - Configuration system for plugins

Filtering by annotation

The new annotation filtering will work only with annotations that have class or runtime retention. Annotations such as javax.annotation.Generated are invisible to pitest as they have only source retention.

By default pitest will not create mutations in any methods or classes annotated with annotations named Generated, CoverageIgnore or DoNotMutate, regardless of the package name.

If you are using Lombok it can be configured to add a Generated annotation by setting

lombok.addLombokGeneratedAnnotation = true

in the Lombok configuration (not pitest's)

https://projectlombok.org/features/configuration

If the default annotations are not sufficient custom annotations can be configured using the new feature config system.

In maven pass

<feaures>
  <value>+FANN(annotation[com.example.MyAnnotation1] annotation[com.example.MyAnnotation2])</value>
</features>

And the custom annotations will be ignored.

Filtering of annotations can be disabled entirely by setting

<features>
  <value>-FANN</value>
</features>

Infinite loop detection

Pitest has always been able to deal with infinite loops, but each one it encounters costs several seconds of processing time.

As a performance enhancement pitest can now detect some types of infinite loop via static analysis and remove these mutations from the analysis.

Most users will not notice a performance improvement as the types of infinite loop detected are not generated by the default mutator set. If you have the REMOVE_INCREMENTS mutator or NON_VOID_METHOD_CALLS mutator enables you may however see a significant reduction in both the number of generated mutants and the analysis time.

Improvements will be made to this system in future releases.

To disable infinite loop filtering pass the feature name with a - in the features section of the config.

  • FINFINC - Filters mutations to increments that may cause infinite loops
  • FINFIT - Filters mutations that may cause infinite loops by removing calls to iterator.next

Features

As discussed briefly in the above sections this release provides a new way to configure some aspects of pitest's behaviour.

Several previously hard coded behaviours can now be configured in this way

  • FINFINC Filters mutations to increments that may cause infinite loops
  • FFBLOCK Filters mutations in code duplicated by finally block inlining
  • FSTATI Filters mutations in static initializers and code called only from them
  • FTRYWR Filters mutations in code generated for try with resources statements
  • FSTATINIT Filters mutations in static initializers and code called only from them
  • FLOGCALL Filters mutations in code that makes calls to logging frameworks
  • FINFIT Filters mutations that may cause infinite loops by removing calls to iterator.next
  • FANN Filters mutations in classes and methods with matching annotations of class or runtime retention

If pitest is run with verbose logging enabled a list of enabled and disabled features will be printed.

To enable a feature specify it with a leading + in the features config section.

To disable a feature specify it with a leading - in the features config section.

Don't miss a new pitest release

NewReleases is sending notifications on new releases.