//each of the fields in the old definition that are also present in the
//new definition must have the same type. If not -> Incompatible
boolean allFieldsInOldDeclarationAreStillPresent = true;
for (FactField oldFactField : oldFields) {
FactField newFactField = newFieldsMap.get(oldFactField.getName());
if (newFactField != null){
//we can't use newFactField.getType() since it throws a NPE at this point.
String newFactType = ((FieldDefinition)newFactField).getTypeName();
if (!newFactType.equals(oldFactField.getType().getCanonicalName())){
throw new IncompatibleClassChangeError("Type Declaration "+newDeclaration.getTypeName()+"."+newFactField.getName()+" has a different"
+ " type that its previous definition: "+newFactType
+" != "+oldFactField.getType().getCanonicalName());
}
}else{
allFieldsInOldDeclarationAreStillPresent = false;