### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java,v retrieving revision 1.375 diff -u -r1.375 Parser.java --- compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java 18 Jul 2007 00:41:54 -0000 1.375 +++ compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java 31 Jul 2007 16:27:27 -0000 @@ -1725,15 +1725,28 @@ } } else if (expr1 instanceof CombinedBinaryExpression) { CombinedBinaryExpression cursor; + int numberOfParens = (expr1.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT; // shift cursor; create BE/CBE as needed if ((cursor = (CombinedBinaryExpression)expr1).arity < cursor.arityMax) { cursor.left = new BinaryExpression(cursor.left, cursor.right, PLUS); + if (numberOfParens != 0) { + // clear the bits on cursor and put them back on cursor.left + cursor.bits &= ~ASTNode.ParenthesizedMASK; + cursor.left.bits &= ~ASTNode.ParenthesizedMASK; + cursor.left.bits |= numberOfParens << ASTNode.ParenthesizedSHIFT; + } cursor.arity++; } else { cursor.left = new CombinedBinaryExpression(cursor.left, cursor.right, PLUS, cursor.arity); + if (numberOfParens != 0) { + // clear the bits on cursor and put them back on cursor.left + cursor.bits &= ~ASTNode.ParenthesizedMASK; + cursor.left.bits &= ~ASTNode.ParenthesizedMASK; + cursor.left.bits |= numberOfParens << ASTNode.ParenthesizedSHIFT; + } cursor.arity = 0; cursor.tuneArityMax(); } @@ -1743,10 +1756,10 @@ // cursor.depthTracker = ((BinaryExpression)cursor.left). // depthTracker + 1; this.expressionStack[this.expressionPtr] = cursor; - } else if (expr1 instanceof BinaryExpression && - // single out the a + b case - ((expr1.bits & ASTNode.OperatorMASK) >> + } else if (expr1 instanceof BinaryExpression + && ((expr1.bits & ASTNode.OperatorMASK) >> ASTNode.OperatorSHIFT) == OperatorIds.PLUS) { + // single out the a + b case this.expressionStack[this.expressionPtr] = new CombinedBinaryExpression(expr1, expr2, PLUS, 1); } else { @@ -1767,7 +1780,7 @@ new BinaryExpression( expr1, expr2, - op); + op); } } /**