Community
Participate
Working Groups
HEAD The snippet below produces a bad compile error when compiled against a 1.6 JRE but with compiler compliance 1.4: "Incompatible conditional operand types Class and Class". package snippet; import java.util.Random; public class Snippet { Class c= new Random().nextBoolean() ? int.class : long.class; } Is OK with pure 1.4 or 1.6. Real life example is in class CocoaUtil in org.eclipse.ui.cocoa when you don't have Java 1.4 installed.
Srikanth, When we are not using generic information, should not we convert to erasure()? This would be org.eclipse.jdt.internal.compiler.ast.ConditionalExpression.resolveType(BlockScope) line 522.
This is also a consequence of bug 324850.
Created attachment 181953 [details] Proposed patch - no tests yet
Created attachment 182018 [details] Patch with test
Olivier, please review. TIA - Passes all JDT/Core tests.
Just verified that build I20101028-1441 does not have this bug.
Patch looks good.
Released in HEAD for 3.7 M4
Verified for 3.7M4 using build I20101205-2000.