boolean (@NotNull TypeConstraint other) { if (other == BOTTOM) return true; if (other instanceof Constrained that) { if (!that.myNotInstanceOf.containsAll(myNotInstanceOf)) { if (that.myInstanceOf.isEmpty()) return false; for (Exact thisNotType : this.myNotInstanceOf) { if (!that.myNotInstanceOf.contains(thisNotType)) { for (Exact thatType : that.myInstanceOf) { if (thisNotType.isConvertibleFrom(thatType)) { return false; } } } } } if (that.myInstanceOf.containsAll(myInstanceOf)) return true; if (that.myInstanceOf.isEmpty()) return myInstanceOf.isEmpty(); for (Exact thatType : that.myInstanceOf) { for (Exact thisType : this.myInstanceOf) { if (!thisType.isAssignableFrom(thatType)) { return false; } } } return true; } else if (other instanceof Exact otherType) { for (Exact thisInstance : this.myInstanceOf) { if (!thisInstance.isAssignableFrom(otherType)) { return false; } } for (Exact thisNotInstance : this.myNotInstanceOf) { if (thisNotInstance.isAssignableFrom(otherType)) { return false; } } return true; } return false; }