Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do Java 8 Compilers optimize Static Methods on an Interface as "Final?"

Tags:

java

javac

My specific question is: do compilers inline the Static Final Interface code within other compiled methods? I've been out of the loop for a while on this type of optimization, and wanted to know if this is still performed.

like image 439
Lukas Bradley Avatar asked Aug 23 '17 12:08

Lukas Bradley


1 Answers

javac will not inline anything - it does very little optimization anyway. The JIT might inline that indeed, depending on the fact if that method is hot enough and can be inlined and no threshold has been reached.

like image 164
Eugene Avatar answered Oct 04 '22 11:10

Eugene