-
Notifications
You must be signed in to change notification settings - Fork 4
AA1100InterfacePropertiesShouldBeReadOnly
Warning: this wiki page is auto-generated by the Arnolyzer solution-build process. Do not directly edit this page, as your changes will be lost on the next commit. To edit this page, please refer to Contributing to this project.
These wiki pages reflect the state of the project in development, per the last commit. For details of the latest release of the Arnolyzer Analysers, please see the Arnolyzer website.
Report code: AA1100-InterfacePropertiesShouldBeReadOnly
Status | Implemented |
Description | To provide encapsulation, properties should only make getters publicly available, so interfaces should not define setters for properties. |
Category | Encapsulation Analyzers |
Enabled by default: | Yes |
Severity: | Error |
Interface properties should not have setters. Doing so forces implemnting classes to have public setters on those properties and so they become mutable from any other point in the code that has access to the object instance, making it much harder to track changes to the object's state.
There currently aren't any implemented code-fixes for this rule.
This rule can be suppressed using the following attributes:
[MutableProperty]
A public setter may sometimes be required. It is therefore allowed if decorated with the MutableProperty attribute as it explicitly asserts the need for the property to be mutable.