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

Lang-1657: Diff Result Type Constraint #786

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

greatmastermario
Copy link
Contributor

  • Updated type parameter for DiffBuilder.append(String, DiffResult) to accept DiffResults of any type in case nested field is not the same type as the containing class
  • Added test case for nested Diffable types

@coveralls
Copy link

coveralls commented Aug 7, 2021

Coverage Status

Coverage increased (+0.006%) to 94.991% when pulling 24e8f73 on greatmastermario:LANG-1657-DiffResult-Type-Constraint into ce477d9 on apache:master.

@garydgregory
Copy link
Member

May you please rebase on master to pick up the recent Java 16 fix.

@codecov-commenter
Copy link

codecov-commenter commented Jul 16, 2022

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (4fc2ab4) 92.15% compared to head (5dd709c) 92.16%.
Report is 15 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #786      +/-   ##
============================================
+ Coverage     92.15%   92.16%   +0.01%     
- Complexity     7596     7597       +1     
============================================
  Files           200      200              
  Lines         15910    15910              
  Branches       2925     2925              
============================================
+ Hits          14662    14664       +2     
+ Misses          675      674       -1     
+ Partials        573      572       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Osdel
Copy link

Osdel commented Jul 16, 2023

@greatmastermario What happened to this pull request? This change is really needed. Having the DiffBuilder<T>.append() constraint on passing a DiffResult<T> is not ideal. Ideally you want to recursively call on nested attributes that implement the Diffable interface. I am not getting build errors but a lot of Uncheck warnings which are unpleasant.

@garydgregory
Copy link
Member

Looking...

@greatmastermario
Copy link
Contributor Author

greatmastermario commented Jul 16, 2023 via email

@garydgregory
Copy link
Member

garydgregory commented Jul 16, 2023

@greatmastermario
I'm having trouble applying the patch locally on master with git apply. Would you rebase on master, please?

@@ -495,4 +519,16 @@ public void testTriviallyEqualTestEnabled() {
assertThat(explicitTestAndEqual.build().getNumberOfDiffs(), equalToZero);
}

@Test
public void testNestedDiffable() {
Copy link
Member

Choose a reason for hiding this comment

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

This test needs to be different: It compiles just fine AND without warnings without the change to main. What am I missing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let me validate again, but this should not be passing. The generic type T in master (did it get renamed to main? I don't see that in the repo) makes it where the passed diff needs to be the same type as the original builder. Making it ? allows other types of DiffBuilders to be passed. If this is not the behavior in master, I can rewrite the test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

After checking out main/master and copy-pasting the test without the code fix, I am getting a compilation error due to the generic types, which is what was asked to be fixed in the original issue. The test cannot compile without the NestedTypeTestClass, so I am unsure why main would be working. Screenshot proof prior to the fix is attached.
DiffBuilderGenericCompileFailure

@greatmastermario
Copy link
Contributor Author

@greatmastermario I'm having trouble applying the patch locally on master with git apply. Would you rebase on master, please?

Hi Gary, I am trying to do a git rebase, but it's considering every change from the last two years a "merge conflict" and making me manually apply all the changes. Should I close this PR, recreate the branch, and open a new PR?

@garydgregory
Copy link
Member

No, please don't open and close PRs and create noise. Just Google on how to use git and you'll get there, but for now, see my comment #786 (comment)

If you can't figure out git, don't worry, and we will deal with the PR as it is.

@greatmastermario
Copy link
Contributor Author

greatmastermario commented Jul 17, 2023 via email

@garydgregory
Copy link
Member

@greatmastermario
Don't worry about git for now since GitHub does seem to see conflicts for a merge.

@greatmastermario greatmastermario force-pushed the LANG-1657-DiffResult-Type-Constraint branch from 8998881 to 5dd709c Compare November 29, 2023 05:31
@greatmastermario
Copy link
Contributor Author

@garydgregory Apologies for taking so long to get that rebase done. Finally have everything worked out with the rebase. Let me know if there are further changes required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants