diff options
author | Thomas Watson | 2012-01-19 21:31:57 +0000 |
---|---|---|
committer | Thomas Watson | 2012-01-19 21:42:10 +0000 |
commit | 067838b4436df58a0572bea333ce0b4e321bb1ee (patch) | |
tree | 82b3fff267462dbd788a78c1017ba82c23982c1f /bundles | |
parent | 3de265620d8c370f7ca9470536e3a03f4414af19 (diff) | |
download | rt.equinox.framework-067838b4436df58a0572bea333ce0b4e321bb1ee.tar.gz rt.equinox.framework-067838b4436df58a0572bea333ce0b4e321bb1ee.tar.xz rt.equinox.framework-067838b4436df58a0572bea333ce0b4e321bb1ee.zip |
Bug 369137 - [R5] Remove proposed pre-release support.v20120119-2142
Diffstat (limited to 'bundles')
7 files changed, 61 insertions, 240 deletions
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/StateResolverTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/StateResolverTest.java index 0ad308417..9c0b84dad 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/StateResolverTest.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/StateResolverTest.java @@ -4499,7 +4499,7 @@ public class StateResolverTest extends AbstractStateTest { } } - public void testPreReleaseVersions() throws BundleException { + public void testRanges() throws BundleException { State state = buildEmptyState(); int bundleID = 0; @@ -4507,9 +4507,9 @@ public class StateResolverTest extends AbstractStateTest { manifest.clear(); manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "a"); //$NON-NLS-1$ - manifest.put(Constants.BUNDLE_VERSION, "1.0.0-SNAPSHOT"); //$NON-NLS-1$ - manifest.put(Constants.EXPORT_PACKAGE, "a; version=1.0.0-SNAPSHOT"); - manifest.put(Constants.PROVIDE_CAPABILITY, "test.a; version:Version=1.0.0-SNAPSHOT"); + manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ + manifest.put(Constants.EXPORT_PACKAGE, "a; version=1.0.0"); + manifest.put(Constants.PROVIDE_CAPABILITY, "test.a; version:Version=1.0.0"); BundleDescription a = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), bundleID++); manifest.clear(); @@ -4537,46 +4537,14 @@ public class StateResolverTest extends AbstractStateTest { manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "e"); //$NON-NLS-1$ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ - manifest.put(Constants.REQUIRE_CAPABILITY, "test.a; filter:=\"(version>=1.0.0-)\""); //$NON-NLS-1$ + manifest.put(Constants.REQUIRE_CAPABILITY, "test.a; filter:=\"(version>=1.0.0)\""); //$NON-NLS-1$ BundleDescription e = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), bundleID++); - manifest.clear(); - manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ - manifest.put(Constants.BUNDLE_SYMBOLICNAME, "f"); //$NON-NLS-1$ - manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ - manifest.put(Constants.FRAGMENT_HOST, "a; bundle-version=\"[1.0.0., 1.1)\""); //$NON-NLS-1$ - BundleDescription f = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), bundleID++); - - manifest.clear(); - manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ - manifest.put(Constants.BUNDLE_SYMBOLICNAME, "g"); //$NON-NLS-1$ - manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ - manifest.put(Constants.IMPORT_PACKAGE, "a; version=\"[1.0.0.,2.0)\""); //$NON-NLS-1$ - BundleDescription g = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), bundleID++); - - manifest.clear(); - manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ - manifest.put(Constants.BUNDLE_SYMBOLICNAME, "h"); //$NON-NLS-1$ - manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ - manifest.put(Constants.REQUIRE_BUNDLE, "a; bundle-version=\"[1.0.0.,2.0)\""); //$NON-NLS-1$ - BundleDescription h = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), bundleID++); - - manifest.clear(); - manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$ - manifest.put(Constants.BUNDLE_SYMBOLICNAME, "i"); //$NON-NLS-1$ - manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$ - manifest.put(Constants.REQUIRE_CAPABILITY, "test.a; filter:=\"(version>=1.0.0.)\""); //$NON-NLS-1$ - BundleDescription i = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + manifest.get(Constants.BUNDLE_VERSION), bundleID++); - state.addBundle(a); state.addBundle(b); state.addBundle(c); state.addBundle(d); state.addBundle(e); - state.addBundle(f); - state.addBundle(g); - state.addBundle(h); - state.addBundle(i); state.resolve(); assertTrue("A is not resolved", a.isResolved()); //$NON-NLS-1$ @@ -4584,11 +4552,6 @@ public class StateResolverTest extends AbstractStateTest { assertTrue("C is not resolved", c.isResolved()); //$NON-NLS-1$ assertTrue("D is not resolved", d.isResolved()); //$NON-NLS-1$ assertTrue("E is not resolved", e.isResolved()); //$NON-NLS-1$ - assertFalse("F is not resolved", f.isResolved()); //$NON-NLS-1$ - assertFalse("G is not resolved", g.isResolved()); //$NON-NLS-1$ - assertFalse("H is not resolved", h.isResolved()); //$NON-NLS-1$ - assertFalse("I is not resolved", i.isResolved()); //$NON-NLS-1$ - } } //testFragmentUpdateNoVersionChanged() diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/VersionRangeTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/VersionRangeTests.java index 3cf10768a..bea87897a 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/VersionRangeTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/VersionRangeTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2009 IBM Corporation and others. + * Copyright (c) 2004, 2012 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 @@ -17,7 +17,7 @@ import org.osgi.framework.Version; public class VersionRangeTests extends TestCase { public void testSingleVersionRange() { VersionRange range; - range = new VersionRange("[1.0.0., 1.0.0.-)"); //$NON-NLS-1$ + range = new VersionRange("[1.0.0, 1.0.0.-)"); //$NON-NLS-1$ assertEquals("0.1", Version.parseVersion("1.0"), range.getMinimum()); //$NON-NLS-1$ //$NON-NLS-2$ assertTrue("0.9", !range.isIncluded(Version.parseVersion("0.9"))); //$NON-NLS-1$ //$NON-NLS-2$ assertTrue("1.0", range.isIncluded(Version.parseVersion("1"))); //$NON-NLS-1$ //$NON-NLS-2$ @@ -62,7 +62,7 @@ public class VersionRangeTests extends TestCase { public void testNullMin() { VersionRange nullMin = new VersionRange(null, true, new Version("1.0"), false); //$NON-NLS-1$ assertNotNull("0.1", nullMin.getMinimum()); //$NON-NLS-1$ - assertEquals("0.2", Version.parseVersion("0.0.0-"), nullMin.getMinimum()); //$NON-NLS-1$ + assertEquals("0.2", Version.emptyVersion, nullMin.getMinimum()); //$NON-NLS-1$ assertTrue("1.0", nullMin.isIncluded(null)); //$NON-NLS-1$ assertTrue("1.1", nullMin.isIncluded(new Version("0.0"))); //$NON-NLS-1$ //$NON-NLS-2$ assertTrue("1.2", nullMin.isIncluded(new Version("0.9.9"))); //$NON-NLS-1$ //$NON-NLS-2$ diff --git a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/service/resolver/VersionRange.java b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/service/resolver/VersionRange.java index cbbc00861..3b1c6506b 100644 --- a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/service/resolver/VersionRange.java +++ b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/service/resolver/VersionRange.java @@ -28,7 +28,7 @@ public class VersionRange extends org.osgi.framework.VersionRange { * An empty version range: "0.0.0". The empty version range includes all valid versions * (any version greater than or equal to the version 0.0.0). */ - public static final VersionRange emptyRange = new VersionRange("0.0.0-"); //$NON-NLS-1$ + public static final VersionRange emptyRange = new VersionRange("0.0.0"); //$NON-NLS-1$ /** * Constructs a VersionRange with the specified minVersion and maxVersion. @@ -39,7 +39,7 @@ public class VersionRange extends org.osgi.framework.VersionRange { * is used. */ public VersionRange(Version minVersion, boolean includeMin, Version maxVersion, boolean includeMax) { - super(includeMin ? INCLUDE_MIN : EXCLUDE_MIN, minVersion == null ? new Version("0.0.0-") : minVersion, versionMax.equals(maxVersion) ? null : maxVersion, includeMax ? INCLUDE_MAX : EXCLUDE_MAX); //$NON-NLS-1$ + super(includeMin ? INCLUDE_MIN : EXCLUDE_MIN, minVersion == null ? Version.emptyVersion : minVersion, versionMax.equals(maxVersion) ? null : maxVersion, includeMax ? INCLUDE_MAX : EXCLUDE_MAX); } /** @@ -65,7 +65,7 @@ public class VersionRange extends org.osgi.framework.VersionRange { * @see Version#Version(String) definition of <code>version</code> */ public VersionRange(String versionRange) { - super(versionRange == null || versionRange.length() == 0 ? "0.0.0-" : versionRange); //$NON-NLS-1$ + super(versionRange == null || versionRange.length() == 0 ? "0.0.0" : versionRange); //$NON-NLS-1$ } /** diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Version.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Version.java index 2e5d0c45c..a87c21913 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Version.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Version.java @@ -33,14 +33,6 @@ import java.util.StringTokenizer; * </ol> * * <p> - * Versions can also be identified as release versions or pre-release versions. - * Given the same numerical components, the qualifiers of all pre-release - * version sort lower than the qualifiers of release versions. In the external - * format, {@code String}, of a version, release versions use {@code "."} to - * separate the numerical components from the qualifier and pre-release versions - * use {@code "-"} to separate the numerical components from the qualifier. - * - * <p> * {@code Version} objects are immutable. * * @since 1.3 @@ -53,14 +45,10 @@ public class Version implements Comparable<Version> { private final int minor; private final int micro; private final String qualifier; - private final boolean release; + private static final String SEPARATOR = "."; private transient String versionString /* default to null */; private transient int hash /* default to 0 */; - private static final String DOT_SEPARATOR = "."; - private static final String DASH_SEPARATOR = "-"; - private static final String QUALIFIER_SEPARATORS = DOT_SEPARATOR - + DASH_SEPARATOR; /** * The empty version "0.0.0". @@ -68,12 +56,10 @@ public class Version implements Comparable<Version> { public static final Version emptyVersion = new Version(0, 0, 0); /** - * Creates a release version identifier from the specified numerical - * components. + * Creates a version identifier from the specified numerical components. * * <p> - * The qualifier is set to the empty string and the version is a release - * version. + * The qualifier is set to the empty string. * * @param major Major component of the version identifier. * @param minor Minor component of the version identifier. @@ -82,26 +68,7 @@ public class Version implements Comparable<Version> { * negative. */ public Version(int major, int minor, int micro) { - this(major, minor, micro, null, true); - } - - /** - * Creates a release version identifier from the specified components. - * - * <p> - * The version is a release version. - * - * @param major Major component of the version identifier. - * @param minor Minor component of the version identifier. - * @param micro Micro component of the version identifier. - * @param qualifier Qualifier component of the version identifier. If - * {@code null} is specified, then the qualifier will be set to the - * empty string. - * @throws IllegalArgumentException If the numerical components are negative - * or the qualifier string is invalid. - */ - public Version(int major, int minor, int micro, String qualifier) { - this(major, minor, micro, qualifier, true); + this(major, minor, micro, null); } /** @@ -113,14 +80,10 @@ public class Version implements Comparable<Version> { * @param qualifier Qualifier component of the version identifier. If * {@code null} is specified, then the qualifier will be set to the * empty string. - * @param release {@code true} if a release version or {@code false} if a - * pre-release version. * @throws IllegalArgumentException If the numerical components are negative * or the qualifier string is invalid. - * @since 1.7 */ - public Version(int major, int minor, int micro, String qualifier, - boolean release) { + public Version(int major, int minor, int micro, String qualifier) { if (qualifier == null) { qualifier = ""; } @@ -129,7 +92,6 @@ public class Version implements Comparable<Version> { this.minor = minor; this.micro = micro; this.qualifier = qualifier; - this.release = release; validate(); } @@ -140,11 +102,11 @@ public class Version implements Comparable<Version> { * Version string grammar: * * <pre> - * version ::= major('.'minor('.'micro(('.'|'-')qualifier)?)?)? + * version ::= major('.'minor('.'micro('.'qualifier)?)?)? * major ::= digit+ * minor ::= digit+ * micro ::= digit+ - * qualifier ::= (alpha|digit|'_'|'-')* + * qualifier ::= (alpha|digit|'_'|'-')+ * digit ::= [0..9] * alpha ::= [a..zA..Z] * </pre> @@ -155,31 +117,13 @@ public class Version implements Comparable<Version> { * formatted. */ public Version(String version) { - this(version, true); - } - - /** - * Creates a version identifier from the specified string and specified - * default for release version. - * - * @param version String representation of the version identifier. There - * must be no whitespace in the argument. - * @param rel {@code true} if the parsed version should default to a release - * version or {@code false} if the parsed version should default to a - * pre-release version when the version has no qualifier. - * @throws IllegalArgumentException If {@code version} is improperly - * formatted. - * @since 1.7 - */ - private Version(String version, boolean rel) { int maj = 0; int min = 0; int mic = 0; String qual = ""; try { - StringTokenizer st = new StringTokenizer(version, DOT_SEPARATOR, - true); + StringTokenizer st = new StringTokenizer(version, SEPARATOR, true); maj = parseInt(st.nextToken(), version); if (st.hasMoreTokens()) { // minor @@ -188,18 +132,16 @@ public class Version implements Comparable<Version> { if (st.hasMoreTokens()) { // micro st.nextToken(); // consume delimiter - mic = parseInt(st.nextToken(QUALIFIER_SEPARATORS), version); + mic = parseInt(st.nextToken(), version); if (st.hasMoreTokens()) { // qualifier separator - rel = DOT_SEPARATOR.equals(st.nextToken()); - if (st.hasMoreTokens()) { // qualifier - qual = st.nextToken(""); // remaining string - - if (st.hasMoreTokens()) { // fail safe - throw new IllegalArgumentException( - "invalid version \"" + version - + "\": invalid format"); - } + st.nextToken(); // consume delimiter + qual = st.nextToken(""); // remaining string + + if (st.hasMoreTokens()) { // fail safe + throw new IllegalArgumentException( + "invalid version \"" + version + + "\": invalid format"); } } } @@ -216,7 +158,6 @@ public class Version implements Comparable<Version> { minor = min; micro = mic; qualifier = qual; - release = rel; validate(); } @@ -293,41 +234,16 @@ public class Version implements Comparable<Version> { * formatted. */ public static Version parseVersion(String version) { - return parseVersion(version, true); - } - - /** - * Parses a version identifier from the specified string and specified - * default for release version. - * - * <p> - * This method is used by {@link VersionRange} when parsing versions since - * the default for a release version varies depending upon left or right and - * open or closed endpoint. - * - * @param version String representation of the version identifier. Leading - * and trailing whitespace will be ignored. - * @param rel {@code true} if the parsed version should default to a release - * version or {@code false} if the parsed version should default to a - * pre-release version when the version has no qualifier. - * @return A {@code Version} object representing the version identifier. If - * {@code version} is {@code null} or the empty string then - * {@code emptyVersion} will be returned. - * @throws IllegalArgumentException If {@code version} is improperly - * formatted. - * @since 1.7 - */ - static Version parseVersion(String version, boolean rel) { if (version == null) { - return rel ? emptyVersion : new Version(0, 0, 0, null, false); + return emptyVersion; } version = version.trim(); if (version.length() == 0) { - return rel ? emptyVersion : new Version(0, 0, 0, null, false); + return emptyVersion; } - return new Version(version, rel); + return new Version(version); } /** @@ -367,26 +283,12 @@ public class Version implements Comparable<Version> { } /** - * Returns {@code true} if the version is a release version and - * {@code false} if the version is a pre-release version. - * - * @return {@code true} if the version is a release version and - * {@code false} if the version is a pre-release version. - * @since 1.7 - */ - public boolean isReleaseVersion() { - return release; - } - - /** * Returns the string representation of this version identifier. * * <p> - * The format of the version string will be - * {@code major.minor.micro.qualifier} if it is a - * {@link #isReleaseVersion() release version} or - * {@code major.minor.micro-qualifier} if the version is a pre-release - * version. + * The format of the version string will be {@code major.minor.micro} + * if qualifier is the empty string or + * {@code major.minor.micro.qualifier} otherwise. * * @return The string representation of this version identifier. */ @@ -399,55 +301,25 @@ public class Version implements Comparable<Version> { * * @return The string representation of this version identifier. */ - private String toString0() { + String toString0() { if (versionString != null) { return versionString; } int q = qualifier.length(); StringBuffer result = new StringBuffer(20 + q); result.append(major); - result.append(DOT_SEPARATOR); + result.append(SEPARATOR); result.append(minor); - result.append(DOT_SEPARATOR); + result.append(SEPARATOR); result.append(micro); - if (release) { - if (q > 0) { - result.append(DOT_SEPARATOR); - result.append(qualifier); - } - } - else { - result.append(DASH_SEPARATOR); + if (q > 0) { + result.append(SEPARATOR); result.append(qualifier); } return versionString = result.toString(); } /** - * Package private method to append the version string to the specified - * string buffer. - * - * @param buf The string buffer to receive the version string. - * @param emptyQualifier Append empty qualifier if true, otherwise do not - * append empty qualifier. - */ - void appendTo(StringBuffer buf, boolean emptyQualifier) { - buf.append(toString0()); - if ((qualifier.length() == 0)) { - if (emptyQualifier) { - if (release) { - buf.append(DOT_SEPARATOR); // add trailing dot - } - } - else { - if (!release) { - buf.setLength(buf.length() - 1); // strip off trailing dash - } - } - } - } - - /** * Returns a hash code value for the object. * * @return An integer which is a hash code value for this object. @@ -456,7 +328,7 @@ public class Version implements Comparable<Version> { if (hash != 0) { return hash; } - int h = release ? 31 * 17 : 31 * 19; + int h = 31 * 17; h = 31 * h + major; h = 31 * h + minor; h = 31 * h + micro; @@ -469,9 +341,8 @@ public class Version implements Comparable<Version> { * * <p> * A version is considered to be <b>equal to </b> another version if the - * major, minor and micro components are equal, the qualifier component is - * equal (using {@code String.equals}) and both versions are release or - * pre-release. + * major, minor and micro components are equal and the qualifier component + * is equal (using {@code String.equals}). * * @param object The {@code Version} object to be compared. * @return {@code true} if {@code object} is a {@code Version} and is equal @@ -488,8 +359,7 @@ public class Version implements Comparable<Version> { Version other = (Version) object; return (major == other.major) && (minor == other.minor) - && (micro == other.micro) && (release == other.release) - && qualifier.equals(other.qualifier); + && (micro == other.micro) && qualifier.equals(other.qualifier); } /** @@ -501,17 +371,14 @@ public class Version implements Comparable<Version> { * major components are equal and its minor component is less than the other * version's minor component, or the major and minor components are equal * and its micro component is less than the other version's micro component, - * or the major, minor and micro components are equal and it's a pre-release - * version and the other version is a release version, or the major, minor - * and micro components are equal and both versions are release or - * pre-release and it's qualifier component is less than the other version's - * qualifier component (using {@code String.compareTo}). + * or the major, minor and micro components are equal and it's qualifier + * component is less than the other version's qualifier component (using + * {@code String.compareTo}). * * <p> * A version is considered to be <b>equal to</b> another version if the - * major, minor and micro components are equal, both versions are release or - * pre-release and the qualifier components are equal (using - * {@code String.compareTo}). + * major, minor and micro components are equal and the qualifier component + * is equal (using {@code String.compareTo}). * * @param other The {@code Version} object to be compared. * @return A negative integer, zero, or a positive integer if this version @@ -540,11 +407,6 @@ public class Version implements Comparable<Version> { return result; } - result = (release ? 1 : 0) - (other.release ? 1 : 0); - if (result != 0) { - return result; - } - return qualifier.compareTo(other.qualifier); } } diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/VersionRange.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/VersionRange.java index 2c9be7251..c3657c530 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/VersionRange.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/VersionRange.java @@ -154,13 +154,13 @@ public class VersionRange { } leftClosed = true; rightClosed = false; - left = parseVersion(token, false, range); + left = parseVersion(token, range); right = null; empty = false; return; } String version = st.nextToken(ENDPOINT_DELIMITER); - endpointLeft = parseVersion(version, !closedLeft, range); + endpointLeft = parseVersion(version, range); token = st.nextToken(); // consume comma version = st.nextToken(RIGHT_DELIMITERS); token = st.nextToken(); // right delim @@ -169,7 +169,7 @@ public class VersionRange { throw new IllegalArgumentException("invalid range \"" + range + "\": invalid format"); } - endpointRight = parseVersion(version, closedRight, range); + endpointRight = parseVersion(version, range); if (st.hasMoreTokens()) { // any more tokens have to be whitespace token = st.nextToken("").trim(); @@ -197,14 +197,12 @@ public class VersionRange { * Parse version component into a Version. * * @param version version component string - * @param rel version is a release version * @param range Complete range string for exception message, if any * @return Version */ - private static Version parseVersion(String version, boolean rel, - String range) { + private static Version parseVersion(String version, String range) { try { - return Version.parseVersion(version, rel); + return Version.parseVersion(version); } catch (IllegalArgumentException e) { IllegalArgumentException iae = new IllegalArgumentException( @@ -372,16 +370,16 @@ public class VersionRange { String leftVersion = left.toString(); if (right == null) { StringBuffer result = new StringBuffer(leftVersion.length() + 1); - left.appendTo(result, !(leftClosed ^ left.isReleaseVersion())); + result.append(left.toString0()); return versionRangeString = result.toString(); } String rightVerion = right.toString(); StringBuffer result = new StringBuffer(leftVersion.length() + rightVerion.length() + 5); result.append(leftClosed ? LEFT_CLOSED : LEFT_OPEN); - left.appendTo(result, !(leftClosed ^ left.isReleaseVersion())); + result.append(left.toString0()); result.append(ENDPOINT_DELIMITER); - right.appendTo(result, rightClosed ^ right.isReleaseVersion()); + result.append(right.toString0()); result.append(rightClosed ? RIGHT_CLOSED : RIGHT_OPEN); return versionRangeString = result.toString(); } @@ -473,14 +471,14 @@ public class VersionRange { result.append('('); result.append(attributeName); result.append(">="); - left.appendTo(result, true); + result.append(left.toString0()); result.append(')'); } else { result.append("(!("); result.append(attributeName); result.append("<="); - left.appendTo(result, true); + result.append(left.toString0()); result.append("))"); } if (right != null) { @@ -488,14 +486,14 @@ public class VersionRange { result.append('('); result.append(attributeName); result.append("<="); - right.appendTo(result, true); + result.append(right.toString0()); result.append(')'); } else { result.append("(!("); result.append(attributeName); result.append(">="); - right.appendTo(result, true); + result.append(right.toString0()); result.append("))"); } result.append(')'); diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateReader.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateReader.java index ecb33a96c..a0daa4335 100644 --- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateReader.java +++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateReader.java @@ -47,7 +47,7 @@ final class StateReader { private volatile int numBundles; private volatile boolean accessedFlag = false; - public static final byte STATE_CACHE_VERSION = 38; + public static final byte STATE_CACHE_VERSION = 37; public static final byte NULL = 0; public static final byte OBJECT = 1; public static final byte INDEX = 2; @@ -713,8 +713,7 @@ final class StateReader { int minorComponent = in.readInt(); int serviceComponent = in.readInt(); String qualifierComponent = readString(in, false); - boolean release = in.readBoolean(); - Version result = (Version) ObjectPool.intern(new Version(majorComponent, minorComponent, serviceComponent, qualifierComponent, release)); + Version result = (Version) ObjectPool.intern(new Version(majorComponent, minorComponent, serviceComponent, qualifierComponent)); //Version result = new Version(majorComponent, minorComponent, serviceComponent, qualifierComponent); return result; } diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateWriter.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateWriter.java index 1b9351801..4daa34f6e 100644 --- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateWriter.java +++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateWriter.java @@ -651,7 +651,6 @@ class StateWriter { out.writeInt(version.getMinor()); out.writeInt(version.getMicro()); writeQualifier(version.getQualifier(), out); - out.writeBoolean(version.isReleaseVersion()); } private void writeVersionRange(VersionRange versionRange, DataOutputStream out) throws IOException { |