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?
检查规则是“声明访问权限可能较弱”,有两个选项可以禁用“建议包 - 私有可见性级别......”
要根据具体情况禁用,请使用
@SuppressWarnings("WeakerAccess")
Another solution not mentioned so far: if you have a method that's declared public, and the IDE is telling you that there are no references to the method from outside the package, then perhaps you need to add a test case that calls that method from outside the package. In other words, treat the warning as signalling the absence of a test case for a public method.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.