This is an automated email from the ASF dual-hosted git repository. cziegeler pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-analyser.git
The following commit(s) were added to refs/heads/master by this push: new 04cc3ce SLING-12210 : Remove unused startLevel from BundleDescriptorImpl 04cc3ce is described below commit 04cc3ce2407ed73b8be9d3f5cc0af1ffcf80d4c0 Author: Carsten Ziegeler <cziege...@apache.org> AuthorDate: Fri Dec 22 07:04:12 2023 +0100 SLING-12210 : Remove unused startLevel from BundleDescriptorImpl --- .../feature/scanner/ContentPackageDescriptor.java | 1 - .../org/apache/sling/feature/scanner/Scanner.java | 4 ++-- .../feature/scanner/impl/BundleDescriptorImpl.java | 20 +++++--------------- .../feature/scanner/impl/ContentPackageScanner.java | 3 +-- .../task/impl/CheckBundleExportsImportsTest.java | 2 +- .../impl/CheckBundleUnversionedPackagesTest.java | 2 +- .../task/impl/CheckRequirementsCapabilitiesTest.java | 4 ++-- .../scanner/impl/BundleDescriptorImplTest.java | 4 ++-- 8 files changed, 14 insertions(+), 26 deletions(-) diff --git a/src/main/java/org/apache/sling/feature/scanner/ContentPackageDescriptor.java b/src/main/java/org/apache/sling/feature/scanner/ContentPackageDescriptor.java index 3157917..afa5554 100644 --- a/src/main/java/org/apache/sling/feature/scanner/ContentPackageDescriptor.java +++ b/src/main/java/org/apache/sling/feature/scanner/ContentPackageDescriptor.java @@ -19,7 +19,6 @@ package org.apache.sling.feature.scanner; import java.util.List; import java.util.Properties; -import org.apache.sling.feature.Artifact; import org.apache.sling.feature.Configuration; /** diff --git a/src/main/java/org/apache/sling/feature/scanner/Scanner.java b/src/main/java/org/apache/sling/feature/scanner/Scanner.java index 5b46880..a55f8bb 100644 --- a/src/main/java/org/apache/sling/feature/scanner/Scanner.java +++ b/src/main/java/org/apache/sling/feature/scanner/Scanner.java @@ -132,7 +132,7 @@ public class Scanner { throw new IOException("Unable to find file for " + bundle.getId()); } - desc = new BundleDescriptorImpl(bundle, file, startLevel); + desc = new BundleDescriptorImpl(bundle, file); this.cache.put(key, desc); } return desc; @@ -243,7 +243,7 @@ public class Scanner { if (headers != null) { Manifest manifest = new Manifest(); headers.forEach(manifest.getMainAttributes()::putValue); - BundleDescriptor desc = new BundleDescriptorImpl(bundle, artifactProvider, manifest, bundle.getStartOrder()); + BundleDescriptor desc = new BundleDescriptorImpl(bundle, artifactProvider, manifest); this.cache.put(key, desc); } } diff --git a/src/main/java/org/apache/sling/feature/scanner/impl/BundleDescriptorImpl.java b/src/main/java/org/apache/sling/feature/scanner/impl/BundleDescriptorImpl.java index e69dffa..8bd4c06 100644 --- a/src/main/java/org/apache/sling/feature/scanner/impl/BundleDescriptorImpl.java +++ b/src/main/java/org/apache/sling/feature/scanner/impl/BundleDescriptorImpl.java @@ -64,9 +64,6 @@ public class BundleDescriptorImpl /** The bundle version. */ private String bundleVersion; - /** The start level of this artifact. */ - private final int startLevel; - /** Manifest */ private final Manifest manifest; @@ -106,14 +103,12 @@ public class BundleDescriptorImpl * Constructor for a new descriptor * @param artifact The artifact * @param url The URL - * @param startLevel The start level * @throws IOException If the manifest can't be get * @throws NullPointerException If artifact is {@code null} */ public BundleDescriptorImpl(final Artifact artifact, - final URL url, - final int startLevel) throws IOException { - this(artifact, url, null, getManifest(url), startLevel); + final URL url) throws IOException { + this(artifact, url, null, getManifest(url)); } /** @@ -121,15 +116,13 @@ public class BundleDescriptorImpl * @param artifact The artifact * @param provider The artifact provider * @param manifest The manifest - * @param startLevel The start level * @throws IOException If the manifest can't be get * @throws NullPointerException If artifact is {@code null} */ public BundleDescriptorImpl(final Artifact artifact, final ArtifactProvider provider, - final Manifest manifest, - final int startLevel) throws IOException { - this(artifact, null, provider, manifest, startLevel); + final Manifest manifest) throws IOException { + this(artifact, null, provider, manifest); } /** @@ -138,18 +131,15 @@ public class BundleDescriptorImpl * @param url The URL * @param provider The artifact provider * @param manifest The manifest - * @param startLevel The start level * @throws IOException If the manifest can't be get * @throws NullPointerException If artifact is {@code null} */ public BundleDescriptorImpl(final Artifact artifact, final URL url, final ArtifactProvider provider, - final Manifest manifest, - final int startLevel) throws IOException { + final Manifest manifest) throws IOException { super(artifact.getId().toMvnId()); this.artifact = artifact; - this.startLevel = startLevel; this.artifactFile = url; this.artifactProvider = provider; if ( manifest == null ) { diff --git a/src/main/java/org/apache/sling/feature/scanner/impl/ContentPackageScanner.java b/src/main/java/org/apache/sling/feature/scanner/impl/ContentPackageScanner.java index 045b53a..44383d2 100644 --- a/src/main/java/org/apache/sling/feature/scanner/impl/ContentPackageScanner.java +++ b/src/main/java/org/apache/sling/feature/scanner/impl/ContentPackageScanner.java @@ -214,8 +214,7 @@ public class ContentPackageScanner { final Artifact bundle = new Artifact(extractArtifactId(packageArtifact.getId(), newFile)); bundle.setStartOrder(startLevel); - final BundleDescriptor info = new BundleDescriptorImpl(bundle, newFile.toURI().toURL(), - startLevel); + final BundleDescriptor info = new BundleDescriptorImpl(bundle, newFile.toURI().toURL()); bundle.getMetadata().put(ContentPackageDescriptorImpl.METADATA_PACKAGE, packageArtifact.getId().toMvnId()); bundle.getMetadata().put(ContentPackageDescriptorImpl.METADATA_PATH, contentPath); diff --git a/src/test/java/org/apache/sling/feature/analyser/task/impl/CheckBundleExportsImportsTest.java b/src/test/java/org/apache/sling/feature/analyser/task/impl/CheckBundleExportsImportsTest.java index ad2e4a5..dc16885 100644 --- a/src/test/java/org/apache/sling/feature/analyser/task/impl/CheckBundleExportsImportsTest.java +++ b/src/test/java/org/apache/sling/feature/analyser/task/impl/CheckBundleExportsImportsTest.java @@ -159,7 +159,7 @@ public class CheckBundleExportsImportsTest { private void fdAddBundle(FeatureDescriptor fd, String id, String file) throws IOException { BundleDescriptor bd1 = new BundleDescriptorImpl( - new Artifact(ArtifactId.fromMvnId(id)), new File(resourceRoot, file).toURI().toURL(), 0); + new Artifact(ArtifactId.fromMvnId(id)), new File(resourceRoot, file).toURI().toURL()); fd.getBundleDescriptors().add(bd1); } } diff --git a/src/test/java/org/apache/sling/feature/analyser/task/impl/CheckBundleUnversionedPackagesTest.java b/src/test/java/org/apache/sling/feature/analyser/task/impl/CheckBundleUnversionedPackagesTest.java index 3b80692..0757b6c 100644 --- a/src/test/java/org/apache/sling/feature/analyser/task/impl/CheckBundleUnversionedPackagesTest.java +++ b/src/test/java/org/apache/sling/feature/analyser/task/impl/CheckBundleUnversionedPackagesTest.java @@ -81,7 +81,7 @@ public class CheckBundleUnversionedPackagesTest { Artifact artifact = new Artifact(ArtifactId.fromMvnId(id)); artifact.setFeatureOrigins(origins); BundleDescriptor bd1 = new BundleDescriptorImpl( - artifact, new File(resourceRoot, file).toURI().toURL(), 0); + artifact, new File(resourceRoot, file).toURI().toURL()); fd.getBundleDescriptors().add(bd1); } } diff --git a/src/test/java/org/apache/sling/feature/analyser/task/impl/CheckRequirementsCapabilitiesTest.java b/src/test/java/org/apache/sling/feature/analyser/task/impl/CheckRequirementsCapabilitiesTest.java index b08e095..2142c64 100644 --- a/src/test/java/org/apache/sling/feature/analyser/task/impl/CheckRequirementsCapabilitiesTest.java +++ b/src/test/java/org/apache/sling/feature/analyser/task/impl/CheckRequirementsCapabilitiesTest.java @@ -45,7 +45,7 @@ public class CheckRequirementsCapabilitiesTest { BundleDescriptor bd1 = new BundleDescriptorImpl( new Artifact(ArtifactId.fromMvnId("g:b1:1.2.0")), - f.toURI().toURL(), 7); + f.toURI().toURL()); Feature feature = new Feature(ArtifactId.fromMvnId("a:b:1")); @@ -80,7 +80,7 @@ public class CheckRequirementsCapabilitiesTest { BundleDescriptor bd1 = new BundleDescriptorImpl( new Artifact(ArtifactId.fromMvnId("g:b1:1.2.0")), - f.toURI().toURL(), 7); + f.toURI().toURL()); Feature feature = new Feature(ArtifactId.fromMvnId("a:b:1")); FeatureDescriptor fd = new FeatureDescriptorImpl(feature); diff --git a/src/test/java/org/apache/sling/feature/scanner/impl/BundleDescriptorImplTest.java b/src/test/java/org/apache/sling/feature/scanner/impl/BundleDescriptorImplTest.java index b698942..cecd6ff 100644 --- a/src/test/java/org/apache/sling/feature/scanner/impl/BundleDescriptorImplTest.java +++ b/src/test/java/org/apache/sling/feature/scanner/impl/BundleDescriptorImplTest.java @@ -63,7 +63,7 @@ public class BundleDescriptorImplTest + "Bundle-ManifestVersion: 2\n" + "Export-Package: org.apache.sling;version=1.0,org.apache.felix;version=2.0\n"; URL f = new URL("jar:" + createBundle(bmf).toURI().toURL() + "!/"); - BundleDescriptorImpl bdf = new BundleDescriptorImpl(new Artifact(new ArtifactId("foo", "bar", "1.0", "bla", "bundle")), f, 1); + BundleDescriptorImpl bdf = new BundleDescriptorImpl(new Artifact(new ArtifactId("foo", "bar", "1.0", "bla", "bundle")), f); final Set<PackageInfo> infos = bdf.getExportedPackages(); assertEquals(2, infos.size()); assertPackageInfo(infos ,"org.apache.sling", Version.parseVersion("1.0")); @@ -94,7 +94,7 @@ public class BundleDescriptorImplTest File dir = createBundleFolder(bmf); try { URL f = dir.toURI().toURL(); - BundleDescriptorImpl bdf = new BundleDescriptorImpl(new Artifact(new ArtifactId("foo", "bar", "1.0", "bla", "bundle")), f, 1); + BundleDescriptorImpl bdf = new BundleDescriptorImpl(new Artifact(new ArtifactId("foo", "bar", "1.0", "bla", "bundle")), f); final Set<PackageInfo> infos = bdf.getExportedPackages(); assertEquals(2, infos.size()); assertPackageInfo(infos ,"org.apache.sling", Version.parseVersion("1.0"));