Community
Participate
Working Groups
Build Identifier: I like tidying up my code and use settings like "Unused local or private member". This works great. But why isn't there a similar setting to warn for not used PUBLIC methods and fields?? Reproducible: Always
The idea behind the warning is that you should be able to get rid of the complained against item, say by using a quick fix offered by the IDE, or otherwise by manually. Given public methods are exposed to the whole wide world, there could be parts of the code not seen by the compiler that use the method. This will trigger the warning for most API methods, where there is no usage "locally" - i.e, the client code that uses these methods is compiled independently. See that in cases like what is shown below, the compiler does produce a warning as appropriate: because the region of code where such a public method is usable is well bounded by the language specification, the compiler can and does verify usage: public class Tools { private class Private { public void foo() { } } Private p = new Private(); } For more general cases, I doubt that anything could be done that would not also open the flood gates for numerous other pointless or just plain incorrect warnings.
As Srikanth explained, there is nothing we can do for public methods. Closing as INVALID.
Verified for 3.7M1