Community
Participate
Working Groups
Javac rightly rejects the ternary expression for having "incompatible types". But Eclipse wrongly accepts it. -----------------Bug.java----------------- class Bug{ java.io.Serializable field=this==null?8:"".getBytes(); }
Seems to be a consequence of boxing.
valueIfTrue type ends up being java.lang.Integer. valueIfFalse type ends up being byte[]. The lub of both types is java.io.Serializable.
Both javac 6(b105) and 7(b05) agree with us. This is a bug in javac 5. Closing as invalid. Added AutoboxingTest#test129