-
-
Notifications
You must be signed in to change notification settings - Fork 352
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: feature: CtMethod#isOverriding(CtMethod) #1220
review1: feature: CtMethod#isOverriding(CtMethod) #1220
Conversation
ed17f5e
to
5d5fc3b
Compare
do we close this one? |
No. I think it makes sense to have |
5d5fc3b
to
47af98d
Compare
First commit comes from #1275. I will rebase after it is merged.
I think |
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: 1. Change 1
|
I agree
To be able to do analyses on calls on library methods (which are not in the source classpath). However, it's not relevant anymore because now that we create the spoon model of library classes as well through "shadow classes" (see
By simply delegating |
47af98d
to
23439b0
Compare
Revapi Analysis resultsOld API: fr.inria.gforge.spoon:spoon-core:jar:5.7.0-20170429.224534-66 New API: fr.inria.gforge.spoon:spoon-core:jar:5.7.0-SNAPSHOT Detected changes: 1. Change 1
|
If the tests pass then this PR is done from my point of view |
7e30b1c
to
4c201ba
Compare
Revapi Analysis resultsOld API: fr.inria.gforge.spoon:spoon-core:jar:5.7.0-20170430.224618-67 New API: fr.inria.gforge.spoon:spoon-core:jar:5.7.0-SNAPSHOT Detected changes: 1. Change 1
|
4c201ba
to
da41bd3
Compare
Revapi Analysis resultsOld API: fr.inria.gforge.spoon:spoon-core:jar:5.7.0-20170430.224618-67 New API: fr.inria.gforge.spoon:spoon-core:jar:5.7.0-SNAPSHOT Detected changes: 1. Change 1
|
c2d18af
to
33d568b
Compare
I removed |
Revapi Analysis resultsOld API: fr.inria.gforge.spoon:spoon-core:jar:5.7.0-20170430.224618-67 New API: fr.inria.gforge.spoon:spoon-core:jar:5.7.0-SNAPSHOT Detected changes: 1. Change 1
|
1 similar comment
Revapi Analysis resultsOld API: fr.inria.gforge.spoon:spoon-core:jar:5.7.0-20170430.224618-67 New API: fr.inria.gforge.spoon:spoon-core:jar:5.7.0-SNAPSHOT Detected changes: 1. Change 1
|
@@ -234,7 +234,8 @@ public boolean isConstructor() { | |||
@Override | |||
public boolean isOverriding(CtExecutableReference<?> executable) { | |||
CtExecutable<?> exec = executable.getDeclaration(); | |||
if (exec == null) { | |||
CtExecutable<?> thisExec = getDeclaration(); |
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.
why not getExecutableDeclaration
? (better, incl shadow classes)
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.
why? Because I used same approach like old code.
Anyway you are right. So I have replaced that on 3 places. Now it uses better getExecutableDeclaration
private void checkMethodOverride(BiFunction<CtMethod<?>, CtMethod<?>, Boolean> isOverriding) { | ||
Factory factory = ModelUtils.build(new File("src/test/java/spoon/test/method_overriding/testclasses").listFiles()); | ||
Map<String, List<CtMethod>> methodsByName = new HashMap<>(); | ||
factory.getModel().getRootPackage().filterChildren(new TypeFilter<>(CtMethod.class)).forEach((CtMethod m)->{ |
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.
need one assert to check that we go at least once through the loop
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.
done
8bf9f64
to
6a6cda1
Compare
Revapi Analysis resultsOld API: fr.inria.gforge.spoon:spoon-core:jar:5.7.0-20170503.161928-72 New API: fr.inria.gforge.spoon:spoon-core:jar:5.7.0-SNAPSHOT Detected changes: 1. Change 1
|
6a6cda1
to
62599d9
Compare
rebase? |
62599d9
to
f3a5d55
Compare
Revapi Analysis resultsOld API: fr.inria.gforge.spoon:spoon-core:jar:5.7.0-20170504.085207-75 New API: fr.inria.gforge.spoon:spoon-core:jar:5.7.0-SNAPSHOT Detected changes: 1. Change 1
|
Thanks Pavel. By the way, test method A simpler |
New API
CtMethod#isOverriding(CtMethod)
, which works better on generic methods, then legacyCtExecutableReference#isOverriding(CtExecutableReference)
This PR actually fails on wrong legacy implementation of
CtExecutableReference#isOverriding(CtExecutableReference)
I would like to discuss with you: "How to fix that legacy implementation?"
I did not understood:
CtExecutableReference#isOverriding
... I do not know how to replace that code withCtMethod#isOverriding
... because I do not understand that code yet...