hook for java mode