error-prone icon indicating copy to clipboard operation
error-prone copied to clipboard

NonApiType: signaling for use of non-API-types on private methods does not make sense

Open cobratbq opened this issue 2 years ago • 0 comments

NonApiType warns for concrete types used as parameter types and return types for (static) private methods. To verify this for private methods does not make sense, given that the class is the unit of abstraction. You cannot ignore the chosen concrete type if it is subsequently used as part of internal state.

Note that you can voluntarily choose to ignore the concrete type if its use is so minimal that the concrete type does not in any way reach an implementation boundary or design limitation. However, given that private methods can only be accessed in the internals of classes, the class itself needs to be sound unit and hiding types would obscure possible problems.

update or parameter-types of private constructors

cobratbq avatar Jan 18 '24 16:01 cobratbq