siom79 / japicmp

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

fix: check changes in return types #397

Closed Billlynch closed 2 months ago

Billlynch commented 3 months ago

I noticed that the maven plugin does not break on METHOD_RETURN_TYPE_GENERICS_CHANGED.

This looked to be because method is not given a JApiCompatibilityChange, but instead the return type of the method is given a JApiCompatibilityChange.

https://github.com/siom79/japicmp/blob/68727ed928502f0062cab4177eea6efe21c2e697/japicmp/src/main/java/japicmp/compat/CompatibilityChanges.java#L453

So added a check for the compatibility changes in the return types of methods.

Billlynch commented 3 months ago

Also the JApiCompatibilityChange could be added to the method not the return type, as the return type has changed. I did not go for this approach off the bat because there are multiple tests that specify this behaviour.

This could be done by checking here if the generic return type is different and putting the JApiChangeStatus to MODIFIED. Adjusting accordingly in the check method. I think this is following the section 13.4.15 of the SE7 java spec a little more accurately.

siom79 commented 2 months ago

Thanks again for the PR and your work.

siom79 commented 2 months ago

0.21.2 is on its way to Maven central.