Support const_get with inherit argument for java packages. Fixes #805