Quantcast
Channel: Question and Answer » encapsulation
Viewing all articles
Browse latest Browse all 12

Why am I getting field visibility warnings in Sonar?

$
0
0

Some static analysis tools flag non-private fields with

Variable ‘[nameHere]‘ must be private and have accessor methods.

Sonar consistently presents such warnings and wants to change all protected variables in my code to private, why is this? I’m yet to see a protected variable in my work that hasn’t raised this warning.


Viewing all articles
Browse latest Browse all 12

Trending Articles