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

Adding/Removing final modifier on class and class/trait methods #51

Open
tomzx opened this issue Feb 25, 2015 · 0 comments
Open

Adding/Removing final modifier on class and class/trait methods #51

tomzx opened this issue Feb 25, 2015 · 0 comments

Comments

@tomzx
Copy link
Owner

tomzx commented Feb 25, 2015

The addition/removal of the final keyword on existing class and class/trait methods is currently not considered as having a semantic versioning impact.

I suggest adding the following rules in order to cover this new requirement.

Visibility (public, protected, private) applies to classes/trait methods.

Classes

At the class level

Code Level Rule
VXXX MAJOR Added
VXXX MINOR Removed

Classes with final keyword on the class
The case is for a class that already has the final modifier applied to it, but where we're adding/removing methods.

Code Level Rule
---- ----- - Added
VXXX PATCH -- Public
VXXX PATCH -- Protected
VXXX PATCH -- Private
---- ----- - Removed
VXXX PATCH -- Public
VXXX PATCH -- Protected
VXXX PATCH -- Private

Classes without final keyword on the class but with final keyword on the methods
The case is for a class that does not have the final modifier applied to it and where we're adding/removing methods with the final keyword.

Code Level Rule
---- ----- - Added
VXXX MAJOR -- Public
VXXX MAJOR -- Protected
VXXX MAJOR -- Private
---- ----- - Removed
VXXX MAJOR -- Public
VXXX MAJOR -- Protected
VXXX MAJOR -- Private

Adding the final keyword to a private method will prevent class that inherit from this class from having a method with the same name.

Traits

The case is for a trait but where we're adding/removing methods with the final keyword.

Code Level Rule
---- ----- - Added
VXXX MAJOR -- Public
VXXX MAJOR -- Protected
VXXX PATCH -- Private
---- ----- - Removed
VXXX MINOR -- Public
VXXX MINOR -- Protected
VXXX PATCH -- Private

The rule levels are up for discussion.

This creates 18 new rules.

This brings an interesting question if we relate this issue with #49, which is, can we consider the addition/removal of class and class/trait methods with the final modifier as a two step process (adding/removing the class/trait/method + adding/removing the final modifier). I'll have to do an analysis of the two to see if they are the same in the end or if they need to be handled separately.

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

No branches or pull requests

1 participant