-
Notifications
You must be signed in to change notification settings - Fork 0
Scalastyle proposed rules (Modifiers)
This page contains proposed rules for Scalastyle, section Modifiers.
Checks that the order of modifiers conforms to the suggestions in the Scala style guide. The correct order is: to be defined.
Checks for redundant modifiers in:
- trait definitions (such as
abstract trait T
) - the final modifier on methods of final classes (
final class Foo { final def foo() = 4 }
)
Rationale: It adds needless code to files.
Variables in interfaces and annotations are automatically public, static and final, so these modifiers are redundant as well.
As annotations are a form of interface, their fields are also automatically public, static and final just as their annotation fields are automatically public and abstract. Final classes by definition can not be extended so the final modifier on the method of a final class is redundant.
Do not raise the error message "public methods must have an explicit written type" when they are inside of another method:
def f {
def g {} // g is public but not visible to the outside
}