function validateCacheKey(realAddonInstance, treeType, newCacheKey) {
  let cacheKeyTracker = realAddonInstance[CACHE_KEY_FOR_TREE_TRACKER];

  if (!cacheKeyTracker) {
    cacheKeyTracker = {};
    realAddonInstance[CACHE_KEY_FOR_TREE_TRACKER] = cacheKeyTracker;
  }

  cacheKeyTracker[treeType] = treeType in cacheKeyTracker ? cacheKeyTracker[treeType] : newCacheKey;

  if (cacheKeyTracker[treeType] !== newCacheKey) {
    throw new Error(
      `[ember-cli] addon bundle caching can only be used on addons that have stable cache keys (previously \`${
        cacheKeyTracker[treeType]
      }\`, now \`${newCacheKey}\`; for addon \`${realAddonInstance.name}\` located at \`${
        realAddonInstance.packageRoot || realAddonInstance.root
      }\`)`
    );
  }
}
Validates that a new cache key for a given tree type matches the previous
cache key for the same tree type. To opt-in to bundle addon caching for
a given addon it's assumed that it returns stable cache keys; specifically
this is because the interplay between bundle addon caching and `ember-engines`
when transitive deduplication is enabled assumes stable cache keys, so we validate
for this case here.

@method validateCacheKey
@param {Addon} realAddonInstance The real addon instance
@param {string} treeType
@param {string} newCacheKey
@throws {Error} If the new cache key doesn't match the previous cache key