Skip to content

JSpecify: restrict instantiation type on constructors like AtomicReference #1300

@msridhar

Description

@msridhar

See typetools/checker-framework#1330 and https://github.com/jspecify/jspecify/wiki/nullness-borderline-cases#the-atomicreference-case. For AtomicReference, we could report an error if the zero-arg constructor is invoked to create an AtomicReference<@NonNull C> for any C (as a follow-on to #1298). There are other scenarios like this, e.g., TreeSet and also ThreadLocal. It'd be nice to have a general way to do this, maybe even supported by an annotation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    jspecifyRelated to support for jspecify standard (see jspecify.dev)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions