in generator/src/main/java/org/apache/kafka/message/checker/FieldSpecPairIterator.java [47:101]
public boolean hasNext() {
if (next != null) {
return true;
}
FieldSpec field1 = iterator1.hasNext() ? iterator1.next() : null;
while (field1 != null) {
FieldDomain domain1 = FieldDomain.of(field1, topLevelVersions1, topLevelVersions2);
switch (domain1) {
case MESSAGE1_ONLY:
field1 = iterator1.hasNext() ? iterator1.next() : null;
break;
case BOTH: {
FieldSpec field2 = iterator2.hasNext() ? iterator2.next() : null;
while (field2 != null) {
FieldDomain domain2 = FieldDomain.of(field2, topLevelVersions1, topLevelVersions2);
switch (domain2) {
case MESSAGE2_ONLY:
field2 = iterator2.hasNext() ? iterator2.next() : null;
break;
case BOTH:
next = new FieldSpecPair(field1, field2);
return true;
case MESSAGE1_ONLY:
case NEITHER:
throw new UnificationException("field2 " + field2.name() + " is present in " +
"message2, but should not be, based on its versions.");
}
}
field1 = iterator1.hasNext() ? iterator1.next() : null;
break;
}
case MESSAGE2_ONLY:
case NEITHER:
throw new UnificationException("field1 " + field1.name() + " is present in " +
"message1, but should not be, based on its versions.");
}
}
FieldSpec field2 = iterator2.hasNext() ? iterator2.next() : null;
while (field2 != null) {
FieldDomain domain2 = FieldDomain.of(field2, topLevelVersions1, topLevelVersions2);
switch (domain2) {
case MESSAGE1_ONLY:
case NEITHER:
throw new UnificationException("field2 " + field2.name() + " is present in " +
"message2, but should not be, based on its versions.");
case BOTH:
throw new UnificationException("field2 " + field2.name() + " should be present " +
"in message1, but is not, based on its versions.");
case MESSAGE2_ONLY:
field2 = iterator2.hasNext() ? iterator2.next() : null;
break;
}
}
return false;
}