I came across a strange error, which I believe is a mistake. Here is a minimal case, please do not comment on the usefulness of the code :)
class Foo { static public <X> int bar() { return 42; } public int baz() { return true ? 42 : ( Foo.<Void>bar() > 42 ? 41 : 43 ) ; } }
Result:
err.java:7: illegal start of expression Foo.<Void>bar() > 42 ? 41 : 43 ^
I tried the SUN SDK javac 1.6.0_13 and 1.6.0_21.
The error goes away when I either
- make bar () is not generic (just for curiosity, not really an option)
- remove the parentheses around the ternary expression on line 7
So it looks like if e is an expression, is it not always true to write (e)?
java javac
Ingo
source share