XPathExpression<T> () { AbstractXPathCompiled<T> ret; try { @SuppressWarnings("unchecked") final AbstractXPathCompiled<T> c = (AbstractXPathCompiled<T>)super .clone(); ret = c; } catch (CloneNotSupportedException cnse) { throw new IllegalStateException( "Should never be getting a CloneNotSupportedException!", cnse); } Map<String, Map<String, Object>> vmt = new HashMap<>(); for (Map.Entry<String, Map<String, Object>> me : xvariables.entrySet()) { final Map<String, Object> cmap = new HashMap<>(me.getValue()); vmt.put(me.getKey(), cmap); } ret.xvariables = vmt; return ret; }