code: private InstalledFeature addInstalledFeatureToCache(ExtensionId feature, String namespace,
          DefaultInstalledExtension installedExtension, boolean forceCreate)
      {
          Map<String, InstalledFeature> installedExtensionsForFeature =
              this.extensionNamespaceByFeature.get(feature.getId());
  
          if (installedExtensionsForFeature == null) {
              installedExtensionsForFeature = new HashMap<String, InstalledFeature>();
              this.extensionNamespaceByFeature.put(feature.getId(), installedExtensionsForFeature);
          }
  
          InstalledFeature installedFeature = installedExtensionsForFeature.get(namespace);
          if (forceCreate || installedFeature == null) {
              // Find or create root feature
              InstalledRootFeature rootInstalledFeature;
              if (installedExtension.getId().getId().equals(feature.getId())) {
                  rootInstalledFeature = new InstalledRootFeature(namespace);
              } else {
                  rootInstalledFeature = getInstalledFeatureFromCache(installedExtension.getId().getId(), namespace).root;
              }
  
              // Create new feature
              installedFeature = new InstalledFeature(rootInstalledFeature, feature);
  
              // Add new feature
              installedExtensionsForFeature.put(namespace, installedFeature);
          }
  
          if (installedExtension.isValid(namespace)) {
              installedFeature.root.extension = installedExtension;
          } else {
              installedFeature.root.invalidExtensions.add(installedExtension);
          }
  
          return installedFeature;
      }
docs: Get extension registered as installed for the provided feature and namespace or can register it if provided.
  <p>
  Only look at provide namespace and does take into account inheritance.
  
  @param feature the feature provided by the extension
  @param namespace the namespace where the extension is installed
  @param installedExtension the extension
  @return the installed extension informations