Skip to content

Write extends @NonNull Object instead of extends Object.#17

Closed
cpovirk wants to merge 1 commit intoeisop:masterfrom
cpovirk:explicit-bound-for-3030
Closed

Write extends @NonNull Object instead of extends Object.#17
cpovirk wants to merge 1 commit intoeisop:masterfrom
cpovirk:explicit-bound-for-3030

Conversation

@cpovirk
Copy link
Copy Markdown
Contributor

@cpovirk cpovirk commented May 20, 2022

The simpler formulation doesn't work in stub files, even in JDK stubs.
(This is typetools bug number 3030.)

I tested against a file with the call:

java.util.List.of("", null);

The simpler formulation doesn't work in stub files, even in JDK stubs.
(This is typetools bug number 3030.)

I tested against a file with the call:

```
java.util.List.of("", null);
```
@wmdietl
Copy link
Copy Markdown
Member

wmdietl commented May 26, 2022

Thanks for making this suggestion!

At first I was confused, b/c typetools 3030 sounds like using "T extends Object" in the annotated JDK works as expected. Then I remembered that nowadays this JDK is in the end loaded as stub files in the Checker Framework.

I didn't see any documentation that issue 3030 is the intended behavior and I would like to avoid having to explicitly write the NonNull bounds - which is particularly confusing here, as the source and stub file behavior is different.

So I tried fixing 3030 in eisop/checker-framework#247
If that fix works, I would prefer closing this PR without merging.

I also tested the List.of example with 247 and do get the expected error.

@cpovirk Please let me know in 247 if you see anything odd or if there is some documentation in the manual that should be updated.

@wmdietl
Copy link
Copy Markdown
Member

wmdietl commented May 26, 2022

I've merged eisop/checker-framework#247.
Please close this PR or report any remaining issues.

@cpovirk
Copy link
Copy Markdown
Contributor Author

cpovirk commented May 27, 2022

Thanks! I can't think of anything to document or anything else to do. I'll let you know if this finds anything fun when we upgrade to the June release :)

@cpovirk cpovirk closed this May 27, 2022
@cpovirk
Copy link
Copy Markdown
Contributor Author

cpovirk commented Aug 29, 2022

Update: The combination of eisop/checker-framework#247 and #16 is definitely turning some things up :)

@wmdietl
Copy link
Copy Markdown
Member

wmdietl commented Sep 1, 2022

@cpovirk "turning things up" in a good way or that we should re-open this PR?

@cpovirk
Copy link
Copy Markdown
Contributor Author

cpovirk commented Sep 1, 2022

Oh, sorry :) In a good way -- catching declarations that would have permitted NPEs.

cpovirk added a commit to cpovirk/jdk that referenced this pull request Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants