Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Introduce a way to unwrap
RequestContext
s #4308Introduce a way to unwrap
RequestContext
s #4308Changes from 23 commits
0ae3cc8
652a16f
88faa43
0230f5f
c6dccec
c2a203d
0366c8e
a4da669
a5c51f9
aafa8f4
720a942
7c31e56
0d867c8
d623c2f
2dbabe9
e099f31
86a3871
259e64d
986662d
50aa23d
48d4c27
061c46b
3e6c62b
2dc4433
8998f91
32d7692
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
master
branch has been merged. Let's do the same work forunwrapAll()
. 😉There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean override the return type for
unwrapAll
?I thought it's difficult to do this with the current constraints provided by
Unwrappable
😅ref: #4338 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't we safely cast the return type to
RequestContext
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I guess I should've made my comment on the other PR clearer 😅
To be precise, as you said we can override the return type as
RequestContext
for objects that are "unwrappable".However, I'm unsure how the API should be designed for objects that wrap an
Unwrappable
(i.e. viaAbstractUnwrappable
)AbstractUnwrappable#unwrapAll
returns anObject
:In this case
AbstractUnwrappable#unwrapAll
returns an Object whereasRequestContext#unwrapAll
returns aRequestContext
, which causes a return type collision.e.g.
AbstractUnwrappable#unwrapAll
returns T:I'm not sure if there's type safe way to know the innermost type of a wrappable.
I guess it's not too late to modify to a type unsafe API though 😅
e.g.
ref: #4338 (comment)
Let me know if you have a better idea though 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error seems to happen in
RequestContextWrapper
. How about overriding the return type ofunwrapAll()
inRequestContextWrapper
?I don't see that we need to change the return type of
AbstractUnwrappable#unwrapAll
.The subtype of
AbstractUnwrappable
orUnwrappable
freely overrides the return type if necessary.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I think you're right. I guess we can override the return type for wrapper types only. Done!