Starting from
Java 5 Java language departed from WYCIWYG (What You See is What You Get) principle and introduced some new features that violated that principle. In hind sight it was well justified. Good example of some feature is "try with resources" block (introduced in java 7) that closes all closeable resources opened in the try block. So now programmers don't have to write "finally" clause with another "try-catch" within it to close the resources and catch possible exceptions there. But the downside is that people who never wrote that annoying "finally" clause may not fully understand how it works, and that was the value of WYCIWYG.
So I would like to discuss some not very obvious pitfall with Inboxing feature. Inboxing is when there is a method that accepts a primitive parameter - such as int, but the invoker of the method passes an Instance of a corresponding class - such as Integer into the method. Java compiler and a runtime will automatically convert Integer instance into primitive int and pass into the method. So the programmer doesn't have to worry about doing it. So it is transparent.
But what would happen if there is a variable of type Integer and its value is null, and such a variable is passed as a parameter into a method receiving int? Well, behind the scene the method
will be called on the Integer variable to convert it to int. But since Our variable has a null value a NullPointerException will occur at the line where the method is invoked, and the control will never even be passed to the method itself. I don't think that it is very obvious and transparent behavior. And that is the price we all pay for this nice feature and for departing from WYCIWYG. But as always this a trade off situation - you get something you loose something.