Does Java JIT compiler remove method's call without side effects? -


i have simple method check if input string valid xpath

private boolean isxpath(string value) {     boolean isxpath = true;     try {         xpath xpath = xpathfactory.newinstance().newxpath();         xpath.compile(value);     } catch (xpathexpressionexception e) {         isxpath = false;     }     return isxpath; } 

can sure jit compiler won't remove code inside try block, because of has no side effects? or has (possible exception)?

dead code eliminatino not side-effects, using result of computation. since method returns isxpath, cannot derived without executing try block, impossible jit compiler eliminate it.


Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -