-
-
Notifications
You must be signed in to change notification settings - Fork 351
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: ParentFunction #1153
Conversation
why don't you use |
I know several ways how to do it different/better. But I did not know what is the correct behavior from the spoon design point of view. So I waited for a feedback of an experienced spooner. |
If I correctly remember, we only created the CtRootPackage to "store" all elements of a model. It does not represent any Java concept. |
Isn't it the package of files without any package declaration? |
Yes, and also for the parent of declared packages. |
Thanks to everybody for good feedback. I modified the code and test so it expects that last visited parent element is CtModelImpl$CtRootPackage. |
Revapi Analysis resultsOld API: fr.inria.gforge.spoon:spoon-core:jar:5.6.0-20170130.234600-20 New API: fr.inria.gforge.spoon:spoon-core:jar:5.6.0-SNAPSHOT Detected changes: 0. |
Ok it seems good to me. |
Revapi Analysis resultsOld API: fr.inria.gforge.spoon:spoon-core:jar:5.6.0-20170131.234706-21 New API: fr.inria.gforge.spoon:spoon-core:jar:5.6.0-SNAPSHOT Detected changes: 0. |
Test revapi. |
Implements new mapping functions, which visits all the parents of current element.
It is needed by to LocalVariableScopeFunction to detect scope of local variable, by searching for a parent which matches some rules... will be used in next PR, which fixes LocalVariableScopeFunction for variables used in CtLoop expressions and CtTryWithResource.
Note: I have one question to the scanning of all parents. It is "Which parent is the top parent?"
If I visit parents until the getParent()==null, then I get to helper annonymous class based on CtElementImpl, which is declared in CtModelImpl$CtRootPackage$1. I guess it is not correct ... Your opinion please?
The test actually fails because the scanning does not end on RootPackage, but one level below...