Bug 15334

Summary: ast: Message should have length
Product: [Eclipse Project] JDT Reporter: Adam Kiezun <akiezun>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: jeem
Version: 2.0   
Target Milestone: 2.0 M6   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Adam Kiezun CLA 2002-05-06 12:40:29 EDT
CompilationUnit::getMessages() returns Messages, which is a useful feature
however, to properly display the problems in the ui i need not only source 
position but also the length. 

Messages are created from IProblems - so it should be not a big problem
alternatively, they could have pointers to IProblems they originated from 
(which would be more flexible - it'd give me error codes).
Comment 1 Adam Kiezun CLA 2002-05-06 12:41:04 EDT
forgot to point directly to Olivier
Comment 2 Jim des Rivieres CLA 2002-05-06 13:00:00 EDT
I recommend adding Messages.length, and not exposing the underlying IProblems.
Comment 3 Olivier Thomann CLA 2002-05-06 13:06:17 EDT
We don't want to expose the fact that a compiler is running underneath. So we will simply add a 
getLength() method on the Message class. We might want to rename the getSourcePosition() to 
getStartPosition() to be more consistent with the ASTNode APIs. getLength() will have a meaning 
only if getSourcePosition() is different from -1.
Is this fine for you?
Comment 4 Adam Kiezun CLA 2002-05-06 13:15:45 EDT
yes, although removing the method altogether and introducing 
IProblem[] CompilationUnit::getProblems() would be much better
(IProblems are light-weight, don't hold on to any internal stuff, 
have more useful info and you have them anyway - and create Messages from them)

(and then you could simply remove that Message class that is merely a subset of 
IProblem)


but, like i said, getLength() on Message will do fine
renaming is ok too - please deprecate first
Comment 5 Olivier Thomann CLA 2002-05-07 10:36:23 EDT
Fixed and released in HEAD.