Bug 100162 - java.lang.VerifyError is produced by Eclipse Java compiler
Summary: java.lang.VerifyError is produced by Eclipse Java compiler
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 RC3   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-15 09:08 EDT by Kostyantyn Titorenko CLA
Modified: 2005-06-16 14:56 EDT (History)
1 user (show)

See Also:


Attachments
Proposed fix (1.08 KB, patch)
2005-06-15 09:54 EDT, Olivier Thomann CLA
no flags Details | Diff
Corresponding regression test (3.04 KB, patch)
2005-06-15 10:15 EDT, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kostyantyn Titorenko CLA 2005-06-15 09:08:15 EDT
The following code has been compiled in Eclipse 3.1 RC2 (as well in 3.0.2):
//--------------
public class TestBug {
    final boolean isA = true;
    
    public static void main(String[] args) {        
        TestBug test = new TestBug();        
        System.out.println(test.isA ? "A" : "B");
    }
}
//--------------
it is produces exception:
 java.lang.VerifyError: (class: TestBug, method: main signature: 
([Ljava/lang/String;)V) Expecting to find integer on stack
Exception in thread "main" 

However beeing compiled with javac it runs ok.

If one removes final modifier it will run on Eclipse too, so i guess it has 
something to do with optimizations.
Comment 1 Philipe Mulet CLA 2005-06-15 09:17:09 EDT
Olivier - pls investigate and attach a patch once you have it.
Comment 2 Olivier Thomann CLA 2005-06-15 09:54:09 EDT
Created attachment 23188 [details]
Proposed fix
Comment 3 Philipe Mulet CLA 2005-06-15 09:54:38 EDT
+1 for RC3

Olivier - pls enter separate issue for codegen optimization. 
Fix would look like adding implicit conversion to ConditionalExpression:

if (conditionType != null) condition.computeConversion(scope, BooleanBinding,
conditionType);

Dirk - pls cast your vote
Comment 4 Olivier Thomann CLA 2005-06-15 10:07:38 EDT
I entered bug 100187 for the optimization issue.
Comment 5 Olivier Thomann CLA 2005-06-15 10:15:04 EDT
Created attachment 23192 [details]
Corresponding regression test
Comment 6 Dirk Baeumer CLA 2005-06-15 10:44:14 EDT
+1 for RC3.
Comment 7 Olivier Thomann CLA 2005-06-15 10:49:31 EDT
Fixed and released in HEAD.
Regression test added in
org.eclipse.jdt.core.tests.compiler.regression.ConditionalExpressionTest.test001
Comment 8 Olivier Thomann CLA 2005-06-16 14:56:21 EDT
Verified using N20050616-0010 + JDT/Core HEAD