Java backend: cached TermContext instances and hid its constructors
Java backend: minor opt
Java backend: minor cleanup