Community
Participate
Working Groups
Using 1112, this test case compiles fine, but it should not. class A { final int i; A() { if (true) return; i = 1; } } See JLS 8.3.1.2. Javac 1.3 or 1.4 fails to reject this code. Jikes does it.
Another test cases: class A { final int i; A(boolean b) { if (b) return; i = 1; } } class A { final int i; A(boolean b) { try { if (b) return; } finally { } i = 1; } }
Change summary.
Won't change, we keep compatibility with javac. This behavior derives from considering constant expressions during flow analysis (which clearly Jikes doesn't consider). Second example on chapter 16 (p.408) involving a 'while (true)' demonstrates we should consider constant expressions. Closing.