Considering the truth table, the last condition is entirely superfluos. It can be dropped without altering the logic of your program, like this:
public MyType doSomething(bool a, bool b) {
if ( a && b) return doAB();
else if ( a && !b) return doA();
else if (!a && b) return doB();
else/*if (!a && !b)*/ return doNotANotB();
}
Now you have a final catch-all if
, and your compiler is happy. You don't have to remove the condition altogether - I often find it a good idea to keep it around in a comment for readability.