Description
It is clear that having the final
keyword applied either to a class in its entirety or on specific methods has an impact on the type of semantic version a change should generate.
I suggest adding the following rules in order to cover this new requirement.
Visibility (public, protected, private) applies to classes/trait methods.
Classes
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 |
V017 | MINOR | -- Public |
V018 | PATCH | -- Protected |
V030 | PATCH | -- Private |
---- | ----- | - Removed |
VXXX | MAJOR | -- Public |
V022 | 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 | PATCH | -- Private |
---- | ----- | - Removed |
VXXX | MAJOR | -- Public |
VXXX | MAJOR | -- Protected |
VXXX | PATCH | -- Private |
Trait
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 | MAJOR | -- Private |
---- | ----- | - Removed |
VXXX | MAJOR | -- Public |
VXXX | MAJOR | -- Protected |
VXXX | MAJOR | -- Private |
The rule levels are up for discussion.
This creates 14 new rules and use 4 existing rules (not implemented).
Changelog:
2015-02-25: Add separation between final on class and final on methods based on @mikeSimonson feedback.