diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/IProductDescriptor.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/IProductDescriptor.java
index e4789aec46..d92fd5edbc 100644
--- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/IProductDescriptor.java
+++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/IProductDescriptor.java
@@ -50,21 +50,15 @@ public interface IProductDescriptor {
/**
* Returns the bundles listed in this product. Note: These bundles are only part of
* the product if {@link #useFeatures()} returns false
.
- * @param includeFragments whether or not to include the fragments in the return value
* @return the list of bundles in this product.
*/
- public List getBundles(boolean includeFragments);
+ public List getBundles();
/**
- * Returns true
when getBundles(includeFragments)
returns a non-empty list.
+ * Returns true
when {@link #getBundles()} returns a non-empty
+ * list.
*/
- public boolean hasBundles(boolean includeFragments);
-
- /**
- * Returns the fragments listed in the product.
- * @see #useFeatures()
- */
- public List getFragments();
+ public boolean hasBundles();
/**
* Returns the features listed in the product. Same as getFeatures(INCLUDED_FEATURES)
. Note: These features are only part of
diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ProductFile.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ProductFile.java
index de22105174..3732030dbc 100644
--- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ProductFile.java
+++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ProductFile.java
@@ -190,7 +190,6 @@ public class ProductFile extends DefaultHandler implements IProductDescriptor {
private String uid = null;
private ProductContentType productContentType = null;
protected List plugins = new ArrayList<>();
- protected List fragments = new ArrayList<>();
private final List features = new ArrayList<>();
private final List rootFeatures = new ArrayList<>();
private String splashLocation = null;
@@ -343,38 +342,20 @@ public Map getConfigurationProperties(String os, String arch) {
/**
* Returns a List for each bundle that makes up this product.
- * @param includeFragments Indicates whether or not fragments should
- * be included in the list
*/
@Override
- public List getBundles(boolean includeFragments) {
- List result = new LinkedList<>();
-
+ public List getBundles() {
+ List result = new ArrayList<>();
for (FeatureEntry plugin : plugins) {
result.add(new VersionedId(plugin.getId(), plugin.getVersion()));
}
-
- if (includeFragments) {
- for (FeatureEntry fragment : fragments) {
- result.add(new VersionedId(fragment.getId(), fragment.getVersion()));
- }
- }
-
return result;
}
@Override
- public boolean hasBundles(boolean includeFragments) {
+ public boolean hasBundles() {
// implement directly; don't call the potentially overridden getBundles
- return !plugins.isEmpty() || (includeFragments && !fragments.isEmpty());
- }
-
- private List getBundleEntries(boolean includeFragments) {
- List result = new LinkedList<>();
- result.addAll(plugins);
- if (includeFragments)
- result.addAll(fragments);
- return result;
+ return !plugins.isEmpty();
}
/**
@@ -387,20 +368,6 @@ public List getBundleInfos() {
return bundleInfos != null ? bundleInfos : Collections.emptyList();
}
- /**
- * Returns a list of fragments that constitute this product.
- */
- @Override
- public List getFragments() {
- List result = new LinkedList<>();
-
- for (FeatureEntry fragment : fragments) {
- result.add(new VersionedId(fragment.getId(), fragment.getVersion()));
- }
-
- return result;
- }
-
/**
* Returns a List of features that constitute this product.
*/
@@ -417,7 +384,7 @@ public boolean hasFeatures() {
@Override
public List getFeatures(int options) {
- List result = new LinkedList<>();
+ List result = new ArrayList<>();
if ((options & INCLUDED_FEATURES) != 0) {
for (FeatureEntry feature : features) {
@@ -435,13 +402,13 @@ public List getFeatures(int options) {
public List getProductEntries() {
if (useFeatures()) {
- return features;
+ return Collections.unmodifiableList(features);
}
- return getBundleEntries(true);
+ return Collections.unmodifiableList(plugins);
}
public boolean containsPlugin(String plugin) {
- List bundles = getBundles(true);
+ List bundles = getBundles();
for (IVersionedId versionedId : bundles) {
if (versionedId.getId().equals(plugin)) {
return true;
@@ -1274,12 +1241,7 @@ protected void processPlugin(Attributes attributes) {
FeatureEntry entry = new FeatureEntry(pluginId, pluginVersion != null ? pluginVersion : GENERIC_VERSION_NUMBER, true);
entry.setFragment(Boolean.parseBoolean(fragment));
-
- if (fragment != null && Boolean.parseBoolean(fragment)) {
- fragments.add(entry);
- } else {
- plugins.add(entry);
- }
+ plugins.add(entry);
}
private void processFeature(Attributes attributes) {
diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ProductAction.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ProductAction.java
index 8515de76c2..75a614191c 100644
--- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ProductAction.java
+++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ProductAction.java
@@ -179,17 +179,17 @@ private void createRootAdvice() {
switch (product.getProductContentType()) { // add new case for each new content type included in product
case MIXED : // include all content types
list = versionElements(listElements(product.getFeatures(), ".feature.group"), IInstallableUnit.NAMESPACE_IU_ID); //$NON-NLS-1$
- list.addAll(versionElements(listElements(product.getBundles(true), null), IInstallableUnit.NAMESPACE_IU_ID));
+ list.addAll(versionElements(listElements(product.getBundles(), null), IInstallableUnit.NAMESPACE_IU_ID));
break;
case FEATURES : // include features only
list = versionElements(listElements(product.getFeatures(), ".feature.group"), IInstallableUnit.NAMESPACE_IU_ID); //$NON-NLS-1$
- if (product.hasBundles(true)) {
+ if (product.hasBundles()) {
finalStatus.add(new Status(IStatus.INFO, Activator.ID, Messages.bundlesInProductFileIgnored));
}
break;
case BUNDLES : // include bundles only
- list = versionElements(listElements(product.getBundles(true), null), IInstallableUnit.NAMESPACE_IU_ID);
+ list = versionElements(listElements(product.getBundles(), null), IInstallableUnit.NAMESPACE_IU_ID);
if (product.hasFeatures()) {
finalStatus.add(new Status(IStatus.INFO, Activator.ID, Messages.featuresInProductFileIgnored));
diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ProductFileAdvice.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ProductFileAdvice.java
index 19258375bb..9f79cd5188 100644
--- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ProductFileAdvice.java
+++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ProductFileAdvice.java
@@ -227,7 +227,7 @@ private void addProductFileBundles(ProductConfigData productConfigData) {
if (product.useFeatures()) {
return;
}
- List bundles = product.getBundles(true);
+ List bundles = product.getBundles();
Set set = new HashSet<>();
set.addAll(Arrays.asList(productConfigData.data.getBundles()));
@@ -247,7 +247,7 @@ private ConfigData generateConfigData() {
// Add all the bundles here. We replace / update them later
// if we find configuration information
- List bundles = product.getBundles(true);
+ List bundles = product.getBundles();
for (IVersionedId vid : bundles) {
BundleInfo bundleInfo = new BundleInfo();
bundleInfo.setSymbolicName(vid.getId());
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductFileTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductFileTest.java
index e155518adb..1f18df222e 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductFileTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductFileTest.java
@@ -98,12 +98,12 @@ public void testGetConfigurationProperties() {
*/
@Test
public void testGetBundles() {
- List bundles = productFile.getBundles(false);
- assertEquals("1.0", 1, bundles.size());
- assertEquals("1.1", "org.eclipse.core.runtime", bundles.get(0).getId());
- assertEquals("1.2", Version.createOSGi(1, 0, 4), bundles.get(0).getVersion());
- bundles = productFile.getBundles(true);
- assertEquals("1.3", 2, bundles.size());
+ List bundles = productFile.getBundles();
+ assertEquals(2, bundles.size());
+ assertEquals("org.eclipse.core.runtime", bundles.get(0).getId());
+ assertEquals(Version.createOSGi(1, 0, 4), bundles.get(0).getVersion());
+ assertEquals("org.eclipse.swt.win32.win32.x86", bundles.get(1).getId());
+ assertEquals(Version.emptyVersion, bundles.get(1).getVersion());
}
/**
@@ -120,17 +120,6 @@ public void testGetBundleInfos() {
assertTrue("1.3", info.isMarkedAsStarted());
}
- /**
- * Test method for
- * {@link org.eclipse.equinox.internal.p2.publisher.eclipse.ProductFile#getFragments()}.
- */
- @Test
- public void testGetFragments() {
- List fragments = productFile.getFragments();
- assertEquals("1.0", 1, fragments.size());
- assertEquals("1.1", "org.eclipse.swt.win32.win32.x86", fragments.get(0).getId());
- }
-
/**
* Test method for
* {@link org.eclipse.equinox.internal.p2.publisher.eclipse.ProductFile#getFeatures()}.
@@ -168,24 +157,21 @@ public void testGetFeaturesOnlyReturnsIncludedFeatures() {
public void testHasFeatures() throws Exception {
ProductFile featuresOnly = new ProductFile(TestData.getFile("ProductActionTest", "onlyFeatures.product").toString());
assertTrue(featuresOnly.hasFeatures());
- assertFalse(featuresOnly.hasBundles(false));
- assertFalse(featuresOnly.hasBundles(true));
+ assertFalse(featuresOnly.hasBundles());
}
@Test
public void testHasBundles() throws Exception {
ProductFile bundlesOnly = new ProductFile(TestData.getFile("ProductActionTest", "onlyBundles.product").toString());
assertFalse(bundlesOnly.hasFeatures());
- assertTrue(bundlesOnly.hasBundles(false));
- assertTrue(bundlesOnly.hasBundles(true));
+ assertTrue(bundlesOnly.hasBundles());
}
@Test
public void testHasFragments() throws Exception {
ProductFile bundlesOnly = new ProductFile(TestData.getFile("ProductActionTest", "onlyFragments.product").toString());
assertFalse(bundlesOnly.hasFeatures());
- assertFalse(bundlesOnly.hasBundles(false));
- assertTrue(bundlesOnly.hasBundles(true));
+ assertTrue(bundlesOnly.hasBundles());
}
/**