-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fixed MethodCallExprContext generic parameter issue. [NullType must not fail matchTypeParameters] #2939
Fixed MethodCallExprContext generic parameter issue. [NullType must not fail matchTypeParameters] #2939
Conversation
I don't understand what this PR is trying to solve. The test case below does not throw an exception. So what are you doing to meet your problem?
result is
|
Hi @jlerbsc
|
Hi @MysterAitch I think it's a correct patch in my opinion it can be merged. In this case null type could be assigned to Object type. JLS 5.2 assignment contexts says "a value of the null type (the null reference is the only such value) may be assigned to any reference type, resulting in a null reference of that type." |
@zcbbpo -- thank you for the PR!
I agree! :)
Good spot! 👍 I've just added a comment to directly cross-reference to the JLS.
@jlerbsc what did you have in mind? I've no objections to merging 👍 |
I'll merge this now and it can be improved upon separately |
…2654, javaparser#2959, javaparser#2948, javaparser#2949, javaparser#2950, javaparser#2955, javaparser#2957, javaparser#2942, javaparser#2958, javaparser#2927, javaparser#2930, javaparser#2931, javaparser#2938, javaparser#2945, javaparser#2947, javaparser#2952, javaparser#2956, javaparser#2954, javaparser#2939, javaparser#2961, javaparser#2966)
Hi ,
It's seem paser generic parameter will throws
java.lang.UnsupportedOperationException: com.github.javaparser.symbolsolver.model.typesystem.NullType
code:
I will modified
com.github.javaparser.symbolsolver.javaparsermodel.contexts.MethodCallExprContext#matchTypeParameters
And add
com.github.javaparser.symbolsolver.resolution.javaparser.contexts.MethodCallExprContextResolutionTest#testGenericParameter
for test.Please check it.