Remove use of getType() which requires java 1.8