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

Collapse All | Expand All

(-)model/org/eclipse/jdt/internal/core/jdom/DOMBuilder.java (-6 / +13 lines)
Lines 106-112 Link Here
106
 */
106
 */
107
public void acceptPackage(int declarationStart, int declarationEnd, int[] javaDocPositions, char[] name,
107
public void acceptPackage(int declarationStart, int declarationEnd, int[] javaDocPositions, char[] name,
108
	int nameStartPosition) {
108
	int nameStartPosition) {
109
	int[] sourceRange = {declarationStart, declarationEnd};
109
	int[] sourceRange = null;
110
	if (javaDocPositions != null) {
111
		int length = javaDocPositions.length;
112
		// get last javadoc comment (see bug 68772)
113
		sourceRange = new int[] {javaDocPositions[length - 2], declarationEnd};
114
	} else {
115
		sourceRange = new int[] {declarationStart, declarationEnd};
116
	}
110
	int[] nameRange = {nameStartPosition, declarationEnd - 1};
117
	int[] nameRange = {nameStartPosition, declarationEnd - 1};
111
	this.fNode= new DOMPackage(this.fDocument, sourceRange, CharOperation.charToString(name), nameRange);
118
	this.fNode= new DOMPackage(this.fDocument, sourceRange, CharOperation.charToString(name), nameRange);
112
	addChild(this.fNode);
119
	addChild(this.fNode);
Lines 457-467 Link Here
457
		(extendedTypeDimensionEnd > nameEnd) ? extendedTypeDimensionEnd : nameEnd};
464
		(extendedTypeDimensionEnd > nameEnd) ? extendedTypeDimensionEnd : nameEnd};
458
	int[] nameRange = {nameStart, nameEnd};
465
	int[] nameRange = {nameStart, nameEnd};
459
	int[] commentRange = {-1, -1};
466
	int[] commentRange = {-1, -1};
460
		if (javaDocPositions != null) {
467
	if (javaDocPositions != null) {
461
			int length = javaDocPositions.length;
468
		int length = javaDocPositions.length;
462
			commentRange[0] = javaDocPositions[length - 2]; // get last javadoc comment (see bug 68772)
469
		commentRange[0] = javaDocPositions[length - 2]; // get last javadoc comment (see bug 68772)
463
			commentRange[1] = javaDocPositions[length - 1];
470
		commentRange[1] = javaDocPositions[length - 1];
464
		}
471
	}
465
	int[] modifiersRange = {-1, -1};
472
	int[] modifiersRange = {-1, -1};
466
	if (modifiersStart > -1) {
473
	if (modifiersStart > -1) {
467
		modifiersRange[0] = modifiersStart;
474
		modifiersRange[0] = modifiersStart;
(-)model/org/eclipse/jdt/internal/compiler/SourceElementParser.java (+3 lines)
Lines 707-712 Link Here
707
	return methodDeclaration;
707
	return methodDeclaration;
708
}
708
}
709
protected CompilationUnitDeclaration endParse(int act) {
709
protected CompilationUnitDeclaration endParse(int act) {
710
	if (this.scanner.recordLineSeparator) {
711
		this.requestor.acceptLineSeparatorPositions(this.scanner.getLineEnds());
712
	}
710
	if (this.compilationUnit != null) {
713
	if (this.compilationUnit != null) {
711
		CompilationUnitDeclaration result = super.endParse(act);
714
		CompilationUnitDeclaration result = super.endParse(act);
712
		return result;
715
		return result;
(-)model/org/eclipse/jdt/internal/compiler/DocumentElementParser.java (-6 / +12 lines)
Lines 887-900 Link Here
887
		this.declarationSourceStart >= 0 ? this.declarationSourceStart : this.modifiersSourceStart);
887
		this.declarationSourceStart >= 0 ? this.declarationSourceStart : this.modifiersSourceStart);
888
	resetModifiers();
888
	resetModifiers();
889
}
889
}
890
protected void consumePackageComment() {
891
	// get possible comment for syntax since 1.5
892
	if(this.options.sourceLevel >= ClassFileConstants.JDK1_5) {
893
		checkComment();
894
	} else {
895
		pushOnIntArrayStack(getJavaDocPositions());
896
	}
897
	resetModifiers();
898
}
890
/*
899
/*
891
 *
900
 *
892
 * INTERNAL USE-ONLY
901
 * INTERNAL USE-ONLY
893
 */
902
 */
894
protected void consumePackageDeclarationName() {
903
protected void consumePackageDeclarationName() {
895
	/* persisting javadoc positions */
904
	/*
896
	pushOnIntArrayStack(getJavaDocPositions());
905
	 * Javadoc positions are persisted in consumePackageComment
897
906
	 */
898
	super.consumePackageDeclarationName();
907
	super.consumePackageDeclarationName();
899
	ImportReference importReference = this.compilationUnit.currentPackage;
908
	ImportReference importReference = this.compilationUnit.currentPackage;
900
909
Lines 910-918 Link Here
910
* INTERNAL USE-ONLY
919
* INTERNAL USE-ONLY
911
*/
920
*/
912
protected void consumePackageDeclarationNameWithModifiers() {
921
protected void consumePackageDeclarationNameWithModifiers() {
913
	/* persisting javadoc positions */
914
	pushOnIntArrayStack(getJavaDocPositions());
915
916
	super.consumePackageDeclarationNameWithModifiers();
922
	super.consumePackageDeclarationNameWithModifiers();
917
	ImportReference importReference = this.compilationUnit.currentPackage;
923
	ImportReference importReference = this.compilationUnit.currentPackage;
918
924

Return to bug 272533