How to disable "Access can be package-private" message in IntelliJ?
Developing an API, the warning message "Access can be package-package" in Java classes can be really annoying.
I've already spent some time going through the settings to find a way to disable this message but without any findings. Any idea how to disable the message?
Solution 1:
Go to Settings → Editor → Inspections
then Java → Declaration redundancy → Declaration access can be weaker
rule.
Here you can either disable it at all or select the suggestion options on the right pane:
Solution 2:
To disable on a case by case basis, use
@SuppressWarnings("WeakerAccess")
Solution 3:
The inspection rule is "Declaration access can be weaker" and there are two options which can be disabled "Suggest package-private visibility level..."
Solution 4:
Move the cursor to public
, press Alt + Enter and choose one of the options: