-
-
Notifications
You must be signed in to change notification settings - Fork 346
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
review: feature LambdaFilter #1315
Conversation
* Allows to search for lambdas implemented by different interfaces. | ||
* @param typeInfo interface whose lambda implementations it is searching for | ||
*/ | ||
public LambdaFilter addImplementingInterface(CtTypeInformation typeInfo) { |
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.
not tested
if (typeInfo instanceof CtType) { | ||
if (typeInfo instanceof CtInterface) { | ||
qualifiedNamesOfInterfaces.add(typeInfo.getQualifiedName()); | ||
} //else ignore that request, because lambda can implement only interfaces |
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.
silent ignore is hard to debug. throwing an exception is better?
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 already had exception there, but I learned that there exists CtExecutionReferences whose parent is NOT CtInvocation. So I have to ignore them - it is not a bug. It is part of that algorithm.
public void testLambdaFilter() throws Exception { | ||
List<String> methodNames = foo.filterChildren(new LambdaFilter((CtInterface<?>) foo.getNestedType("CheckPerson"))).map((CtLambda l)->l.getParent(CtMethod.class).getSimpleName()).list(); | ||
assertHasStrings(methodNames); | ||
methodNames = foo.filterChildren(new LambdaFilter((CtInterface<?>) foo.getNestedType("Check"))).map((CtLambda l)->l.getParent(CtMethod.class).getSimpleName()).list(); |
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.
let's try to use and hence specify the three different constructors?
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 do not understand. Please explain your question/suggestion.
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.
Only one constructor is tested
I understand ... working on it
Only one constructor is tested
|
aef373e
to
5565cf7
Compare
This is finished from my point of view. |
thanks. 100% coverage for this new class :-) https://coveralls.io/builds/11621620/source?filename=src%2Fmain%2Fjava%2Fspoon%2Freflect%2Fvisitor%2Ffilter%2FLambdaFilter.java |
You are welcome ;-) |
This Filter matches all CtLambdas which are implementing one of defined interfaces.
It will be used by #1291 to found all lambdas of all methods with same signature.