### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: model/org/eclipse/jdt/internal/core/jdom/DOMBuilder.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/jdom/DOMBuilder.java,v retrieving revision 1.36 diff -u -r1.36 DOMBuilder.java --- model/org/eclipse/jdt/internal/core/jdom/DOMBuilder.java 7 Mar 2009 01:08:10 -0000 1.36 +++ model/org/eclipse/jdt/internal/core/jdom/DOMBuilder.java 23 Apr 2009 12:49:46 -0000 @@ -106,7 +106,14 @@ */ public void acceptPackage(int declarationStart, int declarationEnd, int[] javaDocPositions, char[] name, int nameStartPosition) { - int[] sourceRange = {declarationStart, declarationEnd}; + int[] sourceRange = null; + if (javaDocPositions != null) { + int length = javaDocPositions.length; + // get last javadoc comment (see bug 68772) + sourceRange = new int[] {javaDocPositions[length - 2], declarationEnd}; + } else { + sourceRange = new int[] {declarationStart, declarationEnd}; + } int[] nameRange = {nameStartPosition, declarationEnd - 1}; this.fNode= new DOMPackage(this.fDocument, sourceRange, CharOperation.charToString(name), nameRange); addChild(this.fNode); @@ -457,11 +464,11 @@ (extendedTypeDimensionEnd > nameEnd) ? extendedTypeDimensionEnd : nameEnd}; int[] nameRange = {nameStart, nameEnd}; int[] commentRange = {-1, -1}; - if (javaDocPositions != null) { - int length = javaDocPositions.length; - commentRange[0] = javaDocPositions[length - 2]; // get last javadoc comment (see bug 68772) - commentRange[1] = javaDocPositions[length - 1]; - } + if (javaDocPositions != null) { + int length = javaDocPositions.length; + commentRange[0] = javaDocPositions[length - 2]; // get last javadoc comment (see bug 68772) + commentRange[1] = javaDocPositions[length - 1]; + } int[] modifiersRange = {-1, -1}; if (modifiersStart > -1) { modifiersRange[0] = modifiersStart; Index: model/org/eclipse/jdt/internal/compiler/SourceElementParser.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementParser.java,v retrieving revision 1.88 diff -u -r1.88 SourceElementParser.java --- model/org/eclipse/jdt/internal/compiler/SourceElementParser.java 9 Sep 2008 14:01:19 -0000 1.88 +++ model/org/eclipse/jdt/internal/compiler/SourceElementParser.java 23 Apr 2009 12:49:46 -0000 @@ -707,6 +707,9 @@ return methodDeclaration; } protected CompilationUnitDeclaration endParse(int act) { + if (this.scanner.recordLineSeparator) { + this.requestor.acceptLineSeparatorPositions(this.scanner.getLineEnds()); + } if (this.compilationUnit != null) { CompilationUnitDeclaration result = super.endParse(act); return result; Index: model/org/eclipse/jdt/internal/compiler/DocumentElementParser.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/DocumentElementParser.java,v retrieving revision 1.30 diff -u -r1.30 DocumentElementParser.java --- model/org/eclipse/jdt/internal/compiler/DocumentElementParser.java 7 Mar 2009 01:08:11 -0000 1.30 +++ model/org/eclipse/jdt/internal/compiler/DocumentElementParser.java 23 Apr 2009 12:49:46 -0000 @@ -887,14 +887,23 @@ this.declarationSourceStart >= 0 ? this.declarationSourceStart : this.modifiersSourceStart); resetModifiers(); } +protected void consumePackageComment() { + // get possible comment for syntax since 1.5 + if(this.options.sourceLevel >= ClassFileConstants.JDK1_5) { + checkComment(); + } else { + pushOnIntArrayStack(getJavaDocPositions()); + } + resetModifiers(); +} /* * * INTERNAL USE-ONLY */ protected void consumePackageDeclarationName() { - /* persisting javadoc positions */ - pushOnIntArrayStack(getJavaDocPositions()); - + /* + * Javadoc positions are persisted in consumePackageComment + */ super.consumePackageDeclarationName(); ImportReference importReference = this.compilationUnit.currentPackage; @@ -910,9 +919,6 @@ * INTERNAL USE-ONLY */ protected void consumePackageDeclarationNameWithModifiers() { - /* persisting javadoc positions */ - pushOnIntArrayStack(getJavaDocPositions()); - super.consumePackageDeclarationNameWithModifiers(); ImportReference importReference = this.compilationUnit.currentPackage;