Giter VIP home page Giter VIP logo

Comments (10)

eaftan avatar eaftan commented on July 27, 2024

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.

from jspecify.

kevinb9n avatar kevinb9n commented on July 27, 2024

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.

from jspecify.

donnerpeter avatar donnerpeter commented on July 27, 2024

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

from jspecify.

kevinb9n avatar kevinb9n commented on July 27, 2024

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.

from jspecify.

cpovirk avatar cpovirk commented on July 27, 2024

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.

from jspecify.

cpovirk avatar cpovirk commented on July 27, 2024

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 :)

from jspecify.

kevinb9n avatar kevinb9n commented on July 27, 2024

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.

from jspecify.

kevinb9n avatar kevinb9n commented on July 27, 2024

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.

from jspecify.

cpovirk avatar cpovirk commented on July 27, 2024

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

from jspecify.

kevinb9n avatar kevinb9n commented on July 27, 2024

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.

from jspecify.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.