Community
Participate
Working Groups
Build 20020125 This defect was originally reported against VAJ 3.5.3, and we have the same bug in Eclipse. ================== When compiling the following test case and running it, we get a verification error: "Exception in thread "main" java.lang.VerifyError: (class: VerifyEr, method: err signature: ()Z) Register 1 contains wrong type" STEPS TO RECREATE THE PROBLEM: 1. Have VAJava installed. Also install JDK 1.2.2. 2. Create a test project and import VerifyEr.java to the test project. 3. Run the "test" class from the "Workbench" window. This confirms that the class compiled using VAJava compiler runs normally on VAJava environment. 4. Export the class to a directory. 5. Run the exported class on JDK. This produces the verify error as mentioned above. <----------------------------- This is the problem ! 6. Compile the VerifyEr.java using JDK. 7. Run the class compiled by JDK on JDK. Confirm "No Err". THE SOURCE CODE FOR THE TEST CASE: /** * VerifyError * @author: Administrator */ class VerifyEr { protected int ii; /** * VerifyEr */ public VerifyEr() { super(); System.out.println("No Err"); } protected boolean err() { try { ii = 0; System.out.println("I'm here"); } catch (Throwable t) { return getb(); } finally { try { if (getb()) { return getb(); } } finally { if (getb()) { return false; } } } return false; } protected boolean getb() { System.out.println("I'm here"); return false; } /** */ public static void main(String[] args) { new VerifyEr(); } }
Bug is due to the fact we share all saveValueVariables, and in case of nested finally blocks, it clearly shouldn't occur. Simpler test case: class VerifyEr { protected boolean err(boolean b) { try { System.out.print("SUCC"); } catch (Throwable t) { return b; } finally { try { if (b) { return b; } } finally { System.out.println("ESS"); } } return false; } public static void main(String[] args) { new VerifyEr().err(false); } } should print SUCCESS and doesn't
Fixed in latest, added regression test.