bod
12/28/2017, 6:00 PMjkbbwr
12/28/2017, 6:10 PMkarelpeeters
12/28/2017, 6:11 PMbod
12/28/2017, 6:12 PM!! would be useful 🙂bod
12/28/2017, 6:13 PMShawn
12/28/2017, 6:19 PMShawn
12/28/2017, 6:20 PMShawn
12/28/2017, 6:23 PMcedric
12/28/2017, 9:38 PMnull but the compiler doesn't, I'll throw in a null test else throw some exceptionkarelpeeters
12/28/2017, 9:41 PM!! though.cedric
12/28/2017, 9:42 PMcedric
12/28/2017, 9:42 PM?.let { nonNullableValcedric
12/28/2017, 9:43 PM?.let because it's an if without an else, and this has the potential to hide bugsgroostav
12/29/2017, 2:08 AMrequire(we.someProp != null) { "msg with domain significance" } infront of the methods in question.
validation on a POJO (data-class) seems to be a pretty obvious example. If you've got a validator and a service that expects only objects passed by the validator, and you dont want to map from a nullable-POJO to a non-nullable one your service is likely to be implemented with some pojo.someProperty!!.gildor
12/29/2017, 2:38 AMrequire(we.someProp != null) -> requireNotNull(we.someProp)bod
12/29/2017, 10:03 AM!! should be considered a code smell 🙂 Sometimes you just know with 100% certainty that a variable cannot be null, and testing its nullity will add noise (and possible confusion) to the code - that's when !! does absolutely make sense, and should be encouraged 🙂 Well that's my personal opinion about it anyway and I can understand if some people disagree 🙂