diff options
author | gjoranv <gv@verizonmedia.com> | 2019-07-17 12:24:33 +0200 |
---|---|---|
committer | gjoranv <gv@verizonmedia.com> | 2019-07-17 12:24:33 +0200 |
commit | aaa3d1dc83084691741e06313b68135a2923ff86 (patch) | |
tree | a5b65a56f7f3b53f01316a07b90afc729fc194f3 /bundle-plugin/src/main/java/com/yahoo/container/plugin/classanalysis | |
parent | 8844a8dce19e20c6dce434a8675a4646384f1a52 (diff) |
Move method for detecting missing packages to PackageTally
Diffstat (limited to 'bundle-plugin/src/main/java/com/yahoo/container/plugin/classanalysis')
-rw-r--r-- | bundle-plugin/src/main/java/com/yahoo/container/plugin/classanalysis/PackageTally.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/bundle-plugin/src/main/java/com/yahoo/container/plugin/classanalysis/PackageTally.java b/bundle-plugin/src/main/java/com/yahoo/container/plugin/classanalysis/PackageTally.java index 31e1f80b41d..71796929012 100644 --- a/bundle-plugin/src/main/java/com/yahoo/container/plugin/classanalysis/PackageTally.java +++ b/bundle-plugin/src/main/java/com/yahoo/container/plugin/classanalysis/PackageTally.java @@ -10,6 +10,7 @@ import java.util.HashSet; import java.util.Map; import java.util.Optional; import java.util.Set; +import java.util.stream.Collectors; /** * @author Tony Vaagenes @@ -41,6 +42,18 @@ public class PackageTally { } /** + * Returns the set of packages that is referenced from this tally, but not included in the given set of available packages. + * + * @param definedAndExportedPackages Set of available packages (usually all packages defined in the generated bundle's project + all exported packages of dependencies) + * @return The set of missing packages, that may cause problem when the bundle is deployed in an OSGi container runtime. + */ + public Set<String> referencedPackagesMissingFrom(Set<String> definedAndExportedPackages) { + return Sets.difference(referencedPackages(), definedAndExportedPackages).stream() + .filter(pkg -> !pkg.startsWith("java.")) + .collect(Collectors.toSet()); + } + + /** * Represents the classes for two package tallies that are deployed as a single unit. * <p> * ExportPackageAnnotations from this has precedence over the other. |