Posts

Showing posts from 2017

@Nullable and @NotNull Annotations in IntelliJ

Image
Every time I have to configure a new instance of IntelliJ I have to hunt for these settings to ensure that inspections catch possible NPEs to code annotated with @NotNull, so I'm  writing the steps here, The inspection is under Java -> Probable bugs -> Constant conditions & exceptions . You will also probably need to add the javax validation annotations, which can be done by clicking Configure annotations .

Is this code functional vomit?

Hi. My name is Matt, and I have pull-request-criticism-ophobia. I die a little inside every time someone tells me what I noob I have been when writing code. I am also a Java 8 developer, and have developed an interest in functional programing. One day I found the Optional class, and my life has been a living hell ever since. Here's why. I was tasked to write the following code: The method must convert an object of type ObjectA to an object of type ObjectD The conversion will be done via a number of service objects that will do the hard work of converting ObjectA to ObjectB, ObjectB to ObjectC, and ObjectC to ObjectD. These services do not throw exceptions, or throw only runtime exceptions. These services return a mixture of null or empty Optional objects to indicate that no conversion could take place. The method should return an empty Optional if the supplied ObjectA was null, or if any conversion returns null or an empty Optional. Because I have read no less than 3 b