Odd compiler error on if-clause without braces

Posted by DisgruntledGoat on Stack Overflow See other posts from Stack Overflow or by DisgruntledGoat
Published on 2010-03-27T03:14:27Z Indexed on 2010/03/27 3:23 UTC
Read the original article Hit count: 390

Filed under:
|
|

The following Java code is throwing a compiler error:

if ( checkGameTitle(currGame) )
    ArrayList<String> items = parseColumns( tRows.get(rowOffset+1), currGame, time, method );

checkGameTitle is a public static function, returning a boolean. The errors are all of the type "cannot find symbol" with the symbols being variable ArrayList, variable String and variable items.

However, if I add {curly braces} then the code compiles with no errors. Why might this be? Is there some ambiguity on the if clause without them?

© Stack Overflow or respective owner

Related posts about java

Related posts about compiler