Bug 60689 - AST on reconcile: AST without Javadoc comments created
Summary: AST on reconcile: AST without Javadoc comments created
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 critical (vote)
Target Milestone: 3.0 M9   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 56890 57144 58259 58685 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-05-01 16:59 EDT by Martin Aeschlimann CLA
Modified: 2005-01-31 04:57 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Aeschlimann CLA 2004-05-01 16:59:19 EDT
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;               
	}
}
Comment 1 Frederic Fusier CLA 2004-05-11 05:38:37 EDT
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
Comment 2 Frederic Fusier CLA 2004-05-11 06:31:21 EDT
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...
Comment 3 Frederic Fusier CLA 2004-05-11 07:39:46 EDT
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.
Comment 4 Martin Aeschlimann CLA 2004-05-11 15:19:25 EDT
*** Bug 56890 has been marked as a duplicate of this bug. ***
Comment 5 Martin Aeschlimann CLA 2004-05-13 05:15:45 EDT
*** Bug 58259 has been marked as a duplicate of this bug. ***
Comment 6 Martin Aeschlimann CLA 2004-05-13 13:44:00 EDT
*** Bug 58685 has been marked as a duplicate of this bug. ***
Comment 7 Olivier Thomann CLA 2004-05-18 12:36:07 EDT
Verified in 200405180816
Comment 8 Jerome Lanneluc CLA 2004-05-18 13:09:55 EDT
*** Bug 57144 has been marked as a duplicate of this bug. ***
Comment 9 Martin Aeschlimann CLA 2004-07-01 04:51:22 EDT
*** Bug 58685 has been marked as a duplicate of this bug. ***