Skip to content

Should @DefaultNullable even exist, given it's probably not that recommendable? #41

Closed

Description

@kevinb9n

I have been in favor of preserving parallel structure between three nullness annotations and three default-nullness annotations.

But do we really want people to use @DefaultNullable?

We could leave it out while still having parallel definitions for the things we do keep in.

Activity

  1. eaftan commented on Jun 27, 2019

    @eaftan

    Also, do we need @DefaultUnknown? That will be the default if no default annotation is provided, so I'm not sure why people would need to use it.

  2. kevinb9n commented on Jun 27, 2019

    @kevinb9n
    CollaboratorAuthor

    The use case for that is that you're able to bring 90% of a class up to date but one or two methods are giving you trouble (you can't figure out how to annotate them correctly or it will cause too much pain to do it yet). Or, if we support package or module annotation, and there's one or two classes you're not ready to deal with yet. We have a strong interest in those users being able to flip their default (so it catches new code) even when they're not ready to address those edge cases yet.

  3. donnerpeter commented on Jun 28, 2019

    @donnerpeter
    Collaborator

    I don't know of use cases for @DefaultNullable, it can be added when we find any. There's a precedent: Eclipse doesn't have nullable default while having a non-null one: https://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.jdt.doc.isv%2Freference%2Fapi%2Forg%2Feclipse%2Fjdt%2Fannotation%2Fpackage-summary.html

  4. kevinb9n commented on Oct 10, 2019

    @kevinb9n
    CollaboratorAuthor

    The current decision as documented in the draft spec is to provide all six annotations for conceptual simplicity and parallel structure. I personally think this is a fine decision and haven't heard strong opposition to it. Optimistically closing so it's easier for us to focus on the more pressing issues.

  5. cpovirk commented on Oct 10, 2019

    @cpovirk
    Collaborator

    I might be strongly opposed. But I'd have to think about it more: I've been pretty much assuming that we're leaving @DefaultNullable out. And that has simplified the number of cases and interactions we need to analyze. In other words, the very fact that I haven't had to think about this more is itself a giant benefit IMO.

  6. cpovirk commented on Oct 11, 2019

    @cpovirk
    Collaborator

    Thinking about this more, I think there's a decent chance that people will autocomplete @DefaultNullable accidentally (over @DefaultNotNull) often enough that that alone may make it provide net negative value.

    But beyond that, I think this ties into many of the same issues as including @NotNull does (like in this post). For both philosophical and technical reasons, I think that @DefaultNullable and @NotNull should probably live or die together. I'll include some points about @DefaultNullable when I make my last stand on @NotNull :)

  7. added
    nullness
    on Oct 25, 2019
  8. kevinb9n commented on Oct 31, 2019

    @kevinb9n
    CollaboratorAuthor

    It's been occurring to me more and more lately that it would be much easier for users to read code and understand nullness information correctly if they knew there were ONLY TWO possibilities: this is a file that's "in the club" (default not null applies) or this is a file that's "not in the club" (default nullness unspecified applies).

    So I am starting to understand the advantage of ditching @DefaultNullable in a way I strangely wasn't before.

  9. kevinb9n commented on Oct 31, 2019

    @kevinb9n
    CollaboratorAuthor

    Oh, and also: if this ever one day becomes a Java language feature, I would almost guarantee that that's how it would work: a file would either be modernized or legacy, no other possibility.

  10. cpovirk commented on Nov 25, 2019

    @cpovirk
    Collaborator

    How are people feeling nowadays about optimistically closing this issue and operating under the assumption that we'll leave @DefaultNullable out?

  11. kevinb9n commented on Nov 25, 2019

    @kevinb9n
    CollaboratorAuthor

    imho it would be very useful to do this. It will simplify our work to figure out things like defaults for type parameter bounds. Then if we want to propose reintroducing it in the future, we will have to fully consider how it interacts with all our prior decisions, but that is fine with me.

  12. added
    design
    on Mar 13, 2024
  13. added this to the 0.3 milestone on Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    designnullness

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions