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 #895 Safer scan of ACTUAL and PARENT #896

Merged
merged 2 commits into from
Oct 18, 2017
Merged

fix #895 Safer scan of ACTUAL and PARENT #896

merged 2 commits into from
Oct 18, 2017

Conversation

simonbasle
Copy link
Member

This commit makes scanning of ACTUAL and PARENT safer by introducing a
safe converter in the Attr class. By default, no converter is defined
and the old behavior of force-casting is still used.

For the two attributes above however, the value from scanUnsafe goes
through Scannable#from first when calling scan or scanOrDefaul.
That way, even though a lot of operators blindly return something that
is Scannable in most case but not necessarily (e.g. a Publisher),
the outer scan will not fail.

Added companion RawAttr for ACTUAL and PARENT which are Attr<Object>
always returning the raw value from the operator (downcasted to Object).

@simonbasle simonbasle requested a review from smaldini October 6, 2017 14:11
@simonbasle simonbasle self-assigned this Oct 6, 2017
@simonbasle simonbasle added the type/enhancement A general enhancement label Oct 6, 2017
@simonbasle simonbasle added this to the 3.1.1.RELEASE milestone Oct 6, 2017
@simonbasle simonbasle added the type/bug A general bug label Oct 6, 2017
@smaldini
Copy link
Contributor

I wonder if we can just mask RawAttr and hide/remove isConversionSafe. Even tryConvert should be an internal concern for the attributes we manage wdyt ?

@codecov-io
Copy link

codecov-io commented Oct 17, 2017

Codecov Report

Merging #896 into master will increase coverage by 0.03%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #896      +/-   ##
============================================
+ Coverage     83.63%   83.66%   +0.03%     
- Complexity     3311     3313       +2     
============================================
  Files           323      323              
  Lines         26162    26171       +9     
  Branches       4854     4857       +3     
============================================
+ Hits          21881    21897      +16     
+ Misses         2821     2820       -1     
+ Partials       1460     1454       -6
Impacted Files Coverage Δ Complexity Δ
...tor-core/src/main/java/reactor/core/Scannable.java 94.87% <100%> (+0.66%) 18 <4> (ø) ⬇️
...ava/reactor/core/publisher/WorkQueueProcessor.java 69.49% <0%> (-1.7%) 19% <0%> (ø)
...c/main/java/reactor/core/publisher/FluxCreate.java 86.51% <0%> (+0.25%) 8% <0%> (ø) ⬇️
...rc/main/java/reactor/core/publisher/Operators.java 72.51% <0%> (+0.36%) 84% <0%> (ø) ⬇️
.../main/java/reactor/core/publisher/FluxFlatMap.java 94.77% <0%> (+0.4%) 13% <0%> (ø) ⬇️
...ava/reactor/core/publisher/EventLoopProcessor.java 78.68% <0%> (+1.09%) 50% <0%> (+2%) ⬆️
...va/reactor/core/publisher/ParallelMergeReduce.java 70.24% <0%> (+1.65%) 3% <0%> (ø) ⬇️
.../java/reactor/core/publisher/FluxLimitRequest.java 98% <0%> (+4%) 5% <0%> (ø) ⬇️

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 772c626...0012822. Read the comment docs.

This commit makes scanning of ACTUAL and PARENT safer by introducing a
safe converter in the Attr class. By default, no converter is defined
and the old behavior of force-casting is still used.

For the two attributes above however, the value from `scanUnsafe` goes
through `Scannable#from` first when calling `scan` or `scanOrDefaul`.
That way, even though a lot of operators blindly return something that
is Scannable _in most case but not necessarily_ (e.g. a Publisher),
the outer scan will not fail.

Added companion `RawAttr` for ACTUAL and PARENT which are `Attr<Object>`
always returning the raw value from the operator (downcasted to Object).
@simonbasle
Copy link
Member Author

@smaldini yes, for now we can hide away these concerns, updated

@simonbasle simonbasle merged commit 34e3b62 into master Oct 18, 2017
@simonbasle simonbasle deleted the 895-saferScan branch October 18, 2017 16:32
simonbasle added a commit that referenced this pull request Jul 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug A general bug type/enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants