Skip to content
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

Avoid wildcards, which confuse our nullness checker. #1126

Merged
merged 1 commit into from
Jun 30, 2021

Conversation

copybara-service[bot]
Copy link
Contributor

Avoid wildcards, which confuse our nullness checker.

Specifically, wildcards defeat our ability to recognize that containsKey guarantees that get will return non-null.

See https://github.com/jspecify/nullness-checker-for-checker-framework/blob/a13e6921d6e23ec1349be007b5e9a6d1f279c91c/src/main/java/com/google/jspecify/nullness/NullSpecTransfer.java#L603

Without this CL, Auto-Common would break when I submit CL 382342656 to annotate the remaining immutable-map classes.

Arguably we should have a specific issue open for this problem, but:

  • This may be the first time it's come up in practice.
  • Everything about wildcards in our checker is weird, thanks to a combination of the Checker Framework's unusual handling of them (which they are fixing by implementing capture conversion) and our hacks on top of that (which we hope can go away). (The very general project of "remove our hacks" is tracked by Upstreaming: Additional configuration for substitution jspecify/checker-framework#4 (comment) and other issues there.)

RELNOTES=n/a

@google-cla google-cla bot added the cla: yes label Jun 30, 2021
Specifically, wildcards defeat our ability to recognize that `containsKey` guarantees that `get` will return non-null.

See https://github.com/jspecify/nullness-checker-for-checker-framework/blob/a13e6921d6e23ec1349be007b5e9a6d1f279c91c/src/main/java/com/google/jspecify/nullness/NullSpecTransfer.java#L603

Without this CL, Auto-Common would break when I submit CL 382342656 to annotate the remaining immutable-map classes.

Arguably we should have a specific issue open for this problem, but:

- This may be the first time it's come up in practice.
- _Everything_ about wildcards in our checker is weird, thanks to a combination of the Checker Framework's unusual handling of them (which they are fixing by implementing capture conversion) and our hacks on top of that (which we hope can go away). (The very general project of "remove our hacks" is tracked by jspecify/checker-framework#4 (comment) and other issues there.)

RELNOTES=n/a
PiperOrigin-RevId: 382352859
@copybara-service copybara-service bot merged commit 3b1f449 into master Jun 30, 2021
@copybara-service copybara-service bot deleted the test_382351496 branch June 30, 2021 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant