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

Changing default method to static should be separate case #363

Closed siom79 closed 10 months ago

siom79 commented 10 months ago

see discussion in https://github.com/siom79/japicmp/commit/a941c343cfddf2dbcb19b2d0281c1e6026e07b69#r128449820

Marcono1234 commented 10 months ago

From https://github.com/siom79/japicmp/commit/a941c343cfddf2dbcb19b2d0281c1e6026e07b69#r128486069:

In case it was abstract and changed to static, then the Class C must have an implementation of the method (as it was abstract) and therefore it is still source compatible (new C().doSomething() calls the method in C) and binary compatible (the method in C gets called).

The problem here is though when the method is not called on the class C but on a variable with the type of the interface I:

I i = ...;
i.doSomething();

If doSomething() is changed from abstract to static this causes

siom79 commented 10 months ago

@Marcono1234 Got it. Thanks for pointing out.

Marcono1234 commented 10 months ago

Thanks for the changes!

METHOD_NON_STATIC_IN_INTERFACE_NOW_STATIC has still JApiSemanticVersionLevel.MINOR though. Is that intentional or should it rather be MAJOR now?

siom79 commented 10 months ago

Yes, you are right again. :smile: And then we don't need METHOD_DEFAULT_NOW_STATIC, too.

siom79 commented 10 months ago

Released with 0.18.1