diff options
author | Thomas Watson | 2011-03-03 20:21:52 +0000 |
---|---|---|
committer | Thomas Watson | 2011-03-03 20:21:52 +0000 |
commit | 56c0d398d74165f0d5b8e674f7c81cf02d916a38 (patch) | |
tree | 78e60839842c84d8babc243c38d06dbe9d9d37ec | |
parent | c1b9a2afd553e0b7502775008cb1919ad043d557 (diff) | |
download | rt.equinox.framework-56c0d398d74165f0d5b8e674f7c81cf02d916a38.tar.gz rt.equinox.framework-56c0d398d74165f0d5b8e674f7c81cf02d916a38.tar.xz rt.equinox.framework-56c0d398d74165f0d5b8e674f7c81cf02d916a38.zip |
Bug 338240 - Unsatisfied constraint for ACTIVE bundle
2 files changed, 14 insertions, 3 deletions
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/SubstitutableExportsTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/SubstitutableExportsTest.java index 4d5d289cc..afb55cb6f 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/SubstitutableExportsTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/SubstitutableExportsTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2009 IBM Corporation and others. + * Copyright (c) 2003, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -2777,6 +2777,9 @@ public class SubstitutableExportsTest extends AbstractStateTest { assertEquals("dVisible not correct", aExports, dVisible); //$NON-NLS-1$ assertEquals("eVisible not correct", aExports, eVisible); //$NON-NLS-1$ assertEquals("fVisible not correct", aExports, fVisible); //$NON-NLS-1$ + + VersionConstraint[] unsatisfied = state.getStateHelper().getUnsatisfiedConstraints(a); + assertEquals("Should not have any unresolvable constraints", 0, unsatisfied.length); } } diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateHelperImpl.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateHelperImpl.java index 5f57914c9..df09e9a75 100644 --- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateHelperImpl.java +++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateHelperImpl.java @@ -190,7 +190,7 @@ public final class StateHelperImpl implements StateHelper { State containingState = bundle.getContainingState(); if (containingState == null) // it is a bug in the client to call this method when not attached to a state - throw new IllegalStateException("Does not belong to a state"); //$NON-NLS-1$ + throw new IllegalStateException("Does not belong to a state"); //$NON-NLS-1$ List<VersionConstraint> unsatisfied = new ArrayList<VersionConstraint>(); HostSpecification host = bundle.getHost(); if (host != null) @@ -202,8 +202,16 @@ public final class StateHelperImpl implements StateHelper { unsatisfied.add(requiredBundles[i]); ImportPackageSpecification[] packages = bundle.getImportPackages(); for (int i = 0; i < packages.length; i++) - if (!packages[i].isResolved() && !isResolvable(packages[i], hook)) + if (!packages[i].isResolved() && !isResolvable(packages[i], hook)) { + if (bundle.isResolved()) { + // if the bundle is resolved the check if the import is option. + // Here we assume that an unresolved mandatory import must have been dropped + // in favor of an export from the same bundle (bug 338240) + if (!ImportPackageSpecification.RESOLUTION_OPTIONAL.equals(packages[i].getDirective(Constants.RESOLUTION_DIRECTIVE))) + continue; + } unsatisfied.add(packages[i]); + } GenericSpecification[] generics = bundle.getGenericRequires(); for (int i = 0; i < generics.length; i++) if (!generics[i].isResolved() && !isResolvable(generics[i], hook)) |