| Summary: | [refactoring] [extract method] The Extract Method refactoring fails when selection begins at the end of a comment | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Mohsen Vakilian <reprogrammer> | ||||
| Component: | UI | Assignee: | JDT-UI-Inbox <jdt-ui-inbox> | ||||
| Status: | CLOSED WONTFIX | QA Contact: | |||||
| Severity: | minor | ||||||
| Priority: | P5 | CC: | deepakazad, nchen, nicolas.bros, reprogrammer, snegara2 | ||||
| Version: | 3.8 | ||||||
| Target Milestone: | --- | ||||||
| Hardware: | PC | ||||||
| OS: | All | ||||||
| Whiteboard: | stalebug | ||||||
| Attachments: |
|
||||||
|
Description
Mohsen Vakilian
Created attachment 207819 [details] An example of a problem when the selection begins at the end of a line comment. The screenshot corresponds to the example described in <https://bugs.eclipse.org/bugs/show_bug.cgi?id=365372#c0>. A very rare scenario, and hence low priority. This doesn't seem so rare: I stumbled upon this issue a few times already.
For example, with this code:
private void abc() {
/**
* This is a javadoc comment
* <p>
* Inside a method.
*/
final String abc = "test";
System.out.println(abc);
}
I cannot extract the contents of the method into another method:
- if I select everything inside the method body, I get the error "The beginning of the selection contains characters that do not belong to a statement."
- if I select the last two lines from the method body (omitting the javadoc comment), I get "Not all selected statements are enclosed by the same parent statement."
These error messages make no sense in this context.
Granted, we're not supposed to put javadoc comments *inside* methods like this, but I did in my case because I wanted to add a long comment with paragraphs and get them formatted properly by the JDT formatter.
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. |