hints.put(EncodeHintType.MARGIN, 2);
改为泛型Map<EncodeHintType, Object> hints = new HashMap<EncodeHintType, Object>();