Bug 14838 - Scrapbook editor: bad handling of // comment
Summary: Scrapbook editor: bad handling of // comment
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.0 M6   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-04-29 09:50 EDT by Matitiahu Allouche CLA
Modified: 2002-05-06 06:59 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matitiahu Allouche CLA 2002-04-29 09:50:08 EDT
Open a Scrapbook page.  Write any valid statement, add a // comment at the end 
of the line.  Example:
  System.out.println("example\n");  // this is a comment
Select the line from "System" to "comment", right click and Run.  You get a 
compile error saying 'Syntax error on token ";", "Unexpected End Of File" 
expected'.
If you replace the // comment by a /* */ comment, it compiles correctly.
If you include the newline at the end of the selected text (put the cursor to 
the left of "System", press Shift+End, press Shift+RightArrow), it also 
compiles correctly.  All the same, it is weird that including a comment in the 
selection causes a compilation error.
Comment 1 Darin Wright CLA 2002-04-29 17:38:56 EDT

*** This bug has been marked as a duplicate of 14626 ***
Comment 2 Darin Wright CLA 2002-04-29 17:39:28 EDT
Re-opened (thanks bugzilla, not a dup)
Comment 3 Jared Burns CLA 2002-05-01 12:01:35 EDT
This appears to be a problem in the JDT Core. We're passing the snippet in and
getting a call back to the acceptProblem() method.

I have a theory about what's happening here, but I don't know the JDT Core code
well enough to verify it. Could it be that we're generating source which looks
like this?
public void run() { <insert snippet> }

If so, the above test case would result in the following erroneous source:
public void run() { System.out.println("Foo"); //}
Comment 4 Olivier Thomann CLA 2002-05-02 11:31:18 EDT
You suspected well. Fixed and released in HEAD.
Comment 5 Matitiahu Allouche CLA 2002-05-05 17:10:22 EDT
I tried to verify the fix on build 20020502 under Win2k.  It is NOT working 
correctly.  Which build will get the fix incorporated?
Comment 6 Philipe Mulet CLA 2002-05-06 06:59:27 EDT
It is only going to be released into the next tuesday's integration build.