Find @VisibleForTesting members accessed from production code
ProprietaryMarks references from production sources to a method, constructor, field or class annotated with @VisibleForTesting. The annotation documents that the element exists, or is more visible than it needs to be, only so that tests can reach it, so using it from shipping code couples production code to a test seam. Any annotation with the simple name VisibleForTesting counts, whatever its package. Only a reference from a different source file than the declaration is marked, including one from the same package, and only the first reference to each element in a file. An element annotated with @VisibleForTesting(otherwise = VisibleForTesting.PROTECTED) (AndroidX) is skipped, and so is one whose annotation has an otherwise element that cannot be read. Imports and Javadoc references are not marked, and new Type() counts as a use of the constructor, not of the class (for an anonymous subclass, the superclass constructor it calls). An annotation with source retention is not seen on an element read from a class file. Test sources are not searched.
io. moderne. staticanalysis. FindVisibleForTestingUsedInProductionmod run . --recipe= io. moderne. staticanalysis. FindVisibleForTestingUsedInProductionInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.