-
-
Notifications
You must be signed in to change notification settings - Fork 349
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: fix object is not an template parameter implicitly #1461
Conversation
e13004b
to
6e02d22
Compare
@@ -727,64 +728,14 @@ public void substituteStringLiteral() throws Exception { | |||
public void substituteSubString() throws Exception { | |||
//contract: the substitution of substrings works on named elements and references too | |||
Launcher spoon = new Launcher(); | |||
spoon.addTemplateResource(new FileSystemFile("./src/test/java/spoon/test/template/testclasses/SubStringTemplate.java")); |
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'm not sure why you deleted all those lines in this test: the original contracts remain true, as SubstringTemplate contain a @Parameter
, no?
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.
It was not intentional! I probably based this PR on wrong branch. Old tests must remain. There is no reason to remove them. If you would like to have it fixed soon then fix it please somehow. I have only slow access to github web these days... so I can't do it.
This reverts commit ce7eb97.
Yes! Now the changes are exactly like it was intended at the beginning. Thank You Simon! It is ready for merge form my point of view. Just consider the original intention B is better then A and is good for all my personal uses. But may be C makes sense too. WDYT? |
IMHO it was the original intention, else why do most of the metamodel interfaces implements If I understand well, with your change we now have to specifically type a parameter as So in version C, it means if I need in my template to have an element of the metamodel as a field of the template, for decoupling my code or whatever, I'll have to be careful on the name I'm using because it'll be considered as a parameter... |
I think that spoon model elements extends TemplateParameter mainly because it should be possible to use their instance as value of such template parameter. But I am interested in Martin's answer too ;) |
Maybe we can merge this one and let @monperrus answers later on the historical history of template parameters, wdyt @pvojtechovsky ? |
I agree |
This template generated method with name
methXXXd
and it is of course wrong. This PR fixes this behavior.May be the origin idea of the author was that each field whose type is subtype of TemplateParameter is automatically a template parameter. If you think that this contract is correct then implement it in another PR. I will have no time to continue on this PR in near future, so please merge it as it is - with fix only.