Fix #1846 : `isJava()` was not the right method to call