julianhyde commented on a change in pull request #88: [hotfix] fix typo in
AbstractService
URL: https://github.com/apache/calcite-avatica/pull/88#discussion_r268952651
##########
File path:
core/src/main/java/org/apache/calcite/avatica/remote/AbstractService.java
##########
@@ -89,7 +89,7 @@ ColumnMetaData finagle(ColumnMetaData column) {
case PROTOBUF:
return column;
default:
Review comment:
I disagree. That video is talking about a language that (objective c?) that
can check that switch statements are exhaustive. I wish that Java did this, but
it does not.
In Java, an error that occurs during testing is a good result. Even an error
that occurs in production is not too bad - it generates a clear stack trace,
which is better than giving mysterious behavior.
If people don't add a `default: throw ...`, the compiler makes them do silly
stuff like 'return null;' after the switch. So it looks as if the method can
return a nullable value, even though it cannot in practice. So, `default: throw
...` is the way to get the best mileage out of javac's (limited) flow analysis.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services