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

(#1287) TextEnvelope is a real envelope #1458

Merged
merged 1 commit into from
Sep 13, 2020
Merged

Conversation

victornoel
Copy link
Collaborator

This is for #1287.

@codecov-commenter
Copy link

codecov-commenter commented Sep 13, 2020

Codecov Report

Merging #1458 into master will decrease coverage by 0.04%.
The diff coverage is 97.53%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1458      +/-   ##
============================================
- Coverage     89.49%   89.45%   -0.05%     
- Complexity     1644     1661      +17     
============================================
  Files           277      277              
  Lines          3970     3963       -7     
  Branches        210      209       -1     
============================================
- Hits           3553     3545       -8     
- Misses          385      386       +1     
  Partials         32       32              
Impacted Files Coverage Δ Complexity Δ
src/main/java/org/cactoos/text/Normalized.java 100.00% <ø> (ø) 2.00 <0.00> (-1.00)
src/main/java/org/cactoos/text/Sub.java 90.00% <77.77%> (ø) 8.00 <3.00> (ø)
src/main/java/org/cactoos/text/TextEnvelope.java 85.71% <80.00%> (-7.62%) 4.00 <3.00> (-5.00)
src/main/java/org/cactoos/text/TextOf.java 83.46% <95.65%> (+0.55%) 53.00 <14.00> (+8.00)
src/main/java/org/cactoos/text/Abbreviated.java 100.00% <100.00%> (ø) 6.00 <3.00> (ø)
src/main/java/org/cactoos/text/Base64Encoded.java 100.00% <100.00%> (ø) 2.00 <1.00> (ø)
src/main/java/org/cactoos/text/FormattedText.java 100.00% <100.00%> (ø) 9.00 <2.00> (+1.00)
src/main/java/org/cactoos/text/HexOf.java 100.00% <100.00%> (ø) 4.00 <3.00> (+2.00)
src/main/java/org/cactoos/text/Joined.java 100.00% <100.00%> (ø) 7.00 <3.00> (ø)
src/main/java/org/cactoos/text/Lowered.java 100.00% <100.00%> (ø) 3.00 <1.00> (ø)
... and 16 more

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 a3ed118...800fd3e. Read the comment docs.

@0crat
Copy link
Collaborator

0crat commented Sep 13, 2020

Job #1458 doesn't exist, can't set role

@victornoel
Copy link
Collaborator Author

@0crat in

src/main/java/org/cactoos/text/Synced.java Outdated Show resolved Hide resolved
public final int hashCode() {
return new Unchecked<>(this.origin).value().hashCode();
public final boolean equals(final Object obj) {
return this.origin.equals(obj);
Copy link
Contributor

Choose a reason for hiding this comment

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

@victornoel Wouldn't this definition of equals cause problems? The operation seems to loose symmetric properties.
For example
new TextEnvelope(x).equals(x) == true, but not necessarily x.equals(new TextEnvelope(x))

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@andreoss this is a known limitation of equals actually when an interface has many different implementations. This subject has been discussed many times in the EO community, i.e., what does method equals mean for objects (you can search for "equals" in cactoos issues for example).

My take on it is that if you start having multiple implementations of the same interface, then you can't just expect equals to rely on some internal state, and thus, when you implement it, you have to rely on the exposed behaviour of the interface.

In the case of Text, it means that all implementations of Text should rely on Text.asString to implement equals, so in that case, the symmetry will be conserved. It is the same for MapOf, IterableOf and the other collection-related classes for example. Also sometimes it's better not to implement equals at all (e.g., Iterator).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@andreoss see for example #1156 (comment) where I made the same kind of comment. Also I started a discussion on all that matter in #1241, don't hesitate to chime in.

@victornoel
Copy link
Collaborator Author

@0crat status

@0crat
Copy link
Collaborator

0crat commented Sep 13, 2020

@0crat status (here)

@victornoel This is what I know about this job in C63314D6Z, as in §32:

@victornoel
Copy link
Collaborator Author

@andreoss see my changes and answers

Copy link
Contributor

@andreoss andreoss left a comment

Choose a reason for hiding this comment

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

@victornoel Looks fine

@victornoel
Copy link
Collaborator Author

@rultor merge

@rultor
Copy link
Collaborator

rultor commented Sep 13, 2020

@rultor merge

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

@rultor rultor merged commit 47aff6e into yegor256:master Sep 13, 2020
@rultor
Copy link
Collaborator

rultor commented Sep 13, 2020

@rultor merge

@victornoel Done! FYI, the full log is here (took me 9min)

@0crat
Copy link
Collaborator

0crat commented Sep 13, 2020

Job was finished in 3 hours, bonus for fast delivery is possible (see §36)

@0crat
Copy link
Collaborator

0crat commented Sep 13, 2020

Job audit: performer @andreoss/z/z didn't make CR comments

@0crat 0crat removed the 0crat/scope label Sep 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants