This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: System.out.println("foo" + s != null ? s : ""); precedence



Tom Tromey writes:

> How do we know it is a bug?

I didn't give a second thought at the operator precedence and I was
actually thinking that Sun's grammar was flawed in that respect.

On a second thought, it exhibits a behavior I've seen reported at
different place as being the correct one. Duh.

> "The Java Programming Language" (not canonical, but maybe useful)
> does have a table of operator precedence; it shows binary `+' having
> precedence over `?:'.

Yes, I think this is correct and that the PR should be closed. For
some reason the test case looked like it should print something
else. Thank you for having a look at it.

./A



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]