Inlining in Java

A couple of the other answers have suggested that only final methods can be inlined – this is not true, as HotSpot is smart enough to be able to inline non-final methods so long as they haven’t been overridden yet. When a class is loaded which overrides the method, it can undo its optimisation. Obviously … Read more