| The xar InstalledExtensionRepository component (XarInstalledExtensionRepository) returns null from both getBackwardDependencies methods when the extension is not a XAR extension. The InstalledExtensionRepository contract says these methods return an empty collection when no backward dependency is found, so code that gets this repository through the generic role and calls isEmpty() or iterates over the result fails with a NullPointerException. In addition, getBackwardDependencies(ExtensionId, boolean withOptional) ignores withOptional: it always calls getBackwardDependencies(ExtensionId), so optional backward dependencies are never returned for a XAR extension. Expected
- An empty collection (or map) is returned for an extension which is not a XAR.
- withOptional is passed through to the underlying repository.
SonarCloud reports this as possible NullPointerException}}s in callers such as {{OrphanedExtensionsResolver (rule javabugs:S2259). |