Community
Participate
Working Groups
20040501 The AST on reconcile sometimes creates an AST that has no Javadoc comment nodes, even there should be. I found out that this is only the case when a reconcile is called on an unmodified file: 1. Set a breakpoint in the last statement (return) of AST.convertCompilationUnit(int, CompilationUnitDeclaration, char[], Map, IProgressMonitor) (line: 255) 2. In a file with the content attached enter a space, keep unsaved 3. The breakpoint is reached. You can see in the debugger that the AST that has been created with a Javadoc comment node 4. continue from the breakpoint, give focus on the editor again. The breakpoint is reached again (I will look at the reasons for this, it seems unnecessary to calculate an AST again as there was no change) Now the AST has no Javadoc comment node public class P { /** * Returns the length of the string representing the number of * indents in the given string <code>line</code>. Returns * <code>-1<code> if the line isn't prefixed with an indent of * the given number of indents. */ public static int computeIndentLength(String line, int numberOfIndents, int tabWidth) { return 0; } }
Fixed. Now the parser used by Compiler (see initializeParser()) will record comment (CommentRecorderParser instead of a simple Parser). It works on first round because that there was a parse using SourceElementParser which records comments. This parse before building AST hiearchy was due to file change... [jdt-core-internal] Change done in jdt.internal.compiler.Compiler.initializeParser() method. Test case added in ReconcilerTests
Reopen as fix is invalid. Applying it would imply that each compilation would store all comments. This was absolutely not necessary and would result to consume memory for nothing...
Fixed. Simply apply the change not in Compiler but in subclass CompilationUnitProblemFinder which is the caller while building DOM AST nodes hierarchy... Test case put back in ReconcilerTests.
*** Bug 56890 has been marked as a duplicate of this bug. ***
*** Bug 58259 has been marked as a duplicate of this bug. ***
*** Bug 58685 has been marked as a duplicate of this bug. ***
Verified in 200405180816
*** Bug 57144 has been marked as a duplicate of this bug. ***