Bug 230230

Summary: [formatter] New comment formatter does not handle properly all scanner exceptions
Product: [Eclipse Project] JDT Reporter: Frederic Fusier <frederic_fusier>
Component: CoreAssignee: Frederic Fusier <frederic_fusier>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert, eric_jodet, jerome_lanneluc
Version: 3.4Flags: jerome_lanneluc: review+
Target Milestone: 3.4 RC1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Proposed patch none

Description Frederic Fusier CLA 2008-05-05 11:41:49 EDT
Using build 3.4M7

The new comment formatter does not format properly the following simple test case:
public class X {

void foo() {
    // 1EX5I8Z - accessing outer fields within a constructor call
}
}

The output currently is:
public class X10 {

    void foo() {
        // EX5I8Z - accessing outer fields within a constructor call
    }
}

Note that the '1' at the comment beginning has been removed.
Comment 1 Frederic Fusier CLA 2008-05-05 11:47:01 EDT
This is due to the fact that the Scribe scan the line using the Scanner getNextToken() method for optimization reason. The scanner raises an exception on the first word which is not properly handled while printing the comment line.

Currently only string and character exceptions are properly handled, but they all should be.
Comment 2 Frederic Fusier CLA 2008-05-05 12:05:37 EDT
Created attachment 98655 [details]
Proposed patch

Note that this patch also fixes following bugs bundle:
 - bug 229682
 - bug 229683
 - bug 229932
 - bug 229954
 - bug 230184
Comment 3 Frederic Fusier CLA 2008-05-05 12:09:04 EDT
With this patch, we got 5 failures in Eclipse 3.0 full source workspace and 21 in Ganymede M6a one.
Jerome can you please review?
Comment 4 Frederic Fusier CLA 2008-05-06 04:49:07 EDT
Released for 3.4RC1 in HEAD stream.
Comment 5 Eric Jodet CLA 2008-05-13 06:49:13 EDT
Verified for 3.4RC1 using build I20080510-2000.