-
-
Notifications
You must be signed in to change notification settings - Fork 357
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
review1: fix generic type adapting #1275
Conversation
Revapi Analysis resultsOld API: fr.inria.gforge.spoon:spoon-core:jar:5.7.0-20170427.191244-62 New API: fr.inria.gforge.spoon:spoon-core:jar:5.7.0-SNAPSHOT Detected changes: 0. |
/** | ||
* Implements common adapting algorithm of {@link ClassTypingContext} and {@link MethodTypingContext} | ||
*/ | ||
abstract class AbstractTypingContext implements GenericTypeAdapter { |
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.
I like the package visibility
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.
yes, it was intentional. This class is internal
return typeParamRefAdapted; | ||
} | ||
|
||
protected abstract CtTypeReference<?> adaptTypeParameter(CtTypeParameter typeParam); |
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.
what's the contract of implementors?
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.
There is not expected that any client will implement this method, because all possible implementations ClassTypingContext and MethodTypingContext are already done.
I have added this comment
/**
* adapts `typeParam` to the {@link CtTypeReference}
* of scope of this {@link GenericTypeAdapter}
* In can be {@link CtTypeParameterReference} again - depending actual type arguments of this {@link GenericTypeAdapter}.
*
* @param typeParam to be resolved {@link CtTypeParameter}
* @return {@link CtTypeReference} or {@link CtTypeParameterReference} adapted to scope of this {@link GenericTypeAdapter}
* or null if `typeParam` cannot be adapted to target `scope`
*/
Revapi Analysis resultsOld API: fr.inria.gforge.spoon:spoon-core:jar:5.7.0-20170427.224507-63 New API: fr.inria.gforge.spoon:spoon-core:jar:5.7.0-SNAPSHOT Detected changes: 0. |
thanks Pavel |
Here are fixed other bugs found during implementing of CtMethod#isOverriding(CtMethod).
Following problems are tested and fixed by this PR:
List<List<T>>
is adapted toList<List<M>>
List<? extendsT>
is adapted toList<? extends M>
List<? extendsT>
does not fail with NullPointerException