Example #1
1
    public static <T> Prop<T> cannonicalize(Prop<T> p) {
      Prop<T> prop = cannon.computeIfAbsent(p.name, x -> p);
      if (p.isCannon() && !prop.isCannon()) {
        cannon.put(p.name, p);
        prop = p;
      } else if (p.isCannon() && prop.isCannon() && p != prop) {
        // should be an Error?
        System.err.println(" WARNING: two competing canonical definitions of a Prop <" + p + ">");
        if (p.typeInformation != null && prop.typeInformation == null) {
          cannon.put(p.name, p);
          prop = p;
        } else if (p.typeInformation == null && prop.typeInformation != null) {

        } else if (p.typeInformation != null && prop.typeInformation != null) {
          if (!Conversions.typeInformationEquals(p.typeInformation, prop.typeInformation)) {
            System.err.println(
                " ERROR: the two competing canonical definitions of "
                    + p
                    + " have different type information");
            throw new IllegalArgumentException(
                p.typeInformation + " " + prop.typeInformation + " " + p + " " + prop);
          }
        }
      }
      prop.setCannon();
      return prop;
    }