The compiler error is "unreachable statement". The asserts won't cause an unreachable statement compiler error, maybe because you could always run with assertions disabled. Things like code after and outside of a while(true) or code after an explicitly thrown Throwable will cause unreachable statement compiler errors.
Test this yourself by replacing the while loop with a "throw new RuntimeException();" It's fun to try to cause the compiler to complain!