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

Issue #4004 AssertionError from Range.gap. #4007

Closed
wants to merge 7 commits into from
Closed

Issue #4004 AssertionError from Range.gap. #4007

wants to merge 7 commits into from

Conversation

Koooooo-7
Copy link
Contributor

@Koooooo-7 Koooooo-7 commented Sep 5, 2020

Fix #4004, Got IAE instead of AssertionError.

@google-cla
Copy link

google-cla bot commented Sep 5, 2020

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@cpovirk
Copy link
Member

cpovirk commented Sep 6, 2020

Thanks. I suspect that what we'd prefer is to avoid calling describeAsLowerBound at all in this case. But I'd have to look at gap more to confirm (and to figure out what to do instead).

@Koooooo-7
Copy link
Contributor Author

Koooooo-7 commented Sep 6, 2020

I think the problem is the ranges contain each other(intersection), it is illegal for gap.
and I made an opposite case.

Range.atMost(3).gap(Range.atMost(2));
java.lang.AssertionError
	at com.google.common.collect.Cut$BelowAll.describeAsUpperBound(Cut.java:165)
	at com.google.common.collect.Range.toString(Range.java:677)
	at com.google.common.collect.Range.<init>(Range.java:358)
	at com.google.common.collect.Range.create(Range.java:156)
	at com.google.common.collect.Range.gap(Range.java:583)

so, I added the ranges check for the gap.
PTAL @cpovirk .

@cpovirk
Copy link
Member

cpovirk commented Sep 6, 2020

Sounds reasonable, thanks. Would you also:

  • Add your tests for the AssertionError cases

  • include the 2 input ranges in the exception message

@Koooooo-7
Copy link
Contributor Author

@cpovirk I added the test and the invalid ranges in the IAE message.

@cpovirk cpovirk self-assigned this Sep 12, 2020
@cpovirk cpovirk added P2 package=collect type=defect Bug, not working as expected labels Sep 12, 2020
@cpovirk cpovirk added this to the NEXT milestone Sep 12, 2020
@cpovirk
Copy link
Member

cpovirk commented Sep 12, 2020

Thanks. I got another set of eyes on this, and hopefully we'll get it submitted internally and merged out soon.

@kluever kluever mentioned this pull request Sep 17, 2020
kluever pushed a commit that referenced this pull request Sep 17, 2020
Fixes #4007, #4004

RELNOTES=n/a

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=332057751
kluever pushed a commit that referenced this pull request Sep 17, 2020
Fixes #4007, #4004

RELNOTES=n/a

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=332057751
@cpovirk cpovirk modified the milestones: NEXT, 30.0 Oct 16, 2020
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.

AssertionError from Range.gap
3 participants