Community
Participate
Working Groups
// Puzzle 86 from "Java Puzzlers" by Joshua Bloch and Neal Gafter public class PoisonParen { static int i1 = -2147483648; static int i2 = -(2147483648); public static void main(String[] args) { System.out.println("i1=" + i1); System.out.println("i2=" + i2); } } This program does compile within Eclipse 3.1.2 using JRE 1.5.0_02 and the output is as follows: i1=-2147483648 i2=-2147483648 However, it does not compile using the JDK 1.5.0_02 directly. The output of the JDK is: javac PoisonParen.java PoisonParen.java:12: integer number too large: 2147483648 static int i2 = -(2147483648); ^ 1 error The OS used in both cases is Windows XP.
Created attachment 37216 [details] Proposed fix
Regression test in org.eclipse.jdt.core.tests.compiler.regression.NumericTest.test003. Fixed and released in HEAD.
Also added regression test org.eclipse.jdt.core.tests.compiler.regression.NumericTest.test004 for the long case.
Verified for 3.2M6 using I20060330-0010