Bug 26134 - JACKS - VerifyError running invalid code
Summary: JACKS - VerifyError running invalid code
Status: VERIFIED FIXED
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 13:07 EST by Olivier Thomann CLA
Modified: 2002-12-17 10:19 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 13:07:31 EST
Using 1112, this test case is compiled and a VerifyError is thrown when
executed. We should not compile it.

class A {
	void m(int i) {
	    switch (i) {
            case 0:
		final int j;
		j = 1;
		class Local {
		    int k = j;
		}
		break;
            case 1:
		int k = new Local().k;
	    }
	}
	
	public static void main(String[] args) {
	}
}
Run:
Exception in thread "main" java.lang.VerifyError: (class: A, method: m
signature: (I)V) Accessing value from uninitialized register 2

Javac 1.4 behaves the same. Only jikes properly rejects it.
Comment 1 Philipe Mulet CLA 2002-11-14 08:53:27 EST
What error does Jikes produce ?
Comment 2 Olivier Thomann CLA 2002-11-14 08:57:57 EST
Found 1 semantic error compiling "D:/temp/A.java":

    12.                 int k = new Local().k;
                                <->
*** Error: The variable "j" may be accessed here before having been definitely 
assigned a value.
Comment 3 Philipe Mulet CLA 2002-11-20 07:40:02 EST
Added check. Note that if offending variable is inlinable, no complaint is 
issued (jikes doesn't complain either), i.e.

define j as:

final int j = 1;

Fixed.
Comment 4 David Audel CLA 2002-12-17 10:19:19 EST
Verified.