Summary: | VerifyError after compiling without preserve all locals | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Andrew Niefer <aniefer> | ||||||
Component: | Core | Assignee: | Olivier Thomann <Olivier_Thomann> | ||||||
Status: | VERIFIED FIXED | QA Contact: | |||||||
Severity: | critical | ||||||||
Priority: | P3 | ||||||||
Version: | 3.6 | ||||||||
Target Milestone: | 3.6 M6 | ||||||||
Hardware: | PC | ||||||||
OS: | Windows XP | ||||||||
Whiteboard: | |||||||||
Attachments: |
|
This is bad. I believe this is due to the usage of FAKE_USED for one of the locals. The small test case reproduces the issue: public class X { public static void main(String[] args) { String s = null; String s2 = null; if (s != null && s2 != null) { System.out.println(s); System.out.println(s2); } } } In the test (s != null && s2 != null), s2 is tagged as FAKE_USED and therefore doesn't get a resolved position. When we end up generating the code for it, we generate aload 255 since its resolved position is set to -1. Created attachment 160683 [details]
Proposed fix
Patch under testing.
Released for 3.6M6. Added regression tests: org.eclipse.jdt.core.tests.compiler.regression.NullReferenceTest#testBug304416 Verified for 3.6M6 using I20100307-2000 build. |
Created attachment 160679 [details] patch to reproduce Running I20100302-0800 on linux.gtk.x86 If "Preserve unused (never read) local variables" is not checked (this is what happens during export or a releng build), then running the bundle org.eclipse.equinox.frameworkadmin.equinox gives: java.lang.VerifyError: (org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxFwConfigFileParser) local variable index out of range in load in method 8 (readFwConfig(Lorg/eclipse/equinox/internal/provisional/frameworkadmin/Manipulator;Ljava/io/File;)V) at pc=285 For the source, get (/cvsroot/rt/org.eclipse.equinox/p2/bundles/) org.eclipse.equinox.frameworkadmin org.eclipse.equinox.frameworkadmin.equinox from head and apply the attached patch.