TupleTypeInfo extends TupleTypeInfoBase<T> { @Override public boolean equals(Object obj) { if (obj instanceof TupleTypeInfo) { @SuppressWarnings("unchecked") TupleTypeInfo<T> other = (TupleTypeInfo<T>) obj; return other.canEqual(this) && super.equals(other) && Arrays.equals(fieldNames, other.fieldNames); } else { return false; } } @SuppressWarnings("unchecked") @PublicEvolving  TupleTypeInfo(TypeInformation<?>... types); @PublicEvolving  TupleTypeInfo(Class<T> tupleType, TypeInformation<?>... types); @Override @PublicEvolving String[] getFieldNames(); @Override @PublicEvolving int getFieldIndex(String fieldName); @SuppressWarnings("unchecked") @Override @PublicEvolving TupleSerializer<T> createSerializer(ExecutionConfig executionConfig); @Override boolean equals(Object obj); @Override boolean canEqual(Object obj); @Override int hashCode(); @Override String toString(); @PublicEvolving static TupleTypeInfo<X> getBasicTupleTypeInfo(Class<?>... basicTypes); @SuppressWarnings("unchecked") @PublicEvolving static TupleTypeInfo<X> getBasicAndBasicValueTupleTypeInfo(Class<?>... basicTypes);  }
@Test public void testTupleTypeInfoSymmetricEqualityRelation() { TupleTypeInfo<Tuple1<Integer>> tupleTypeInfo = new TupleTypeInfo<>(BasicTypeInfo.INT_TYPE_INFO); TupleTypeInfoBase<Tuple1> anonymousTupleTypeInfo = new TupleTypeInfoBase<Tuple1>( (Class<Tuple1>)Tuple1.class, (TypeInformation<?>)BasicTypeInfo.INT_TYPE_INFO) { private static final long serialVersionUID = -7985593598027660836L; @Override public TypeSerializer<Tuple1> createSerializer(ExecutionConfig config) { return null; } @Override protected TypeComparatorBuilder<Tuple1> createTypeComparatorBuilder() { return null; } @Override public String[] getFieldNames() { return new String[0]; } @Override public int getFieldIndex(String fieldName) { return 0; } }; boolean tupleVsAnonymous = tupleTypeInfo.equals(anonymousTupleTypeInfo); boolean anonymousVsTuple = anonymousTupleTypeInfo.equals(tupleTypeInfo); Assert.assertTrue("Equality relation should be symmetric", tupleVsAnonymous == anonymousVsTuple); }