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

(#1230) ListIteratorOf can be mutable and immutable, depending on origin #1231

Merged
merged 2 commits into from
Nov 12, 2019

Conversation

fanifieiev
Copy link
Contributor

This PR is for 1230
The ListIteratorOf should support mutability, if the origin supports

@0crat 0crat added the scope label Nov 9, 2019
@0crat
Copy link
Collaborator

0crat commented Nov 9, 2019

Job #1231 is now in scope, role is REV

@codecov-io
Copy link

codecov-io commented Nov 9, 2019

Codecov Report

Merging #1231 into master will increase coverage by 0.18%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1231      +/-   ##
============================================
+ Coverage     89.19%   89.37%   +0.18%     
- Complexity     1668     1671       +3     
============================================
  Files           280      280              
  Lines          4006     4009       +3     
  Branches        213      213              
============================================
+ Hits           3573     3583      +10     
+ Misses          399      392       -7     
  Partials         34       34
Impacted Files Coverage Δ Complexity Δ
src/main/java/org/cactoos/list/ListIteratorOf.java 95.23% <100%> (+0.79%) 12 <3> (ø) ⬇️
src/main/java/org/cactoos/scalar/Solid.java 90% <0%> (-10%) 3% <0%> (-1%)
...ain/java/org/cactoos/list/ListIteratorNoNulls.java 85.71% <0%> (+38.09%) 9% <0%> (+4%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2136d9d...9a4929c. Read the comment docs.

@0crat
Copy link
Collaborator

0crat commented Nov 9, 2019

This pull request #1231 is assigned to @victornoel/z, here is why; the budget is 15 minutes, see §4; please, read §27 and when you decide to accept the changes, inform @paulodamaso/z (the architect) right in this ticket; if you decide that this PR should not be accepted ever, also inform the architect; this blog post will help you understand what is expected from a code reviewer; there will be no monetary reward for this job

Copy link
Collaborator

@victornoel victornoel left a comment

Choose a reason for hiding this comment

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

@fanifieiev @paulodamaso I question the very existence of ListOteratorOf, it does nothing except wrapping a ListIterator: either we should remove it or we can rename it ListIteratorEnvelope and make it abstract. The later could make sense I believe. Please decide @paulodamaso.

new Assertion<>(
"List iterator returns incorrect previous index",
"List Iterator must return previous index",
Copy link
Collaborator

Choose a reason for hiding this comment

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

@fanifieiev why is ListIteratorOf tested in ListEnvelopeTest? I think those tests should be in their own file (and removed from here).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@victornoel I agree with your concern, I just left them where they were previously.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@fanifieiev so please move them in their own file to properly identify what is being tested

@@ -167,7 +166,6 @@ public void removeThrowsErrorForImmutableListIterator() {
return 0;
},
new Throws<>(
"Iterator is read-only and doesn't allow removing items",
Copy link
Collaborator

Choose a reason for hiding this comment

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

@fanifieiev why remove those parts of the tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@victornoel If you look at the test and the following stacktrace, you can see that the exception is thrown by the collection returned by Collections.unmodifiableList, that is why it throws exception with no message.
image

Copy link
Collaborator

Choose a reason for hiding this comment

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

@fanifieiev I better understand, thank you, but why is ListIteratorNoNulls based on an immutable version of ListIterator? I think that it is coherent we the changes we are making that ListIteratorNoNulls is to be only concerned with nulls, not with mutability. Please fix it or add a todo to continue the work.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@victornoel I did not catch your concern. The ListIteratorOf I changed is not based on the immutable version of ListIterator.
Could you provide details regarding you concern?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm talking about ListIteratorNoNulls: those tests on which we are currently commenting seem to validate that it is immutable but I don't think it is in the spirit of the changes that are being done to the ListIterator type hierarchy in this PR: either change ListIteratorNoNulls to be coherent with the changes you are currently making, or add a todo in order for someone to do it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@fanifieiev I think we spent enough time on this PR, please add todos and let ARC validate them by merging.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@fanifieiev one todo is enough, no need to multiplicate them btw :)

Copy link
Contributor Author

@fanifieiev fanifieiev Nov 11, 2019

Choose a reason for hiding this comment

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

@victornoel There is one thing that concerns me.
Let's say we will make those mentioned classes mutable. Let's take Sorted as an example:
List<Integer> sorted = new Sorted<>(2, 1, 0, 5);
Sorted list is now sorted.
Let's add one more element:
sorted.add(1);
Sorted list is not sorted anymore.
You got the idea of my concern?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@fanifieiev that's why you should leave a todo and let the next job performer think about this problem. Maybe we will conclude that Sorted can't be mutable, but that's out of scope of the present issue. Personally I believe the real problem is that it's not relevant to decorate collection to sort them, but that's only my opinion ;) Also, nothing prevent to implement Sorted using a Java ordered list and implement insertion in a sorted manner.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@victornoel Ok, I have just pushed one more commit with 'todo'. Please have a look.

@fanifieiev
Copy link
Contributor Author

@fanifieiev @paulodamaso I question the very existence of ListOteratorOf, it does nothing except wrapping a ListIterator: either we should remove it or we can rename it ListIteratorEnvelope and make it abstract. The later could make sense I believe. Please decide @paulodamaso.

@victornoel I would keep it as an abstract class ONLY if we really need it, otherwise would remove.

@victornoel
Copy link
Collaborator

@paulodamaso it's good on my side, please take a look and as the above discussion as well and to my previous comment too.

@paulodamaso
Copy link
Contributor

@victornoel @fanifieiev It's good, thank you.

@paulodamaso
Copy link
Contributor

@rultor merge

@rultor
Copy link
Collaborator

rultor commented Nov 12, 2019

@rultor merge

@paulodamaso OK, I'll try to merge now. You can check the progress of the merge here

@rultor rultor merged commit 9a4929c into yegor256:master Nov 12, 2019
@rultor
Copy link
Collaborator

rultor commented Nov 12, 2019

@rultor merge

@paulodamaso Done! FYI, the full log is here (took me 12min)

@0crat
Copy link
Collaborator

0crat commented Nov 12, 2019

@sereshqua/z please review this job completed by @victornoel/z, as in §30; the job will be fully closed and all payments will be made when the quality review is completed

@0crat 0crat removed the scope label Nov 12, 2019
@0crat
Copy link
Collaborator

0crat commented Nov 12, 2019

The job #1231 is now out of scope

@0crat
Copy link
Collaborator

0crat commented Nov 12, 2019

Payment to ARC for a closed pull request, as in §28: +10 point(s) just awarded to @paulodamaso/z

@sereshqua
Copy link

@victornoel please make sure you would try to find at least 3 issues during next CR, thanks

@victornoel
Copy link
Collaborator

@sereshqua well actually I did if you take the global review comment into account :)

@sereshqua
Copy link

@victornoel good point, Policy does not give clear instruction and its treatment can be subjective;

from one point there are 3 comments: 1 global and 2 exact (pointing the code out),
from another point: should the global comment be taken into account at all or not?

@victornoel
Copy link
Collaborator

@sereshqua hehe, do as you see fit, it's not very important in the end, typically there is no ambiguities :)

@sereshqua
Copy link

@victornoel sure, previously i was counting only comments that were pointing out the code, so I would keep my qa verdicts consistent

@sereshqua
Copy link

@0crat quality acceptable

@0crat
Copy link
Collaborator

0crat commented Nov 12, 2019

Order was finished, quality is "acceptable": +15 point(s) just awarded to @victornoel/z

@0crat
Copy link
Collaborator

0crat commented Nov 12, 2019

Quality review completed: +4 point(s) just awarded to @sereshqua/z

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

Successfully merging this pull request may close these issues.

8 participants