-
-
Notifications
You must be signed in to change notification settings - Fork 358
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
refactor: remove CtParameterReferenceImpl#declaringExecutable #1875
refactor: remove CtParameterReferenceImpl#declaringExecutable #1875
Conversation
I agree that field But would it be possible to KEEP |
you're right. it's better for backward compatibility. done. |
Looks good to me. @monperrus are you done with this PR? Do you want to merge it soon (tomorrow morning) or should we wait for feedback of others here? |
API changes: 1 (Detected by Revapi) Old API: fr.inria.gforge.spoon:spoon-core:jar:6.2.0-20180221.155557-103 / New API: fr.inria.gforge.spoon:spoon-core:jar:6.2.0-SNAPSHOT
|
OK to merge.
|
By analyzing #1869, I realize that
CtParameterReference
andCtParameterReferenceImpl
are badly designed. The problem is thatCtParameterReference
is stateful with a superfluous pointer to an executable reference:getDeclaration()
, done with dynamic lookup, can become inconsistent with the result ofgetDeclaringExecutable()
getDeclaration()
, done with dynamic lookup is correct (see CtExecutableReference in cloned method should refer to the clone, not to the method being cloned. #1869 (comment)), yet inconsistent with the result ofgetDeclaringExecutable()
, which is not changed during cloning. This is one facet of the problem discussed in CtExecutableReference in cloned method should refer to the clone, not to the method being cloned. #1869.The solution presented here it to remove the
get/setDeclaringExecutable
from interfaceCtParameterReference
, and to remove the corresponding state in the implementation (fielddeclaringExecutable
).This fixes the three problems described above. There are a few test changes, which are minor, they were simply directly unit-testing
get/setDeclaringExecutable
.Once this one is merged, there will be other PRs for #1869.