Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New static method in interface detected as METHOD_NEW_DEFAULT #289

Open
runeflobakk opened this issue Jun 18, 2021 · 9 comments
Open

New static method in interface detected as METHOD_NEW_DEFAULT #289

runeflobakk opened this issue Jun 18, 2021 · 9 comments

Comments

@runeflobakk
Copy link

runeflobakk commented Jun 18, 2021

I have added a couple of public static methods in an interface, and japicmp detects them as a binary incompatible METHOD_NEW_DEFAULT change. I don't have the knowledge to tell if this indeed is incompatible, but I was a bit surprised, and since the change indicates something to do with default methods, I thought I'd ask if this may be a false positive.

Should adding static methods to an interface be detected as METHOD_NEW_DEFAULT?

If I have not provided enough context here, please just let me know what information you need :)

report showing new static methods detected as METHOD_NEW_DEFAULT

@WencongLiu
Copy link

Hello @runeflobakk , I meet a similar problem with you. The link is ISSUE. The difference is that I set BinaryIncompatible to disabled and SourceIncompatible to enabled.

However, I think adding a default method to an interface shouldn't be source incompatible. Do you have any solution right now?

@siom79
Copy link
Owner

siom79 commented Aug 31, 2023

Hello, you both are right (see here). I will fix this in the next release.

@WencongLiu
Copy link

Thanks for your reply! @siom79 Looking forward to the next version.

@WencongLiu
Copy link

When will the next version be released, please? @siom79 😄

@siom79
Copy link
Owner

siom79 commented Sep 2, 2023

I have just released 0.17.3. It should be available in Maven central within a few hours.

@Marcono1234
Copy link
Contributor

@siom79, it looks like this issue here was also about whether new static interface methods should be reported as METHOD_NEW_DEFAULT. Is that intended? japicmp 0.17.3 still behaves this way.

For regular classes, adding a static method seems to be reported as METHOD_ADDED_TO_PUBLIC_CLASS. Though there seems to be no corresponding existing type for interfaces yet; METHOD_ADDED_TO_INTERFACE seems to be about abstract interface methods.

@siom79
Copy link
Owner

siom79 commented Sep 5, 2023

@Marcono1234 Yes, you are right. If the method is new an not abstract (e.g. static) it is flagged as METHOD_NEW_DEFAULT. It should rather be flagged METHOD_ADDED_TO_INTERFACE. I need to change that.

@siom79 siom79 reopened this Sep 5, 2023
@Marcono1234
Copy link
Contributor

It should rather be flagged METHOD_ADDED_TO_INTERFACE

Or would it need a new type? Because METHOD_ADDED_TO_INTERFACE is currently for adding an abstract method, which is not source compatible, while adding a static method is source compatible.

Should maybe METHOD_ADDED_TO_INTERFACE then also be deprecated and be renamed to METHOD_ABSTRACT_ADDED_TO_INTERFACE to be more precise and to match the name of the existing METHOD_ABSTRACT_ADDED_TO_CLASS type?

siom79 added a commit that referenced this issue Sep 8, 2023
…N_INTERFACE_NOW_STATIC and METHOD_STATIC_IN_INTERFACE_NO_LONGER_STATIC
@siom79
Copy link
Owner

siom79 commented Sep 8, 2023

I have fixed the issue in the latest commit. In this context I have introduced three new incompatiblities:

  • METHOD_NEW_STATIC_ADDED_TO_INTERFACE
  • METHOD_NON_STATIC_IN_INTERFACE_NOW_STATIC
  • METHOD_STATIC_IN_INTERFACE_NO_LONGER_STATIC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants