// Especially important is that a CodePatch is always applied.
Attribute[] attribs = ret.getAttributes();
// It should never happen that the map used in generation is accessed.
AttributesPatch ap = AttributesPatch.generate(new Attribute[0],
attribs, null);
List<Attribute> attribL = ap.patch(new ArrayList<Attribute>(
Arrays.asList(attribs)), map);
ret = map.applyTo(ret);
ret.setAttributes(attribL.toArray(new Attribute[attribL.size()]));
return ret;
}