Community
Participate
Working Groups
Build 20020305 In this example Inner inner= /*]*/new Inner()/*[*/; the class instance creation node contains the leading comment. Since it is an expression and ends at ) the comment should not be included. It should be included in the parent node that forms the statement. What is the overall strategy to trailing comments and expressions
Are you talking about the trailing or the leading comment? I am confused between the title of the message and your notes above. Right now we didn't define yet how to handle trailing and leading comment. It might be a good idea to do it now.
Sorry my fault. I am talking about the trailing comment
So what is the general behavior that we want for the trailing comment? Never included? This PR won't be fixed until I exactly know what to do about trailing comments.
In general, both leading and trailing comments should always be omitted. The source range for a node should extend from the first character of the first non-comment, non-whitespace token through the last character of the last non-comment, non-whitespace token corresponding to that construct. This range would allow the client to do consistent highlighting and character range replacements. The only exceptions should be: - Javadoc comments for class, interface, field, method, and constructor declarations. These should be included in the source range for the major declaration; the source range for the declaration should begin with the first character of the opening "/**". - (debatable) one or more comments immediately preceding a statement
This can be expensive. Removing trailing and leading comment in an expression means that for all expression I have scan again its source in order to set the proper positions.
I found the problem only for message sends and allocation expression. Fixed and released in HEAD.