Skip to content
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, improve and document TemplateMatcher #1319

Merged
merged 3 commits into from
May 30, 2017

Conversation

pvojtechovsky
Copy link
Collaborator

@pvojtechovsky pvojtechovsky commented May 21, 2017

I am trying to understand how TemplateMatcher works and here are some

  • javadoc added - which helps me and others to understand it better
  • comments added about bugs - to plan future refactoring
  • refactoring (removed some useless calls of CtType#getReference, which is immediately followed by CtTypeReference#getDeclaringType

@monperrus please have a look at it, even if it is WiP. This PR is more like list of TODO topics for future PRs. Are my changes on good way?

@pvojtechovsky pvojtechovsky changed the title review: fix, improve and document TemplateMatcher WiP: fix, improve and document TemplateMatcher May 21, 2017
@pvojtechovsky pvojtechovsky force-pushed the fixTemplateMatcher branch 2 times, most recently from 1197f35 to c11cb5f Compare May 24, 2017 20:01
@pvojtechovsky pvojtechovsky changed the title WiP: fix, improve and document TemplateMatcher review: fix, improve and document TemplateMatcher May 25, 2017
@pvojtechovsky
Copy link
Collaborator Author

I am finished with commenting and few safe refactorings. I would like your feedback about correctness of comments (confirms that I understood the idea of that sometime buggy code). Does it makes sense to merge that PR then?

In the mean time I will try to make some test cases - in another PRs, which will reproduce the bugs ... and then may be fix them.

@monperrus
Copy link
Collaborator

I love commenting PRs, that's super good for long term maintenance.

However, it would be strange to merge all the "bug comments", and it would be ineffective to discuss them all here.

Would you remove the bug comments from this one so that we can review and merge the valuable explanations and refactorings first?

@pvojtechovsky
Copy link
Collaborator Author

I kept only few simple fixes and java doc without TODOs.
The TODOs and BUG markers were moved to new branch

* @param root CtClass model of {@link Template}
* @return List of all variables - only these parameters which are declared by {@link TemplateParameter}.
* It doesn't includes references to parameters annotated by {@link Parameter}
*/
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea of my comment was not "just describe what algorithm does" (like your comment), but it tried to describe the purpose of this method

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand. does it return a list of variables or parameters? or a list of invocations?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your new comment is absolutely correct, I just suggest to keep my comment too (in improved form), because it explains purpose of this method.
It is used like this:

public TemplateMatcher(CtElement templateRoot) {
  ...
  variables = getMethods(templateType)
  ...
}

so it returns template variables/parameters/substitution points (please give it correct name ;-) ) ... but as written on last javadoc line, they are not all, because variables/parameters/substitution points annotated by {@link Parameter} are not included in returned list

@monperrus
Copy link
Collaborator

monperrus commented May 29, 2017 via email

@pvojtechovsky
Copy link
Collaborator Author

Yes, I read this method carefully.
Do we speak about same thing? ;-)

@monperrus
Copy link
Collaborator

We probably don't speak about the same thing. Let's merge it as is?

@pvojtechovsky
Copy link
Collaborator Author

Yes, I agree to merge it

@monperrus monperrus merged commit 4a8ba5d into INRIA:master May 30, 2017
@pvojtechovsky pvojtechovsky deleted the fixTemplateMatcher branch May 30, 2017 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants