java - How to solve squid:UndocumentedApi on public method in package classes -
i have classes, visible in package. after analysis received issues related missing documentation on public constructors/methods/types etc.
is bug (false positive)? seems me change public not public constructors/methods/types senseless.
i use sonarqube 5.1.1 , java plugin 3.4.
about methods, fields , inner classes:
having methods (or fields or inner classes) being public in package-private class implies if extended public class, public members package-private class visible outside! consequently, have considered being public, , therefore documented.
example:
package-private class a:
package org.foo; class { public int field; public void method() {} public class inner {} }
public class b:
package org.foo; public class b extends { }
other package, class c:
package org.bar; public class c { void test() { b b = new b(); int f = b.field; // visible b.inner = b.new inner(); // visible b.method(); // visible } }
about constructors:
as constructors of package-private class visible same package, , these constructors won't callable package, through public child class, it's indeed wrong raise issue on them , should corrected in sq rule java plugin (see sonarjava-1557).
i recommend lower visibility of constructor, having public somehow senseless...
Comments
Post a Comment