Problem/Motivation
The EntityViewBuilder::getBuildDefaults has an $entity parameter that should respect the EntityInterface.
Yet in the getBuildDefaults() method there's a call on the $entity object to a method that's not on the EntityInterface:
$entity->isDefaultRevision();
isDefaultRevision() lives on the ContentEntityBase but EntityViewBuilder might be used by a ConfigEntityBase.
This may result in an error Error: Call to undefined method Drupal\my_module\Entity\MyConfigEntity::isDefaultRevision() in EntityViewBuilder.php on line 181
Proposed resolution
We should check if the entity is an instance of RevisionableInterface first:
$entity instanceof RevisionableInterface