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
Guava 23 edgeValueOrDefault
missing edge returns non-default value
#2924
Comments
Now that Guava is going to have more frequent releases and thus 23.2 is likely to be released before 24, I wonder if it would make sense to shift the milestone to 23.x. @cpovirk, do you have any thoughts on this? |
Thanks. Tentatively renamed to "NEXT." @ronshapiro @cgdecker may have more thoughts. |
(And I moved the 2 closed issues that were tagged 24.0 to a new 23.1 milestone, since they both made it into that release.) |
Somehow I completely failed to notice this issue previously; my apologies. The behavior of I'll get a fix out for that as soon as I can. |
Also fixed tests to guard against similar future regressions. (This fixes a regression that was introduced when we temporarily replaced this method with edgeValueOrNull() ([] and then failed to restore the original semantics when we restored the original method ([] Oops.) Ref: GitHub issue #2924 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=171145586
Fixed (see above commit). Thanks, @rocketraman. |
…y exercising both null and non-null default values. This addresses the most recent suggestion in GitHub issue #2924. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=171818169
In Guava 23...
Assume
nodeA
exists but #nodeU
does not exist. Execute:graph.edgeValueOrDefault(nodeA, nodeU, 5)
The result is
null
. I would expect the result to be5
, given that there is no edge betweennodeA
and non-existentnodeU
. Guava 22 an earlier have the expected behavior.I see that Guava 23 now returns an
Optional
foredgeValue
, so the statement can easily be converted tograph.edgeValue(nodeA, nodeU, 5).orElse(5)
, however if this is the intended behavior of theedgeValueOrDefault
method for this situation, it deserves some additional explanation in the Javadoc. Or simply deprecate this method and recommend people transition toedgeValue().orElse()
.The text was updated successfully, but these errors were encountered: