-
Notifications
You must be signed in to change notification settings - Fork 107
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 methods in interfaces... #201
Comments
As of Chapter 13. of the JLS:
Hence I decided to mark both changes (adding a new default method, changing a method from abstract to a default method) as incompatible, as both may be incompatible (depending on the inheritance hierarchy they are used in). In general adding a method to an interface is only source incompatible but not binary incompatibly, as there is no existing code that does call the new method (see JLS). |
…sly abstract method to a default method is marked as incompatible
@siom79 I can open a new issue, but wanted to keep the context here. I guess writing a groovy script to post process the report is another option. Thoughts or other recommendations ? |
This may be a general topic as there are may be other changes that may be incompatible in a specific situation but in another not. Why do you want to mark a new default method as binary compatible? |
I want to extend an interface (and provide defaults). I really just want some easy way of configuring the japicmp plugin to not fail the build in this scenario. |
I would welcome possibility to exclude this type of compatibility too. |
I have made it possible to configure whether certain changes are binary or source or even not incompatible at all (see #209). |
Great thanks. Unfortunately, if I am looking correctly, it does not allow to allow adding methods iff they have default implementation... |
Take a look here. The table for the
You can set them both to binary and source compatible, if you like:
|
Thanks! Before setting: After setting METHOD_NEW_DEFAULT as compatible change: |
Then you must also configure
|
Yes, but that is something I would like to keep checked, as adding non-default method into interface is really breaking change. (If somebody implement that interface, he will have a problem to compile it against new version of library - as opposite to the default method, which allow to keep interface implementations unchanged. The mentioned IncompatibleClassChangeError looks more theoretical, as I dont see how could old code call the new default method.) |
@hkalina Take a look at the groovy script support. It was pretty easy to add a single exclusion using the Maven plugin: And the actual groovy script: |
@hkalina You can also use the |
…D_TO_INTERFACE are not set simultaneously
@hkalina The last commit on this ticket changes the evaluation such that the two compatibility changes METHOD_NEW_DEFAULT and METHOD_ADDED_TO_INTERFACE are not set simultaneously. |
Amazing, works perfectly! :) |
Can I add |
@garydgregory No, currently you can change the settings only globally. |
... should count as incompatibility unless default implementation is provided (in Java 8+)
The text was updated successfully, but these errors were encountered: