Comments (7)
from jspecify.
I agree with @cpovirk . Ironically given how well IntelliJ does so many other things I have found it to be lacking on null analysis when it comes to generics and when I went code diving trying to figure out how it worked it appears to be far different than the others.
When I have run into this issue usually with Streams is that Checker is the only one that seems to get it consistently right but I'm haven't been using the reference checker lately.
Eclipse needs the type witness notation for some reason that I think Stephan explained to me in a chat room once. I will check with them after the holidays to find out why or what is the limitations.
Across my projects I plan on adding null analysis using each tool in my CI pipeline. I am currently missing IntelliJ (I just found out last year you can run its check stuff headless), and JSpecify reference checker. My hope is to somehow codify it into a Github action (one for maven and one for gradle... might not even just be put this Maven profile in your script etc) for library authors to quickly play with the various frameworks and to find inconsistencies.
from jspecify.
For most frameworks you need to use the type witness notation because it can't properly deduce from the left hand.
I did not test your case on IntelliJ but Eclipse null analysis will do the same thing.
To fix it you would do something like:
JsonDecoder.<Integer>field(....);
from jspecify.
That does not seem to work in this case
![image](https://private-user-images.githubusercontent.com/5004262/292689329-a097014f-dab6-4664-a467-452b4d2ccaf3.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTg4MTk2MTIsIm5iZiI6MTcxODgxOTMxMiwicGF0aCI6Ii81MDA0MjYyLzI5MjY4OTMyOS1hMDk3MDE0Zi1kYWI2LTQ2NjQtYTQ2Ny00NTJiNGQyY2NhZjMucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDYxOSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA2MTlUMTc0ODMyWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NWVlMzA0NmJkZDE4N2MzNGE2MzBjMjlkNDFiYjAyNTcxYjFkNjNiMGQyMGFlODEzZDJhNmRlM2VhY2VkNGZlZSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.mkM4RbyQ0cxjuNAja7nl3froo0t87oEJN9uDoPBdScU)
from jspecify.
Yes but intellij null analysis isnβt really type based last time I checked.
Eclipse and Checker are. Try those guys.
Check out this action I use that tests with both: https://github.com/jstachio/jstachio/actions/workflows/analyze.yml
from jspecify.
Your understanding of the meaning of the code looks correct to me, as well. I, too, would expect the Checker Framework and our reference checker to get this correct (though no guarantees :)), likely including without the explicit type argument. I haven't used Eclipse enough to predict how it would behave, but I would not be surprised to see it work, either.
While IntelliJ (IIRC) can understand generics in some case (e.g., Future<@Nullable String>.get()
, maybe?), this looks like a case I remember from testing IntelliJ on Guava: It's been a few years, but I think I was seeing T extends @Nullable Object
lead IntelilJ to treat all usages of T
as if they might be nullable, without regard to substitution.
The IntelliJ folks fixed some of the problems we reported with Guava. But given that Guava is a much heavier user of generics than the average project, they didn't try to deal with everything that came up frequently for us. (Not to mention that full handling of generics is quite a pain to implement.)
I'd encourage you to file an IntelliJ bug. Even if it doesn't get a quick fix, it should help to start establishing how often "real users" encounter some of the remaining issues in IntelliJ's support.
from jspecify.
Is this issue closeable now?
from jspecify.
Related Issues (20)
- No access to Java-concepts glossary HOT 2
- How to annotate `Collection.toArray(T[])` HOT 2
- Move module-info back to the main root? HOT 4
- `@ValueClass`, to prepare a class for Valhalla transition (also immediately useful) HOT 1
- Consider annotating `InvocationTargetException`, `ExecutionException`, and `CompletionException` causes as non-nullable HOT 8
- Take the Javadoc warning down a notch HOT 10
- Not possible to annotation a return enum @Nullable from a method HOT 1
- Document that we ignore `@Inherited`
- Give advice in docs about the "findViewById problem"
- Document how to declare that your JPMS module uses JSpecify HOT 11
- Figure out and document whether module-level `@NullMarked` helps users who don't declare a module HOT 13
- generic userdoc confusion HOT 7
- Document on how to add the jspecify dependency: Maven and Gradle HOT 7
- Document the nullness of special APIs on enum and annotation types HOT 4
- Stop checking in generated files for the website
- Re-justify or remove the discussion of `FluentIterable` in "the `ImmutableList.Builder` case" HOT 4
- Fix substitution rules for `NO_CHANGE`+`MINUS_NULL`
- Update User Guide for new annotations
- Document the package name in the User Guide and perhaps landing page HOT 5
- `@NonNull` vs. `? extends @Nullable` for `Optional`-returning methods HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jspecify.