Summary: | spurious "Incompatible conditional operand types" on ?: when assigning to abstract | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | npitman <npitman> |
Component: | Core | Assignee: | JDT-Core-Inbox <jdt-core-inbox> |
Status: | RESOLVED WONTFIX | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | ||
Version: | 2.1 | ||
Target Milestone: | 2.1 RC1 | ||
Hardware: | PC | ||
OS: | Windows XP | ||
Whiteboard: |
Description
npitman
2003-02-10 11:32:53 EST
compiler lives in jdt core Maybe the message is not very clear, but this code is incorrect. Look at the JLS http://java.sun.com/docs/books/jls/second_edition/html/expressions.doc.html#290293 * If the second and third operands are of different reference types, then it must be possible to convert one of the types to the other type (call this latter type T) by assignment conversion (ยง5.2); the type of the conditional expression is T. It is a compile-time error if neither type is assignment compatible with the other type. So like ByteArrayOutputStream cannot be assignment compatible with FileOutputStream, the compile reports a compile-error. This is clearly a valid error. Javac 1.4.1 and jikes 1.18 report the same problem. Closing, we implement the JLS spec strictly. |