Community
Participate
Working Groups
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.
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.
Won't change.