View | Details | Raw Unified | Return to bug 100041 | Differences between
and this patch

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java (-2 / +6 lines)
Lines 863-873 Link Here
863
			
863
			
864
	if (this.modifiersSourceStart < 0) this.modifiersSourceStart = this.scanner.startPosition;
864
	if (this.modifiersSourceStart < 0) this.modifiersSourceStart = this.scanner.startPosition;
865
}
865
}
866
public void flushComments() {
867
	this.scanner.commentPtr = -1;
868
}
866
public void checkComment() {
869
public void checkComment() {
867
870
868
	// discard obsolete comments while inside methods or fields initializer (see bug 74369)
871
	// discard obsolete comments while inside methods or fields initializer (see bug 74369)
869
	if (!(this.diet && this.dietInt==0) && this.scanner.commentPtr >= 0) {
872
	if (this.nestedMethod[this.nestedType] != 0 && this.scanner.commentPtr >= 0) {
870
		flushCommentsDefinedPriorTo(this.endStatementPosition);
873
		flushComments();
874
		return;
871
	}
875
	}
872
	
876
	
873
	int lastComment = this.scanner.commentPtr;
877
	int lastComment = this.scanner.commentPtr;
(-)model/org/eclipse/jdt/internal/compiler/DocumentElementParser.java (+5 lines)
Lines 73-78 Link Here
73
 */
73
 */
74
public void checkComment() {
74
public void checkComment() {
75
75
76
	// discard obsolete comments while inside methods or fields initializer (see bug 74369)
77
	if (this.nestedMethod[this.nestedType] != 0 && this.scanner.commentPtr >= 0) {
78
		flushComments();
79
		return;
80
	}
76
	/* persisting javadoc positions */
81
	/* persisting javadoc positions */
77
	pushOnIntArrayStack(this.getJavaDocPositions());
82
	pushOnIntArrayStack(this.getJavaDocPositions());
78
	boolean deprecated = false;
83
	boolean deprecated = false;
(-)model/org/eclipse/jdt/internal/compiler/SourceElementParser.java (-3 / +3 lines)
Lines 112-122 Link Here
112
		this.localDeclarationVisitor = new LocalDeclarationVisitor();
112
		this.localDeclarationVisitor = new LocalDeclarationVisitor();
113
	}
113
	}
114
}
114
}
115
116
public void checkComment() {
115
public void checkComment() {
117
	// discard obsolete comments while inside methods or fields initializer (see bug 74369)
116
	// discard obsolete comments while inside methods or fields initializer (see bug 74369)
118
	if (!(this.diet && this.dietInt==0) && this.scanner.commentPtr >= 0) {
117
	if (this.nestedMethod[this.nestedType] != 0 && this.scanner.commentPtr >= 0) {
119
		flushCommentsDefinedPriorTo(this.endStatementPosition);
118
		flushComments();
119
		return;
120
	}
120
	}
121
	
121
	
122
	int lastComment = this.scanner.commentPtr;
122
	int lastComment = this.scanner.commentPtr;
(-)model/org/eclipse/jdt/internal/core/util/CommentRecorderParser.java (-3 / +9 lines)
Lines 42-49 Link Here
42
	public void checkComment() {
42
	public void checkComment() {
43
43
44
		// discard obsolete comments while inside methods or fields initializer (see bug 74369)
44
		// discard obsolete comments while inside methods or fields initializer (see bug 74369)
45
		if (!(this.diet && this.dietInt==0) && this.scanner.commentPtr >= 0) {
45
		if (this.nestedMethod[this.nestedType] != 0 && this.scanner.commentPtr >= 0) {
46
			flushCommentsDefinedPriorTo(this.endStatementPosition);
46
			flushComments();
47
			return;
47
		}
48
		}
48
		boolean deprecated = false;
49
		boolean deprecated = false;
49
		boolean checkDeprecated = false;
50
		boolean checkDeprecated = false;
Lines 141-147 Link Here
141
		}
142
		}
142
		return unit;
143
		return unit;
143
	}
144
	}
144
145
	public void flushComments() {
146
		final int lastCommentIndex = this.scanner.commentPtr;
147
		if (lastCommentIndex < 0) return; // no comment
148
		pushOnCommentsStack(0, lastCommentIndex); // store comment before flushing them
149
		this.scanner.commentPtr = -1;
150
	}
145
	/* (non-Javadoc)
151
	/* (non-Javadoc)
146
	 * Save all source comments currently stored before flushing them.
152
	 * Save all source comments currently stored before flushing them.
147
	 * @see org.eclipse.jdt.internal.compiler.parser.Parser#flushCommentsDefinedPriorTo(int)
153
	 * @see org.eclipse.jdt.internal.compiler.parser.Parser#flushCommentsDefinedPriorTo(int)

Return to bug 100041