### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java,v retrieving revision 1.145 diff -u -r1.145 CodeStream.java --- compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java 23 Oct 2006 16:48:39 -0000 1.145 +++ compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java 20 Nov 2006 19:19:01 -0000 @@ -5735,6 +5735,9 @@ // nothing to do } public void recordPositionsFrom(int startPC, int sourcePos) { + this.recordPositionsFrom(startPC, sourcePos, false); +} +public void recordPositionsFrom(int startPC, int sourcePos, boolean widen) { /* Record positions in the table, only if nothing has * already been recorded. Since we output them on the way @@ -5742,13 +5745,9 @@ * The pcToSourceMap table is always sorted. */ - if ((this.generateAttributes & ClassFileConstants.ATTR_LINES) == 0) - return; - if (sourcePos == 0) - return; - - // no code generated for this node. e.g. field without any initialization - if (position == startPC) + if ((this.generateAttributes & ClassFileConstants.ATTR_LINES) == 0 + || sourcePos == 0 + || (startPC == position && !widen)) return; // Widening an existing entry that already has the same source positions @@ -5761,7 +5760,7 @@ if (pcToSourceMapSize > 0) { // in this case there is already an entry in the table if (pcToSourceMap[pcToSourceMapSize - 1] != lineNumber) { - if (startPC < lastEntryPC) { + if (startPC <= lastEntryPC) { // we forgot to add an entry. // search if an existing entry exists for startPC int insertionIndex = insertionIndex(pcToSourceMap, pcToSourceMapSize, startPC); @@ -5789,8 +5788,15 @@ pcToSourceMapSize += 2; } } else if (position != lastEntryPC) { // no bytecode since last entry pc - pcToSourceMap[pcToSourceMapSize++] = lastEntryPC; - pcToSourceMap[pcToSourceMapSize++] = lineNumber; + if (lastEntryPC == startPC || lastEntryPC == pcToSourceMap[pcToSourceMapSize - 2]) { + pcToSourceMap[pcToSourceMapSize - 1] = lineNumber; + } else { + pcToSourceMap[pcToSourceMapSize++] = lastEntryPC; + pcToSourceMap[pcToSourceMapSize++] = lineNumber; + } + } else if (pcToSourceMap[pcToSourceMapSize - 1] < lineNumber && widen) { + // see if we can widen the existing entry + pcToSourceMap[pcToSourceMapSize - 1] = lineNumber; } } else { // we can safely add the new entry. The endPC of the previous entry is not in conflit with the startPC of the new entry. Index: compiler/org/eclipse/jdt/internal/compiler/codegen/BranchLabel.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/BranchLabel.java,v retrieving revision 1.8 diff -u -r1.8 BranchLabel.java --- compiler/org/eclipse/jdt/internal/compiler/codegen/BranchLabel.java 14 Sep 2006 14:36:55 -0000 1.8 +++ compiler/org/eclipse/jdt/internal/compiler/codegen/BranchLabel.java 20 Nov 2006 19:19:00 -0000 @@ -213,13 +213,9 @@ } */ // Beginning of new code - int index = this.codeStream.pcToSourceMapSize - 2; if (this.codeStream.lastEntryPC == oldPosition) { this.codeStream.lastEntryPC = this.position; } - if ((index >= 0) && (this.codeStream.pcToSourceMap[index] == this.position)) { - this.codeStream.pcToSourceMapSize-=2; - } // end of new code if ((this.codeStream.generateAttributes & (ClassFileConstants.ATTR_VARS | ClassFileConstants.ATTR_STACK_MAP)) != 0) { LocalVariableBinding locals[] = this.codeStream.locals; Index: compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java,v retrieving revision 1.69 diff -u -r1.69 SwitchStatement.java --- compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java 15 Jun 2006 10:33:04 -0000 1.69 +++ compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java 20 Nov 2006 19:19:00 -0000 @@ -237,6 +237,7 @@ // place the trailing labels (for break and default case) this.breakLabel.place(); if (defaultCase == null) { + codeStream.recordPositionsFrom(codeStream.position, this.sourceEnd, true); defaultLabel.place(); } codeStream.recordPositionsFrom(pc, this.sourceStart);