Bug 26454

Summary: DCR: IScanner.setSourceReader
Product: [Eclipse Project] JDT Reporter: Martin Aeschlimann <martinae>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: P3    
Version: 2.1   
Target Milestone: 2.1 M4   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Martin Aeschlimann CLA 2002-11-15 05:55:52 EST
20021114

The scanner is more and more used, e.g. to get a Javadoc comment of a method 
used in every hover window. 
To use the scanner, its input text (setSource(char[])) has to be set. This 
input text is very often the content of a compilation unit.

e.g.
  scanner.setSource(buf.getCharacters());

getCharacters results is a newly created array if the IBuffer of the 
ICompilationUnit has a gap.

We should avoid to create such temporary buffers if possible.
Couldn't the scanner also accept an reader or a construct that allows to access 
the input text by character index?
(e.g. ICharacterBuffer: char charAt(int index))

Another way would be to add a method
ToolFactory.createScanner(IBuffer buf, ....) so performance improvements can be 
done behind the scenes.
Comment 1 Philipe Mulet CLA 2002-11-15 13:12:30 EST
Scanner performance is achieved by using a char[]. Sending messages for every 
single character would be deadly.

Buffered reading would also cause grief to the implementation which is already 
complex.
Comment 2 Philipe Mulet CLA 2002-11-18 05:17:08 EST
Won't change.