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

fix: Bug in JDTCommentBuilder #2032

Merged
merged 4 commits into from
Jun 5, 2018
Merged

Conversation

Egor18
Copy link
Contributor

@Egor18 Egor18 commented Jun 4, 2018

Hi! I've found some funny bug in JDTCommentBuilder. Model building fails with the following exception:

spoon.SpoonException: Unexpected next line after last line
	at spoon.support.compiler.jdt.JDTCommentBuilder.cleanComment(JDTCommentBuilder.java:595)
	at spoon.support.compiler.jdt.JDTCommentBuilder.getCommentContent(JDTCommentBuilder.java:557)
	at spoon.support.compiler.jdt.JDTCommentBuilder.buildComment(JDTCommentBuilder.java:143)
	at spoon.support.compiler.jdt.JDTCommentBuilder.build(JDTCommentBuilder.java:108)

on this code:

class Test {
     /*/
     Hello!
     */
}

The problem is that */ from /*/ is considered as the end of the comment. This PR provides possible solution and some additional tests.


//*/

/*/*/
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you please move all these new comment examples above (to line >116). This test expects pairs of tested comment example and expected string content of the comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should I create a new file for them?

Copy link
Collaborator

Choose a reason for hiding this comment

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

new file

no, just move them up and add expected content of the comment text. For example:
convert this

/*/
slash and comment
*/

to

/*/
slash and comment
*/
"/\nslash and comment"

@pvojtechovsky pvojtechovsky merged commit e8c1c68 into INRIA:master Jun 5, 2018
@pvojtechovsky
Copy link
Collaborator

Thank You 👍

@Egor18 Egor18 deleted the fix_comment_builder branch June 5, 2018 21:21
@surli surli mentioned this pull request Jun 25, 2018
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