### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java,v retrieving revision 1.102 diff -u -r1.102 SingleNameReference.java --- compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java 5 May 2008 18:58:31 -0000 1.102 +++ compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java 23 May 2008 11:34:19 -0000 @@ -497,8 +497,6 @@ break; case Binding.LOCAL : // assigning to a local variable (cannot assign to outer local) LocalVariableBinding localBinding = (LocalVariableBinding) this.codegenBinding; - Constant assignConstant; - int increment; // using incr bytecode if possible switch (localBinding.type.id) { case T_JavaLangString : @@ -509,19 +507,23 @@ codeStream.store(localBinding, false); return; case T_int : + Constant assignConstant; if (((assignConstant = expression.constant) != Constant.NotAConstant) - && (assignConstant.typeID() != TypeIds.T_float) // only for integral types - && (assignConstant.typeID() != TypeIds.T_double) - && ((increment = assignConstant.intValue()) == (short) increment)) { // 16 bits value + && (assignConstant.typeID() != TypeIds.T_float) // only for integral types + && (assignConstant.typeID() != TypeIds.T_double)) { switch (operator) { case PLUS : + int increment = assignConstant.intValue(); + if (increment != (short) increment) break; // not representable as a 16-bits value codeStream.iinc(localBinding.resolvedPosition, increment); if (valueRequired) { codeStream.load(localBinding); } return; case MINUS : - codeStream.iinc(localBinding.resolvedPosition, -increment); + increment = -assignConstant.intValue(); + if (increment != (short) increment) break; // not representable as a 16-bits value + codeStream.iinc(localBinding.resolvedPosition, increment); if (valueRequired) { codeStream.load(localBinding); } Index: eval/org/eclipse/jdt/internal/eval/CodeSnippetSingleNameReference.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetSingleNameReference.java,v retrieving revision 1.50 diff -u -r1.50 CodeSnippetSingleNameReference.java --- eval/org/eclipse/jdt/internal/eval/CodeSnippetSingleNameReference.java 16 Apr 2008 11:55:01 -0000 1.50 +++ eval/org/eclipse/jdt/internal/eval/CodeSnippetSingleNameReference.java 23 May 2008 11:34:19 -0000 @@ -23,17 +23,6 @@ import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; import org.eclipse.jdt.internal.compiler.impl.Constant; import org.eclipse.jdt.internal.compiler.lookup.*; -import org.eclipse.jdt.internal.compiler.lookup.BlockScope; -import org.eclipse.jdt.internal.compiler.lookup.ClassScope; -import org.eclipse.jdt.internal.compiler.lookup.FieldBinding; -import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding; -import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; -import org.eclipse.jdt.internal.compiler.lookup.ProblemBinding; -import org.eclipse.jdt.internal.compiler.lookup.ProblemFieldBinding; -import org.eclipse.jdt.internal.compiler.lookup.ProblemReasons; -import org.eclipse.jdt.internal.compiler.lookup.Scope; -import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; -import org.eclipse.jdt.internal.compiler.lookup.VariableBinding; /** * A single name reference inside a code snippet can denote a field of a remote @@ -335,8 +324,6 @@ break; case Binding.LOCAL : // assigning to a local variable (cannot assign to outer local) LocalVariableBinding localBinding = (LocalVariableBinding) this.codegenBinding; - Constant assignConstant; - int increment; // using incr bytecode if possible switch (localBinding.type.id) { case T_JavaLangString : @@ -347,19 +334,23 @@ codeStream.store(localBinding, false); return; case T_int : + Constant assignConstant; if (((assignConstant = expression.constant) != Constant.NotAConstant) - && (assignConstant.typeID() != T_float) // only for integral types - && (assignConstant.typeID() != T_double) - && ((increment = assignConstant.intValue()) == (short) increment)) { // 16 bits value + && (assignConstant.typeID() != TypeIds.T_float) // only for integral types + && (assignConstant.typeID() != TypeIds.T_double)) { switch (operator) { case PLUS : + int increment = assignConstant.intValue(); + if (increment != (short) increment) break; // not representable as a 16-bits value codeStream.iinc(localBinding.resolvedPosition, increment); if (valueRequired) { codeStream.load(localBinding); } return; case MINUS : - codeStream.iinc(localBinding.resolvedPosition, -increment); + increment = -assignConstant.intValue(); + if (increment != (short) increment) break; // not representable as a 16-bits value + codeStream.iinc(localBinding.resolvedPosition, increment); if (valueRequired) { codeStream.load(localBinding); }