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

Changing default method to static should be separate case #363

Closed
siom79 opened this issue Sep 27, 2023 · 5 comments
Closed

Changing default method to static should be separate case #363

siom79 opened this issue Sep 27, 2023 · 5 comments

Comments

@siom79
Copy link
Owner

siom79 commented Sep 27, 2023

see discussion in a941c34#r128449820

siom79 added a commit that referenced this issue Sep 27, 2023
siom79 referenced this issue Sep 27, 2023
…N_INTERFACE_NOW_STATIC and METHOD_STATIC_IN_INTERFACE_NO_LONGER_STATIC
@Marcono1234
Copy link
Contributor

From a941c34#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

  • Source incompatibility:
    illegal static interface method call
    
  • Binary incompatibility:
    IncompatibleClassChangeError: Expected instance not static method 'void I.doSomething()'
    

@siom79
Copy link
Owner Author

siom79 commented Sep 28, 2023

@Marcono1234 Got it. Thanks for pointing out.

@Marcono1234
Copy link
Contributor

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
Copy link
Owner Author

siom79 commented Sep 29, 2023

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

@siom79
Copy link
Owner Author

siom79 commented Sep 29, 2023

Released with 0.18.1

@siom79 siom79 closed this as completed Sep 29, 2023
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

2 participants