Cette page n'est pas encore disponible en français, sa traduction est en cours. Si vous avez des questions ou des retours sur notre projet de traduction actuel, n'hésitez pas à nous contacter.
Metadata
ID:java-code-style/avoid-protected-in-final-class
Language: Java
Severity: Notice
Category: Code Style
Description
Avoid setting fields as protected inside a final class as they cannot be subclassed.
If flagged, review your class and its usage. Consider adjusting your modifiers and their access.
Non-Compliant Code Examples
publicfinalclassFoo{privateintx;protectedinty;// visibility should be reviewed
protectedintgetY(){// visibility should be reviewed
returny;};Foo(){}}