Good question. "If" is special in respect to "if true". If you were to write "while true", the compiler would pick up on te fact that the code was unreachable. "If true" is designed to alllow easy changing from true to false because people write code like
Java wants to make it easy for you to turn off debugging by turning off that compile time constant so they still let the code compile in the case you listed in your post.