Bug 27310

Summary: CompilationUnit#lineNumber(..) doc seems flawed
Product: [Eclipse Project] JDT Reporter: Rory Lucyshyn-Wright <Rory_Lucyshyn-Wright>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 2.1   
Target Milestone: 2.1 M4   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Rory Lucyshyn-Wright CLA 2002-11-28 08:58:45 EST
The javadoc comment for this method says the following:

"For example, the source string <code>class A\n{\n}</code> has 3 lines 
corresponding to inclusive character ranges [0,8], [8,9], and [10,10]."

There appears to be something wrong here.  For instance, it seems to say that 
character 8 lies is part of both line 1 and line two.

Guessing at what the behaviour might be, the ranges might rightly be ([0,7], 
[8,9], [10,10]).
Comment 1 Olivier Thomann CLA 2002-11-29 11:40:02 EST
I think the correct answer is: [0,7] [9,9] [10, 10].
If you agree with this, it can easily be fixed. This is clearly a bug in the doc
and not in the implementation.
Comment 2 Rory Lucyshyn-Wright CLA 2002-11-29 11:51:22 EST
... where's character #8 ? ...
Comment 3 Olivier Thomann CLA 2002-11-29 15:56:17 EST
Sorry it is:
I think the correct answer is: [0,6] [8,8] [10, 10].
Comment 4 Olivier Thomann CLA 2002-11-29 15:59:27 EST
Forget my previous answer.
You are right. The right answer is:
[0,7], [8,9], [10,10]
The line breaks are part of the previous line. So I will update the doc with
these values.
Comment 5 Olivier Thomann CLA 2002-11-29 15:59:41 EST
Released in 2.1 stream.
Comment 6 Olivier Thomann CLA 2002-11-29 16:00:07 EST
Change milestone.
Comment 7 David Audel CLA 2002-12-19 05:19:35 EST
Verified.