Bug 26132

Summary: JACKS - Blank final instance must be assigned before the end of constructor
Product: [Eclipse Project] JDT Reporter: Olivier Thomann <Olivier_Thomann>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: P3    
Version: 2.1   
Target Milestone: 2.1 M4   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Olivier Thomann CLA 2002-11-13 12:50:17 EST
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.
Comment 1 Olivier Thomann CLA 2002-11-13 12:53:03 EST
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;
	}
}
Comment 2 Olivier Thomann CLA 2002-11-14 12:08:31 EST
Change summary.
Comment 3 Philipe Mulet CLA 2002-11-19 09:32:54 EST
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.