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

Fix GetBuilder and ScanBuilder #2352

Merged
merged 3 commits into from
Nov 26, 2024
Merged

Fix GetBuilder and ScanBuilder #2352

merged 3 commits into from
Nov 26, 2024

Conversation

jnmt
Copy link
Contributor

@jnmt jnmt commented Nov 25, 2024

Description

This PR fixes bugs in GetBuilder and ScanBuilder, which wrongly enable where() to continue with “and” in the disjunctive normal form context and for “or” vice vasa. They were due to incorrect inheritance.

// The following patterns should not be accepted.
Scan newScan = Scan.newBuilder(scan).where(andConditionSet).and(orConditionSet).build();
Scan newScan = Scan.newBuilder(scan).where(orConditionSet).or(andConditionSet).build();
// They should be the following.
Scan newScan = Scan.newBuilder(scan).where(orConditionSet).and(orConditionSet).build();
Scan newScan = Scan.newBuilder(scan).where(andConditionSet).or(andConditionSet).build();

Related issues and/or PRs

The bugs were introduced in the following PRs.

So, the ScanBuilder fix should be included in the minor versions >= 3.10, I think.

Changes made

  • Change superclass not to inherit wrong interfaces.

Checklist

  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation to reflect the changes.
  • Any remaining open issues linked to this PR are documented and up-to-date (Jira, GitHub, etc.).
  • Tests (unit, integration, etc.) have been added for the changes. Unsupported APIs cannot be tested in CI, but I confirmed the APIs are not shown as the candidates in IntelliJ.
  • My changes generate no new warnings.
  • Any dependent changes in other PRs have been merged and published.

Additional notes (optional)

N/A

Release notes

Fixed bugs in GetBuilder and ScanBuilder.

@jnmt jnmt self-assigned this Nov 25, 2024
@jnmt jnmt added the bugfix label Nov 25, 2024
@@ -1078,7 +1068,7 @@ public BuildableGetFromExistingWithOngoingWhereOr or(AndConditionSet andConditio
}

public static class BuildableGetFromExistingWithOngoingWhereOr
extends BuildableGetFromExistingWithOngoingWhere
extends BuildableGetFromExistingWithWhere
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, BuildableGetFromExistingWithOngoingWhere implements both And<BuildableGetFromExistingWithOngoingWhereAnd> and Or<BuildableGetFromExistingWithOngoingWhereOr>...

I hope Java code analysis or something detects duplicated implementation (in this case, both BuildableGetFromExistingWithOngoingWhereOr and BuildableGetFromExistingWithOngoingWhere implement Or<BuildableGetFromExistingWithOngoingWhereOr>) to notice something.

Copy link
Contributor

@komamitsu komamitsu left a comment

Choose a reason for hiding this comment

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

LGTM! 👍

Copy link
Collaborator

@brfrn169 brfrn169 left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you!

I checked this in my local env and it worked correctly. Thanks!

Copy link
Contributor

@Torch3333 Torch3333 left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

Copy link
Contributor

@feeblefakie feeblefakie left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you!

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.

5 participants