Minimize the accessibility of members 

es.uniovi.reflection.analyses.bloch.4.13.2


This rule detects members whose access level must be reduced. More precisely, it detects public fields which are arrays or non-final declared in public types, since they must never be public. It also detects public or protected members that are declared in a type with lower access level, since they are not accessible as long as its enclosing type is not, and therefore their visibility can always be reduced. Finally, it detects package-private members that are only accessed from its compilation unit, and therefore their visibility can always be reduced to private. We do not consider fields and methods that are never used. We also do not consider methods that override or are overridden by any other method.

Computational Reflection Research Group
09-30-2026 22:23
Bad Practice
Declaration