Some clumsy extend for Java