// A special-case of meet static NominalType pickSubclass(NominalType c1, NominalType c2) { if (c1 == null) { return c2; } if (c2 == null) { return c1; } if (c1.isNominalSubtypeOf(c2)) { return c1; } return c2.isNominalSubtypeOf(c1) ? c2 : null; }
// A special-case of join static NominalType pickSuperclass(NominalType c1, NominalType c2) { if (c1 == null || c2 == null) { return null; } if (c1.isNominalSubtypeOf(c2)) { return c2; } if (c1.isRawSubtypeOf(c2)) { return c2.instantiateGenericsWithUnknown(); } if (c2.isNominalSubtypeOf(c1)) { return c1; } if (c2.isRawSubtypeOf(c1)) { return c1.instantiateGenericsWithUnknown(); } return null; }