[java] Do not implement / extend erased interfaces and classes. Closes #2828