Reputation: 421
A lot of the time, I start out with methods being public
and then reducing them to the lowest levels needed after I finish, but that's kind of tedious. Is there a way to automatically change all the privacy modifiers (for both classes and methods) to the lowest ones possible all at once?
Upvotes: 4
Views: 2237
Reputation: 305
To change generated methods default access modifier:
File -> Settings -> Editor -> Code Style -> Java -> Code Generation -> Default Visibility
There is a different setting for classes:
File -> Settings -> Editor -> File and Code Templates
Upvotes: 2
Reputation: 16401
It is possible: Analyze | Run inspection by name, and enter Declaration access can be weaker name for the inspection. Then run the inspection for the project and fix all the occurrences in the project by one click in Inspection results tool window.
Upvotes: 5