Skip to content

Should @AnnotatedFor on a package apply to subpackages? #1990

Description

@aosen-xiong

QualifierDefaults had a // TODO: should AnnotatedFor apply to subpackages?? comment from #708 until #1331 removed it. The question was never answered, and modelling JSpecify's @NullMarked now requires thinking about it.

In #1304, I want to add aliasing between @AnnotatedFor("nullness") and @Nullmarked.

@DefaultQualifier on a package applies to subpackages, and had applyToSubpackages element (default true) so a default can opt out. @AnnotatedFor has no such element.

JSpecify specifies that @NullMarked on a package does not cover its subpackages, and #1304 aliases @NullMarked to both annotations:

@DefaultQualifier(NonNull, locations=UPPER_BOUND, applyToSubpackages=false) — can opt out, and does.
@AnnotatedFor("nullness") — cannot opt out, so the scope reaches subpackages.

Should we change @AnnotatedFor's behaviour or document this inconsistency with @Nullmarked semantics?

@wmdietl Do you have ideas on how to deal with this issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions