-
Notifications
You must be signed in to change notification settings - Fork 295
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
Substitute type arguments when checking type parameter nullability at call site #1070
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1070 +/- ##
============================================
+ Coverage 87.87% 87.88% +0.01%
- Complexity 2210 2217 +7
============================================
Files 85 85
Lines 7190 7196 +6
Branches 1423 1427 +4
============================================
+ Hits 6318 6324 +6
Misses 438 438
Partials 434 434 ☔ View full report in Codecov by Sentry. |
if (tree instanceof MethodInvocationTree && methodSymbol.type instanceof Type.ForAll) { | ||
MethodInvocationTree methodInvocationTree = (MethodInvocationTree) tree; | ||
|
||
List<? extends Tree> typeArgumentTrees = methodInvocationTree.getTypeArguments(); | ||
com.sun.tools.javac.util.List<Type> explicitTypeArgs = convertTreesToTypes(typeArgumentTrees); | ||
|
||
Type.ForAll forAllType = (Type.ForAll) methodSymbol.type; | ||
Type.MethodType underlyingMethodType = (Type.MethodType) forAllType.qtype; | ||
invokedMethodType = | ||
state.getTypes().subst(underlyingMethodType, forAllType.tvars, explicitTypeArgs); | ||
} |
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.
This exact logic (or very similar) now appears in multiple places. Can we extract it into a method that returns a method type with the generic type arguments substituted in?
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.
LGTM!
void genericMethodAndVoidType()
in thejspecify/GenericMethodTests.java
file.