Bug 26132 - JACKS - Blank final instance must be assigned before the end of constructor
Summary: JACKS - Blank final instance must be assigned before the end of constructor
Status: RESOLVED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.1 M4   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-11-13 12:50 EST by Olivier Thomann CLA
Modified: 2002-11-19 09:32 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.