tox4j / deprecated-tox4j

Deprecated, see http://github.com/TokTok/jvm-toxcore-c
http://github.com/TokTok/jvm-toxcore-c
Other
42 stars 17 forks source link

Linter: Usage of `.orNull` should be discouraged #120

Open nbraud opened 9 years ago

nbraud commented 9 years ago

Expressions such as someOption.orNull currently compile without compiler warning. Such expressions might yield a null value, which will result in a NullPointerException later on.
Using someOption.get, which results in a NoSuchElementException at the point of error, should be preferred.

iphydf commented 9 years ago

.get should also be discouraged, as it causes exceptions, which we don't accept in production code. .fold or any of the other more specific methods or plain pattern matching or for-comprehensions should be preferred.

nbraud commented 9 years ago

Yes, the part about .get was meant for tests only. Thanks for clarifying.