-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SequencedCollection
was added in Java 21 and needs to be handled
#192
Comments
From the error message it looks to me like |
@cpovirk I can't reproduce the issue. In a clean directory, I did:
All test cases should pass. This uses the
I tried with/without Do these steps produce different output for you? |
I have one theory: you are not doing the above, but are instead using the rewritten JDK that contains the stub annotations directly. Could that be the case? |
Hmm, I can reproduce with the commands given above (specifically, the one without The JDK question is an interesting one. On the one hand, we're seeing the problem during our Bazel builds, which do use a rewritten JDK and which disable the stub files. On the other hand, I'm also seeing the problem with a direct use of the I do notice that the issue goes away if I change my class to extend Aha: It looks like I can reproduce with JDK 21 (or 22) but not with 11 or 17. |
Ah! I've been trying with JDK 11. I think the reason is the following: https://github.com/openjdk/jdk/blob/2f2223d7524c4405cc7ca6ab77da62016bbfa911/src/java.base/share/classes/java/util/List.java#L141 There is this additional interface That unmarked class causes So I think everything is working as it should and we need to find a way how to deal with |
NullMarked
not recognised in stub filesSequencedCollection
was added in Java 21 and needs to be handled
Ooo, nice find! That also explains some other errors, like those on our overrides of A reasonable Step 1 might be to add
So hopefully there would be no new problems, and then the question would become whether it solves the existing problem. My guess is that it in principle shouldn't but in practice it probably would: Since If our checkers did actually care about the missing Only after seeing your explanation do I see that the One thing that remains interesting is that we still see some other errors involving First, I see several errors like this in
And second, I see two errors like this in
Finally, I see an error in
Maybe we should create a separate issue for those (or two separate issues if you're confident that the |
Oh, and another thing that I wasn't even thinking about today was:
Even with the stray That would explain how all these issues could still be related: They might all be about overly strict checking of There still remains the additional problem that |
Yes, adding an annotated We see similar problems with Let me send you a PR for those, likely another PR for |
These stubs work around some problems we're seeing, and of course they may let us identify actual problems in user code. They appear to cause no problems in environments where the sequenced collections aren't yet present (e.g., under JDK 11). See jspecify/jspecify-reference-checker#192 (comment) and elsewhere in that thread. The files here are annotated copies of files from https://github.com/openjdk/jdk/tree/476d2ae69d6f67fdf9e2a9353f224141318690f2.
Thanks for looking into fixing this! Stub files for these newer APIs sound perfect. |
Still TODO:
|
These stubs work around some problems we're seeing, and of course they may let us identify actual problems in user code. They appear to cause no problems in environments where the sequenced collections aren't yet present (e.g., under JDK 11). See jspecify/jspecify-reference-checker#192 (comment) and elsewhere in that thread. The files here are annotated copies of files from https://github.com/openjdk/jdk/tree/476d2ae69d6f67fdf9e2a9353f224141318690f2.
I managed to notice that just before posting and then still not post it :)
Originally posted by @cpovirk in #178 (comment)
The text was updated successfully, but these errors were encountered: