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

Add UUID.fromString() check to AlwaysThrows #3012

Closed
wants to merge 2 commits into from

Conversation

sixcorners
Copy link

@sixcorners sixcorners commented Feb 24, 2022

Fixes #3006

"import java.util.UUID;",
"class T { ",
" void f() {",
" // BUG: Diagnostic contains: will fail at runtime with a IllegalArgumentException",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be "an IllegalArgumentException"?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose it should, we could consider updating the logic that constructs the diagnostic to check for vowels as a follow-up

@kluever
Copy link
Member

kluever commented Apr 30, 2022

I'm confused...

UUID.fromString(...) only throws "...If name does not conform to the string representation as described in toString()"

@cushon
Copy link
Collaborator

cushon commented Sep 14, 2023

I think this addition LGTM

I'm confused...

UUID.fromString(...) only throws "...If name does not conform to the string representation as described in toString()"

Maybe the check could be better named, go/AlwaysThrows reports calls of APIs where the arguments are available at compile-time, and we can tell that the call will throw, e.g. it would report an error for UUID.fromString("nope").

@sixcorners
Copy link
Author

@cushon It looks like something like this was implemented in @graememorgan's changes that are linked on the issue I linked in the description of this PR. e81b5df

I'm going to close this. Thanks for looking at it though.

@sixcorners sixcorners closed this Sep 15, 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.

Add UUID check to AlwaysThrows?
3 participants