siom79 / japicmp

Comparison of two versions of a jar archive
https://siom79.github.io/japicmp
Apache License 2.0
712 stars 107 forks source link

The 'outputOnlyModifications' option incorrectly filters out classes that have their modifiers changed #247

Closed tdegueul closed 4 years ago

tdegueul commented 5 years ago

Hi,

When using the option -m, --only-modified, japicmp sets the japicmp.config.Options.isOutputOnlyModifications flag. This flag is then used by the OutputFilter to filter out classes that did not change from the final report.

IMHO, the flag is incorrectly used in OutputFilter:

https://github.com/siom79/japicmp/blob/ac729c69f45c36a2df3b8d5dff039e6608d2603c/japicmp/src/main/java/japicmp/output/OutputFilter.java#L180-L187

This code removes classes that are marked as MODIFIED but for which there is no nested MODIFIED element. This means that if the only change to a class is that (for instance) it goes from non-abstract to abstract, the class will be filtered out and removed from the final report. Even if none of the nested elements in the class have changed, this is still a breaking change and should be part of the final report.

Wdyt?

siom79 commented 4 years ago

Released with 0.14.2.