Skip to content

Analyzer does not have a warning for @VisibleForTesting #28273

Closed
@sebastianmalysa-wf

Description

@sebastianmalysa-wf

The documentation for the VisibleForTesting annotation suggests that the analyzer will provide feedback if "the annotation is associated with a declaration not in the 'lib' folder of a package or the declaration is referenced outside of its defining library or a library which is in the 'test' folder of the defining package (

sdk/pkg/meta/lib/meta.dart

Lines 123 to 133 in 37890f9

/// Used to annotate an instance member that was made public so that it could be
/// overridden but that is not intended to be referenced from outside the
/// defining library.
///
/// Tools, such as the analyzer, can provide feedback if
///
/// * the annotation is associated with a declaration other than a public
/// instance member in a class, or
/// * the member is referenced outside of the defining library.
const _VisibleForOverriding visibleForOverriding =
const _VisibleForOverriding();
)." The analyzer does not seem to provide any feedback around this annotation. Currently the annotation is great for documentation purposes, but it would be even better if the analyzer caught the circumstances above and provided a warning. Are there any plans to do this?

Metadata

Metadata

Assignees

Labels

P2A bug or feature request we're likely to work onlegacy-area-analyzerUse area-devexp instead.type-enhancementA request for a change that isn't a bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions