-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
AutoFactory checkNotNull index in error message is 1-indexed, despite java being 0-indexed #1495
Comments
I went back and looked at the change that introduced these index numbers, and found this from @ronshapiro in the review comments: "I didn't include the actual parameter name for Proguard obfuscation reasons." (cl/126078797 for those who have access.) I wonder if we could do something similar to AutoValue, which has a At Google we have Anyway I think we could at least add text like "first argument is 1" to the message. |
Probably just saying "Argument number 1" rather than "Argument index 1" would be enough for the rewording? We often index from 0, but we don't usually number things from 0. [I'm trying not to be bothered by the wording of the rest of the message. The argument is null, but it's the parameter that is |
I think number 1 sounds great! I think that is a clever way to avoid
confusion
…On Sat, 29 Apr 2023 at 10:09, Éamonn McManus ***@***.***> wrote:
Probably just saying "Argument number 1" rather than "Argument index 1"
would be enough for the rewording? We often index from 0, but we don't
usually number things from 0.
[I'm trying not to be bothered by the wording of the rest of the message.
The argument is null, but it's the *parameter* that is @nullable.]
—
Reply to this email directly, view it on GitHub
<#1495 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAZYOLMLOOPA5JDMDTCENLXDRLZXANCNFSM6AAAAAAXOXGBT4>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
I think "number 1" is also probably a source of confusion, though possibly less. I vote for adding the start index/number is best. Or something like argument 1 of 7 |
I think its a good idea to include the total even if it just helps users
count back from the end sometimes. “1 of 7” sounds pretty clear to me
…On Sun, 30 Apr 2023 at 13:29, Ron Shapiro ***@***.***> wrote:
I think "number 1" is also probably a source of confusion, though possibly
less. I vote for adding the start index/number is best. Or something like
argument 1 of 7
—
Reply to this email directly, view it on GitHub
<#1495 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAZYOK5REBQXDIFNCHIZMLXDXMDBANCNFSM6AAAAAAXOXGBT4>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
"Argument index 1" could plausibly mean the second argument, but "Argument 1 of 3" is more obviously the first. It also makes it easier to count backwards from the end if there are a lot of arguments. Fixes #1495. RELNOTES=The exception message for a null value now indicates not only which number argument it is but also how many arguments there are in total. This may lead to a small increase in code size. PiperOrigin-RevId: 528020559
"Argument index 1" could plausibly mean the second argument, but "Argument 1 of 3" is more obviously the first. It also makes it easier to count backwards from the end if there are a lot of arguments. Fixes #1495. RELNOTES=The exception message for a null value now indicates not only which number argument it is but also how many arguments there are in total. This may lead to a small increase in code size. PiperOrigin-RevId: 528020559
AutoFactory gives an error message
I wasn't sure if this meant the first or second element, as java is 0-indexed. IndexOutOfBoundsException is 0-indexed. But in AutoFactory this turns out to be 1-indexed.
It's a bit confusing.
The problem starts here where we start the loop at 1:
auto/factory/src/main/java/com/google/auto/factory/processor/FactoryWriter.java
Line 162 in 75ef346
Options:
Thoughts?
The text was updated successfully, but these errors were encountered: