This reverts commit 93206c3f6e and updates the related test to only rely on the fact the compiler fails. Relying on a message will not work and the status code can be implementation independent according to its javadoc. Closes gh-31536
93206c3f6e