Posts mit dem Label under engineered werden angezeigt. Alle Posts anzeigen
Posts mit dem Label under engineered werden angezeigt. Alle Posts anzeigen

Samstag, 25. Januar 2014

enum and switch in Java

Here we go again:

 error: variable Wait_Time might not have been initialized
               this.wait (waitTime);
                          ^
Of course the variable is initialised. It's a switch/case over an enum with all possible cases covered. And sure as hell when I add a default case I get:

        'default' branch is unnecessary

But this is what you get when a programming language was under engineered in it's beginning. Recently there is a lot of discussion on over engineering and the problems it gives you. But trust me: under engendering is as bad.

So which evil to choose to get around the problem … Wait … not a question at all: You can disable warnings but you can't disable errors.