Giter Site home page Giter Site logo

support models of generic types about nullaway HOT 2 OPEN

uber avatar uber commented on May 21, 2024
support models of generic types

from nullaway.

Comments (2)

msridhar avatar msridhar commented on May 21, 2024

Couple notes based on some initial tinkering:

  • We'll need to handle assignments, e.g., you can't assign a Pair<@Nullable String, String> to Pair<String, String> (with both @NonNull). Probably just want to support invariance.
  • Without inference, ergonomics will be a bit rough. E.g., if you write Pair<@Nullable String, String> p = new Pair<>(null, "hello"); I don't think javac's inference will tell us that the first type parameter for the new expression is @Nullable. Would be a bit unfortunate to have to write Pair<@Nullable String, String> p = new Pair<@Nullable String, String>(null, "hello"); but supporting inference could be a lot more work.

Overall I think adding basic support (even without inference) will be a moderate amount of work to get right.

from nullaway.

msridhar avatar msridhar commented on May 21, 2024

FWIW Error Prone has some support for generics and null checking now, implemented by @bennostein. See the inference code and this commit. Perhaps we could do something similar in NullAway? @lazaroclapp

from nullaway.

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.