code: private static void addMapping(Map<String, String> map, String key, String value, String kind) {
      String oldValue = map.put(key,  value);
      if (oldValue != null && !oldValue.equals(value)) {
        ErrorUtil.error(kind + " redefined; was \"" + oldValue + ", now " + value);
      }
    }
docs: Adds a class, method or package-prefix property to its map, reporting an error
  if that mapping was previously specified.