Bug 27310 - CompilationUnit#lineNumber(..) doc seems flawed
Summary: CompilationUnit#lineNumber(..) doc seems flawed
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.1 M4   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-11-28 08:58 EST by Rory Lucyshyn-Wright CLA
Modified: 2002-12-19 05:19 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.