-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Conversation
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 Report
@@ 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
Continue to review full report at Codecov.
|
9a4380f
to
5a2ceac
Compare
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).
5a2ceac
to
0012822
Compare
@smaldini yes, for now we can hide away these concerns, updated |
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
goesthrough
Scannable#from
first when callingscan
orscanOrDefaul
.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 areAttr<Object>
always returning the raw value from the operator (downcasted to Object).