diff options
author | Thomas Watson | 2016-11-14 14:11:36 +0000 |
---|---|---|
committer | Thomas Watson | 2017-06-16 12:38:08 +0000 |
commit | f919cea9a25f4b6e05a9e04397c3254c51f85780 (patch) | |
tree | 2b5c8a8defae9a2cee2749ad5ae602c5c73e2d6e /bundles/org.eclipse.osgi/osgi | |
parent | 0af49fa8440cd17af48b6a54c5d52f6ea26267c9 (diff) | |
download | rt.equinox.framework-f919cea9a25f4b6e05a9e04397c3254c51f85780.tar.gz rt.equinox.framework-f919cea9a25f4b6e05a9e04397c3254c51f85780.tar.xz rt.equinox.framework-f919cea9a25f4b6e05a9e04397c3254c51f85780.zip |
Update framework API to the latest for R7.
Change-Id: I6c9d481175591949ba2791dc4000fb6be5639abb
Signed-off-by: Thomas Watson <tjwatson@us.ibm.com>
Diffstat (limited to 'bundles/org.eclipse.osgi/osgi')
54 files changed, 139 insertions, 123 deletions
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/packageinfo b/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/packageinfo deleted file mode 100644 index 7c8de0324..000000000 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/packageinfo +++ /dev/null @@ -1 +0,0 @@ -version 1.0 diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AdaptPermission.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AdaptPermission.java index e5adf8136..fbd938e9f 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AdaptPermission.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AdaptPermission.java @@ -266,9 +266,7 @@ public final class AdaptPermission extends BasicPermission { try { return FrameworkUtil.createFilter(filterString); } catch (InvalidSyntaxException e) { - IllegalArgumentException iae = new IllegalArgumentException("invalid filter"); - iae.initCause(e); - throw iae; + throw new IllegalArgumentException("invalid filter", e); } } diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AdminPermission.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AdminPermission.java index 9a3e460a5..d83883020 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AdminPermission.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AdminPermission.java @@ -565,9 +565,7 @@ public final class AdminPermission extends BasicPermission { try { return FrameworkUtil.createFilter(filterString); } catch (InvalidSyntaxException e) { - IllegalArgumentException iae = new IllegalArgumentException("invalid filter"); - iae.initCause(e); - throw iae; + throw new IllegalArgumentException("invalid filter", e); } } diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/CapabilityPermission.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/CapabilityPermission.java index de9811c5f..9b4fa23eb 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/CapabilityPermission.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/CapabilityPermission.java @@ -320,9 +320,7 @@ public final class CapabilityPermission extends BasicPermission { try { return FrameworkUtil.createFilter(filterString); } catch (InvalidSyntaxException e) { - IllegalArgumentException iae = new IllegalArgumentException("invalid filter"); - iae.initCause(e); - throw iae; + throw new IllegalArgumentException("invalid filter", e); } } diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Constants.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Constants.java index 6873c6f7d..b19bbfaf8 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Constants.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Constants.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2000, 2014). All Rights Reserved. + * Copyright (c) OSGi Alliance (2000, 2016). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -1809,4 +1809,25 @@ public interface Constants { * @since 1.8 */ String BUNDLE_LICENSE = "Bundle-License"; + + /** + * Manifest header identifying the bundle's developers. + * <p> + * The header value may be retrieved from the {@code Dictionary} object + * returned by the {@code Bundle.getHeaders} method. + * + * @since 1.9 + */ + String BUNDLE_DEVELOPERS = "Bundle-Developers"; + + /** + * Manifest header identifying the bundle's software configuration + * management system. + * <p> + * The header value may be retrieved from the {@code Dictionary} object + * returned by the {@code Bundle.getHeaders} method. + * + * @since 1.9 + */ + String BUNDLE_SCM = "Bundle-SCM"; } diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkUtil.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkUtil.java index 10ce2c345..3aeb4fcdf 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkUtil.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkUtil.java @@ -635,16 +635,14 @@ public class FrameworkUtil { try { parsedDNChain = parseDNchain(dnChain); } catch (RuntimeException e) { - IllegalArgumentException iae = new IllegalArgumentException("Invalid DN chain: " + toString(dnChain)); - iae.initCause(e); - throw iae; + throw new IllegalArgumentException( + "Invalid DN chain: " + toString(dnChain), e); } try { parsedDNPattern = parseDNchainPattern(pattern); } catch (RuntimeException e) { - IllegalArgumentException iae = new IllegalArgumentException("Invalid match pattern: " + pattern); - iae.initCause(e); - throw iae; + throw new IllegalArgumentException( + "Invalid match pattern: " + pattern, e); } return dnChainMatch(parsedDNChain, 0, parsedDNPattern, 0); } diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/PackagePermission.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/PackagePermission.java index 3ebb099ad..e31e93851 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/PackagePermission.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/PackagePermission.java @@ -343,9 +343,7 @@ public final class PackagePermission extends BasicPermission { try { return FrameworkUtil.createFilter(filterString); } catch (InvalidSyntaxException e) { - IllegalArgumentException iae = new IllegalArgumentException("invalid filter"); - iae.initCause(e); - throw iae; + throw new IllegalArgumentException("invalid filter", e); } } diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServicePermission.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServicePermission.java index e3b61611b..403cbc2e9 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServicePermission.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServicePermission.java @@ -350,9 +350,7 @@ public final class ServicePermission extends BasicPermission { try { return FrameworkUtil.createFilter(filterString); } catch (InvalidSyntaxException e) { - IllegalArgumentException iae = new IllegalArgumentException("invalid filter"); - iae.initCause(e); - throw iae; + throw new IllegalArgumentException("invalid filter", e); } } 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 c6b22d8ea..ff2de38ea 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 @@ -144,9 +144,8 @@ public class Version implements Comparable<Version> { } } } catch (NoSuchElementException e) { - IllegalArgumentException iae = new IllegalArgumentException("invalid version \"" + version + "\": invalid format"); - iae.initCause(e); - throw iae; + throw new IllegalArgumentException( + "invalid version \"" + version + "\": invalid format", e); } major = maj; @@ -167,9 +166,8 @@ public class Version implements Comparable<Version> { try { return Integer.parseInt(value); } catch (NumberFormatException e) { - IllegalArgumentException iae = new IllegalArgumentException("invalid version \"" + version + "\": non-numeric \"" + value + "\""); - iae.initCause(e); - throw iae; + throw new IllegalArgumentException("invalid version \"" + version + + "\": non-numeric \"" + value + "\"", e); } } 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 e7ab9047a..7121e2ea7 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 @@ -170,9 +170,8 @@ public class VersionRange { } } } catch (NoSuchElementException e) { - IllegalArgumentException iae = new IllegalArgumentException("invalid range \"" + range + "\": invalid format"); - iae.initCause(e); - throw iae; + throw new IllegalArgumentException( + "invalid range \"" + range + "\": invalid format", e); } leftClosed = closedLeft; @@ -193,9 +192,8 @@ public class VersionRange { try { return Version.valueOf(version); } catch (IllegalArgumentException e) { - IllegalArgumentException iae = new IllegalArgumentException("invalid range \"" + range + "\": " + e.getMessage()); - iae.initCause(e); - throw iae; + throw new IllegalArgumentException( + "invalid range \"" + range + "\": " + e.getMessage(), e); } } diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/dto/packageinfo b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/dto/packageinfo deleted file mode 100644 index ed9885d37..000000000 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/dto/packageinfo +++ /dev/null @@ -1 +0,0 @@ -version 1.8 diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/bundle/packageinfo b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/bundle/packageinfo deleted file mode 100644 index 3987f9c4e..000000000 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/bundle/packageinfo +++ /dev/null @@ -1 +0,0 @@ -version 1.1 diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/resolver/packageinfo b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/resolver/packageinfo deleted file mode 100644 index 7c8de0324..000000000 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/resolver/packageinfo +++ /dev/null @@ -1 +0,0 @@ -version 1.0 diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/service/packageinfo b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/service/packageinfo deleted file mode 100644 index 3987f9c4e..000000000 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/service/packageinfo +++ /dev/null @@ -1 +0,0 @@ -version 1.1 diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/weaving/packageinfo b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/weaving/packageinfo deleted file mode 100644 index 3987f9c4e..000000000 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/weaving/packageinfo +++ /dev/null @@ -1 +0,0 @@ -version 1.1 diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/launch/packageinfo b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/launch/packageinfo deleted file mode 100644 index ef7df68cb..000000000 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/launch/packageinfo +++ /dev/null @@ -1 +0,0 @@ -version 1.2 diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/packageinfo b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/packageinfo deleted file mode 100644 index 3987f9c4e..000000000 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/packageinfo +++ /dev/null @@ -1 +0,0 @@ -version 1.1 diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/packageinfo b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/packageinfo deleted file mode 100644 index 9bf47b655..000000000 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/packageinfo +++ /dev/null @@ -1 +0,0 @@ -version 1.9 diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/startlevel/dto/packageinfo b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/startlevel/dto/packageinfo deleted file mode 100644 index 7c8de0324..000000000 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/startlevel/dto/packageinfo +++ /dev/null @@ -1 +0,0 @@ -version 1.0 diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/startlevel/packageinfo b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/startlevel/packageinfo deleted file mode 100644 index 7c8de0324..000000000 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/startlevel/packageinfo +++ /dev/null @@ -1 +0,0 @@ -version 1.0 diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/dto/packageinfo b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/dto/packageinfo deleted file mode 100644 index 0117a56c1..000000000 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/dto/packageinfo +++ /dev/null @@ -1 +0,0 @@ -version 1.3 diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/packageinfo b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/packageinfo deleted file mode 100644 index ef7df68cb..000000000 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/packageinfo +++ /dev/null @@ -1 +0,0 @@ -version 1.2 diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Capability.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Capability.java index e79d11402..4c1f7f430 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Capability.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Capability.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2011, 2013). All Rights Reserved. + * Copyright (c) OSGi Alliance (2011, 2015). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -77,6 +77,7 @@ public interface Capability { * @return {@code true} if this {@code Capability} is equal to the other * object; {@code false} otherwise. */ + @Override boolean equals(Object obj); /** @@ -84,5 +85,6 @@ public interface Capability { * * @return The hashCode of this {@code Capability}. */ + @Override int hashCode(); } diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Requirement.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Requirement.java index 252221aea..210e42713 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Requirement.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Requirement.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2011, 2013). All Rights Reserved. + * Copyright (c) OSGi Alliance (2011, 2015). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -81,6 +81,7 @@ public interface Requirement { * @return {@code true} if this {@code Requirement} is equal to the other * object; {@code false} otherwise. */ + @Override boolean equals(Object obj); /** @@ -88,5 +89,6 @@ public interface Requirement { * * @return The hashCode of this {@code Requirement}. */ + @Override int hashCode(); } diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Resource.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Resource.java index c7b6462fb..6f13a1b53 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Resource.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Resource.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2011, 2013). All Rights Reserved. + * Copyright (c) OSGi Alliance (2011, 2015). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -73,6 +73,7 @@ public interface Resource { * @return {@code true} if this {@code Resource} is equal to the other * object; {@code false} otherwise. */ + @Override boolean equals(Object obj); /** @@ -80,5 +81,6 @@ public interface Resource { * * @return The hashCode of this {@code Resource}. */ + @Override int hashCode(); } diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Wire.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Wire.java index 6c248ea2b..a0d1c39e1 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Wire.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Wire.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2011, 2013). All Rights Reserved. + * Copyright (c) OSGi Alliance (2011, 2015). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -79,6 +79,7 @@ public interface Wire { * @return {@code true} if this {@code Wire} is equal to the other object; * {@code false} otherwise. */ + @Override boolean equals(Object obj); /** @@ -86,5 +87,6 @@ public interface Wire { * * @return The hashCode of this {@code Wire}. */ + @Override int hashCode(); } diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Wiring.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Wiring.java index 935272fa9..7cb138426 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Wiring.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Wiring.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2011, 2013). All Rights Reserved. + * Copyright (c) OSGi Alliance (2011, 2016). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ package org.osgi.resource; import java.util.List; + import org.osgi.annotation.versioning.ConsumerType; /** @@ -75,22 +76,20 @@ public interface Wiring { /** * Returns the requirements of this wiring. - * * <p> * Only requirements considered by the resolver are returned. For example, * requirements with {@link Namespace#REQUIREMENT_EFFECTIVE_DIRECTIVE * effective} directive not equal to {@link Namespace#EFFECTIVE_RESOLVE * resolve} are not returned. - * * <p> * A wiring for a non-fragment resource has a subset of the declared * requirements from the resource and all attached fragment resources. Not * all declared requirements may be present since some may be discarded. For - * example, if a package is declared to be optionally imported and is not - * actually imported, the requirement must be discarded. + * example, if a package is declared to be both exported and imported, only + * one is selected and the other is discarded. * * @param namespace The namespace of the requirements to return or - * {@code null} to return the requirements from all namespaces. + * {@code null} to return the requirements from all namespaces. * @return A list containing a snapshot of the {@link Requirement}s, or an * empty list if this wiring uses no requirements in the specified * namespace. For a given namespace, the list contains the diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/dto/packageinfo b/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/dto/packageinfo deleted file mode 100644 index 7c8de0324..000000000 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/dto/packageinfo +++ /dev/null @@ -1 +0,0 @@ -version 1.0 diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/packageinfo b/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/packageinfo deleted file mode 100644 index 7c8de0324..000000000 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/packageinfo +++ /dev/null @@ -1 +0,0 @@ -version 1.0 diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/BundleLocationCondition.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/BundleLocationCondition.java index 262e82a5b..8a79c1452 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/BundleLocationCondition.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/BundleLocationCondition.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2005, 2013). All Rights Reserved. + * Copyright (c) OSGi Alliance (2005, 2015). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -67,6 +67,7 @@ public class BundleLocationCondition { if (args.length != 1 && args.length != 2) throw new IllegalArgumentException("Illegal number of args: " + args.length); String bundleLocation = AccessController.doPrivileged(new PrivilegedAction<String>() { + @Override public String run() { return bundle.getLocation(); } diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/Condition.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/Condition.java index 87718d013..063aea77e 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/Condition.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/Condition.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2004, 2013). All Rights Reserved. + * Copyright (c) OSGi Alliance (2004, 2015). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -118,18 +118,22 @@ final class BooleanCondition implements Condition { this.satisfied = satisfied; } + @Override public boolean isPostponed() { return false; } + @Override public boolean isSatisfied() { return satisfied; } + @Override public boolean isMutable() { return false; } + @Override public boolean isSatisfied(Condition[] conds, Dictionary<Object, Object> context) { for (int i = 0, length = conds.length; i < length; i++) { if (!conds[i].isSatisfied()) diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionInfo.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionInfo.java index 3302f4293..63fc25a20 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionInfo.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionInfo.java @@ -143,7 +143,7 @@ public class ConditionInfo { } } } - this.args = argsList.toArray(new String[argsList.size()]); + this.args = argsList.toArray(new String[0]); /* the final character must be ']' */ char c = encoded[pos]; @@ -183,7 +183,7 @@ public class ConditionInfo { * @return The string encoding of this {@code ConditionInfo}. */ public final String getEncoded() { - StringBuffer output = new StringBuffer(); + StringBuilder output = new StringBuilder(); output.append('['); output.append(type); @@ -281,9 +281,9 @@ public class ConditionInfo { /** * This escapes the quotes, backslashes, \n, and \r in the string using a - * backslash and appends the newly escaped string to a StringBuffer. + * backslash and appends the newly escaped string to a StringBuilder. */ - private static void escapeString(String str, StringBuffer output) { + private static void escapeString(String str, StringBuilder output) { int len = str.length(); for (int i = 0; i < len; i++) { char c = str.charAt(i); @@ -310,7 +310,7 @@ public class ConditionInfo { * Takes an encoded character array and decodes it into a new String. */ private static String unescapeString(char[] str, int begin, int end) { - StringBuffer output = new StringBuffer(end - begin); + StringBuilder output = new StringBuilder(end - begin); for (int i = begin; i < end; i++) { char c = str[i]; if (c == '\\') { diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionalPermissionAdmin.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionalPermissionAdmin.java index ac911fc40..eee978dba 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionalPermissionAdmin.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionalPermissionAdmin.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2005, 2013). All Rights Reserved. + * Copyright (c) OSGi Alliance (2005, 2014). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -57,7 +57,7 @@ public interface ConditionalPermissionAdmin { * @throws IllegalArgumentException If no permissions are specified. * @throws SecurityException If the caller does not have * {@code AllPermission}. - * @deprecated Since 1.1. Use {@link #newConditionalPermissionUpdate()} + * @deprecated As of 1.1. Use {@link #newConditionalPermissionUpdate()} * instead. */ ConditionalPermissionInfo addConditionalPermissionInfo(ConditionInfo[] conditions, PermissionInfo[] permissions); @@ -93,7 +93,7 @@ public interface ConditionalPermissionAdmin { * @throws IllegalArgumentException If no permissions are specified. * @throws SecurityException If the caller does not have * {@code AllPermission}. - * @deprecated Since 1.1. Use {@link #newConditionalPermissionUpdate()} + * @deprecated As of 1.1. Use {@link #newConditionalPermissionUpdate()} * instead. */ ConditionalPermissionInfo setConditionalPermissionInfo(String name, ConditionInfo[] conditions, PermissionInfo[] permissions); @@ -112,7 +112,7 @@ public interface ConditionalPermissionAdmin { * * @return An enumeration of the Conditional Permission Infos that are * currently in the Conditional Permission Table. - * @deprecated Since 1.1. Use {@link #newConditionalPermissionUpdate()} + * @deprecated As of 1.1. Use {@link #newConditionalPermissionUpdate()} * instead. */ Enumeration<ConditionalPermissionInfo> getConditionalPermissionInfos(); @@ -124,7 +124,7 @@ public interface ConditionalPermissionAdmin { * @return The Conditional Permission Info with the specified name or * {@code null} if no Conditional Permission Info with the specified * name exists in the Conditional Permission Table. - * @deprecated Since 1.1. Use {@link #newConditionalPermissionUpdate()} + * @deprecated As of 1.1. Use {@link #newConditionalPermissionUpdate()} * instead. */ ConditionalPermissionInfo getConditionalPermissionInfo(String name); diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionalPermissionInfo.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionalPermissionInfo.java index 1630bc4c5..77b137fef 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionalPermissionInfo.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionalPermissionInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2004, 2013). All Rights Reserved. + * Copyright (c) OSGi Alliance (2004, 2015). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -85,7 +85,7 @@ public interface ConditionalPermissionInfo { * 1.1. * @throws SecurityException If the caller does not have * {@code AllPermission}. - * @deprecated Since 1.1. Use + * @deprecated As of 1.1. Use * {@link ConditionalPermissionAdmin#newConditionalPermissionUpdate()} * instead to manage the Conditional Permissions. */ @@ -159,6 +159,7 @@ public interface ConditionalPermissionInfo { * {@code ConditionalPermissionInfo}. * @since 1.1 */ + @Override String toString(); /** @@ -177,6 +178,7 @@ public interface ConditionalPermissionInfo { * otherwise. * @since 1.1 */ + @Override boolean equals(Object obj); /** @@ -185,5 +187,6 @@ public interface ConditionalPermissionInfo { * @return A hash code value for this object. * @since 1.1 */ + @Override int hashCode(); } diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/packageinfo b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/packageinfo deleted file mode 100644 index bb27c604d..000000000 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/packageinfo +++ /dev/null @@ -1 +0,0 @@ -version 1.1.1 diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/log/LogListener.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/log/LogListener.java index 4e6f645f4..accab4261 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/log/LogListener.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/log/LogListener.java @@ -30,8 +30,8 @@ import org.osgi.annotation.versioning.ConsumerType; * unregistered by calling the {@code LogReaderService.removeLogListener} * method. * <p> - * Since 1.4, {@link org.osgi.service.log.stream.LogStream} is the preferred way - * to obtain {@link LogEntry} objects. + * Since 1.4, {@link org.osgi.service.log.stream.LogStreamProvider} is the + * preferred way to obtain {@link LogEntry} objects. * * @ThreadSafe * @author $Id$ diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/log/LogReaderService.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/log/LogReaderService.java index d61e5de33..c28680f66 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/log/LogReaderService.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/log/LogReaderService.java @@ -26,7 +26,7 @@ import org.osgi.annotation.versioning.ProviderType; * There are two ways to obtain {@link LogEntry} objects: * <ul> * <li>The primary way to obtain {@link LogEntry} objects is to get a - * {@link org.osgi.service.log.stream.LogStream} object from the service + * {@link org.osgi.service.log.stream.LogStreamProvider} object from the service * registry. This replaces adding a {@link LogListener} object.</li> * <li>To obtain past {@link LogEntry} objects, the {@link #getLog()} method can * be called which will return an {@code Enumeration} of the {@link LogEntry} @@ -53,8 +53,8 @@ public interface LogReaderService { * listener {@code l} such that {@code (l==listener)}, this method does * nothing. * <p> - * Since 1.4, {@link org.osgi.service.log.stream.LogStream} is the preferred - * way to obtain {@link LogEntry} objects. + * Since 1.4, {@link org.osgi.service.log.stream.LogStreamProvider} is the + * preferred way to obtain {@link LogEntry} objects. * * @param listener A {@link LogListener} object to register; the * {@link LogListener} object is used to receive {@link LogEntry} @@ -71,8 +71,8 @@ public interface LogReaderService { * If {@code listener} is not contained in this Log Reader Service's list of * listeners, this method does nothing. * <p> - * Since 1.4, {@link org.osgi.service.log.stream.LogStream} is the preferred - * way to obtain {@link LogEntry} objects. + * Since 1.4, {@link org.osgi.service.log.stream.LogStreamProvider} is the + * preferred way to obtain {@link LogEntry} objects. * * @param listener A {@link LogListener} object to unregister. */ diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/log/admin/LoggerAdmin.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/log/admin/LoggerAdmin.java index 37c8ef2cf..5f68a1c1b 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/log/admin/LoggerAdmin.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/log/admin/LoggerAdmin.java @@ -34,7 +34,7 @@ import org.osgi.service.log.LoggerFactory; * longest name, which has a non-empty Logger Context, according to this syntax: * * <pre> - * name ::= symbolic-name ( ’|’ version ( ’|’ location )? )? + * name ::= symbolic-name ( '|' version ( '|' location )? )? * </pre> * * The version must be formatted canonically, that is, according to the diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/log/admin/packageinfo b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/log/admin/packageinfo deleted file mode 100644 index 7c8de0324..000000000 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/log/admin/packageinfo +++ /dev/null @@ -1 +0,0 @@ -version 1.0 diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/log/packageinfo b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/log/packageinfo deleted file mode 100644 index cc13f1958..000000000 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/log/packageinfo +++ /dev/null @@ -1 +0,0 @@ -version 1.4 diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/packageadmin/ExportedPackage.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/packageadmin/ExportedPackage.java index e04a2beb3..f4cdb9e84 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/packageadmin/ExportedPackage.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/packageadmin/ExportedPackage.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2001, 2013). All Rights Reserved. + * Copyright (c) OSGi Alliance (2001, 2014). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -85,7 +85,7 @@ public interface ExportedPackage { * * @return The version of this exported package, or {@code null} if no * version information is available. - * @deprecated As of 1.2, replaced by {@link #getVersion()}. + * @deprecated As of 1.2. Replaced by {@link #getVersion()}. */ public String getSpecificationVersion(); diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/packageadmin/PackageAdmin.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/packageadmin/PackageAdmin.java index 4aad25d2f..1de8679fc 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/packageadmin/PackageAdmin.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/packageadmin/PackageAdmin.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2001, 2013). All Rights Reserved. + * Copyright (c) OSGi Alliance (2001, 2015). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -53,6 +53,7 @@ public interface PackageAdmin { * @throws IllegalArgumentException If the specified {@code Bundle} was * not created by the same framework instance that registered this * {@code PackageAdmin} service. + * @deprecated */ public ExportedPackage[] getExportedPackages(Bundle bundle); @@ -64,6 +65,7 @@ public interface PackageAdmin { * @return An array of the exported packages, or {@code null} if no * exported packages with the specified name exists. * @since 1.2 + * @deprecated */ public ExportedPackage[] getExportedPackages(String name); @@ -79,6 +81,7 @@ public interface PackageAdmin { * @return The exported package, or {@code null} if no exported * package with the specified name exists. * @see #getExportedPackages(String) + * @deprecated */ public ExportedPackage getExportedPackage(String name); @@ -186,6 +189,7 @@ public interface PackageAdmin { * @return An array of required bundles or {@code null} if no * required bundles exist for the specified symbolic name. * @since 1.2 + * @deprecated */ public RequiredBundle[] getRequiredBundles(String symbolicName); @@ -259,7 +263,7 @@ public interface PackageAdmin { * this {@code PackageAdmin} service. * @since 1.2 */ - public Bundle getBundle(Class clazz); + public Bundle getBundle(Class<?> clazz); /** * Bundle type indicating the bundle is a fragment bundle. diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/packageadmin/package-info.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/packageadmin/package-info.java index c3483bdb0..2216e51ed 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/packageadmin/package-info.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/packageadmin/package-info.java @@ -31,8 +31,10 @@ * <p> * {@code Import-Package: org.osgi.service.packageadmin; version="[1.2,2.0)"} * - * @version 1.2 * @author $Id$ */ +@Version("1.2") package org.osgi.service.packageadmin; + +import org.osgi.annotation.versioning.Version; diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/packageadmin/packageinfo b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/packageadmin/packageinfo deleted file mode 100644 index ef7df68cb..000000000 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/packageadmin/packageinfo +++ /dev/null @@ -1 +0,0 @@ -version 1.2 diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/permissionadmin/PermissionInfo.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/permissionadmin/PermissionInfo.java index b6cc8440e..184e37684 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/permissionadmin/PermissionInfo.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/permissionadmin/PermissionInfo.java @@ -230,7 +230,9 @@ public class PermissionInfo { * @return The string encoding of this {@code PermissionInfo}. */ public final String getEncoded() { - StringBuffer output = new StringBuffer(8 + type.length() + ((((name == null) ? 0 : name.length()) + ((actions == null) ? 0 : actions.length())) << 1)); + StringBuilder output = new StringBuilder( + 8 + type.length() + ((((name == null) ? 0 : name.length()) + + ((actions == null) ? 0 : actions.length())) << 1)); output.append('('); output.append(type); if (name != null) { @@ -347,9 +349,9 @@ public class PermissionInfo { /** * This escapes the quotes, backslashes, \n, and \r in the string using a - * backslash and appends the newly escaped string to a StringBuffer. + * backslash and appends the newly escaped string to a StringBuilder. */ - private static void escapeString(String str, StringBuffer output) { + private static void escapeString(String str, StringBuilder output) { int len = str.length(); for (int i = 0; i < len; i++) { char c = str.charAt(i); @@ -376,7 +378,7 @@ public class PermissionInfo { * Takes an encoded character array and decodes it into a new String. */ private static String unescapeString(char[] str, int begin, int end) { - StringBuffer output = new StringBuffer(end - begin); + StringBuilder output = new StringBuilder(end - begin); for (int i = begin; i < end; i++) { char c = str[i]; if (c == '\\') { diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/permissionadmin/packageinfo b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/permissionadmin/packageinfo deleted file mode 100644 index ef7df68cb..000000000 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/permissionadmin/packageinfo +++ /dev/null @@ -1 +0,0 @@ -version 1.2 diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/startlevel/package-info.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/startlevel/package-info.java index a3ee72a31..f863d9be0 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/startlevel/package-info.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/startlevel/package-info.java @@ -31,8 +31,10 @@ * <p> * {@code Import-Package: org.osgi.service.startlevel; version="[1.1,2.0)"} * - * @version 1.1 * @author $Id$ */ +@Version("1.1") package org.osgi.service.startlevel; + +import org.osgi.annotation.versioning.Version; diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/startlevel/packageinfo b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/startlevel/packageinfo deleted file mode 100644 index 3987f9c4e..000000000 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/startlevel/packageinfo +++ /dev/null @@ -1 +0,0 @@ -version 1.1 diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/url/AbstractURLStreamHandlerService.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/url/AbstractURLStreamHandlerService.java index 79cfc45d9..71ce6a384 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/url/AbstractURLStreamHandlerService.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/url/AbstractURLStreamHandlerService.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2002, 2013). All Rights Reserved. + * Copyright (c) OSGi Alliance (2002, 2015). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -56,6 +56,7 @@ public abstract class AbstractURLStreamHandlerService extends URLStreamHandler i * invoked for the specified URL. * @see "java.net.URLStreamHandler.parseURL" */ + @Override public void parseURL(@SuppressWarnings("hiding") URLStreamHandlerSetter realHandler, URL u, String spec, int start, int limit) { this.realHandler = realHandler; parseURL(u, spec, start, limit); @@ -139,7 +140,7 @@ public abstract class AbstractURLStreamHandlerService extends URLStreamHandler i * @deprecated This method is only for compatibility with handlers written * for JDK 1.1. */ - @SuppressWarnings("javadoc") + @Override protected void setURL(URL u, String proto, String host, int port, String file, String ref) { realHandler.setURL(u, proto, host, port, file, ref); } diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/url/packageinfo b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/url/packageinfo deleted file mode 100644 index 7c8de0324..000000000 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/url/packageinfo +++ /dev/null @@ -1 +0,0 @@ -version 1.0 diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/BundleTracker.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/BundleTracker.java index 9a1b57568..a7fc758ff 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/BundleTracker.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/BundleTracker.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2007, 2013). All Rights Reserved. + * Copyright (c) OSGi Alliance (2007, 2015). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ package org.osgi.util.tracker; import java.util.HashMap; import java.util.Map; + import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.framework.BundleEvent; @@ -217,6 +218,7 @@ public class BundleTracker<T> implements BundleTrackerCustomizer<T> { * @return The specified bundle. * @see BundleTrackerCustomizer#addingBundle(Bundle, BundleEvent) */ + @Override public T addingBundle(Bundle bundle, BundleEvent event) { @SuppressWarnings("unchecked") T result = (T) bundle; @@ -241,6 +243,7 @@ public class BundleTracker<T> implements BundleTrackerCustomizer<T> { * @param object The customized object for the specified Bundle. * @see BundleTrackerCustomizer#modifiedBundle(Bundle, BundleEvent, Object) */ + @Override public void modifiedBundle(Bundle bundle, BundleEvent event, T object) { /* do nothing */ } @@ -263,6 +266,7 @@ public class BundleTracker<T> implements BundleTrackerCustomizer<T> { * @param object The customized object for the specified bundle. * @see BundleTrackerCustomizer#removedBundle(Bundle, BundleEvent, Object) */ + @Override public void removedBundle(Bundle bundle, BundleEvent event, T object) { /* do nothing */ } @@ -280,11 +284,10 @@ public class BundleTracker<T> implements BundleTrackerCustomizer<T> { return null; } synchronized (t) { - int length = t.size(); - if (length == 0) { + if (t.isEmpty()) { return null; } - return t.copyKeys(new Bundle[length]); + return t.copyKeys(new Bundle[0]); } } @@ -426,6 +429,7 @@ public class BundleTracker<T> implements BundleTrackerCustomizer<T> { * * @param event {@code BundleEvent} object from the framework. */ + @Override public void bundleChanged(final BundleEvent event) { /* * Check if we had a delayed call (which could happen when we diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/ServiceTracker.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/ServiceTracker.java index a0af979aa..689281448 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/ServiceTracker.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/ServiceTracker.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2000, 2014). All Rights Reserved. + * Copyright (c) OSGi Alliance (2000, 2016). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ import java.lang.reflect.Array; import java.util.Collections; import java.util.SortedMap; import java.util.TreeMap; + import org.osgi.framework.AllServiceListener; import org.osgi.framework.BundleContext; import org.osgi.framework.Constants; @@ -387,15 +388,14 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> { /** * Default implementation of the * {@code ServiceTrackerCustomizer.addingService} method. - * * <p> * This method is only called when this {@code ServiceTracker} has been * constructed with a {@code null ServiceTrackerCustomizer} argument. - * * <p> - * This implementation returns the result of calling {@code getService} on - * the {@code BundleContext} with which this {@code ServiceTracker} was - * created passing the specified {@code ServiceReference}. + * This implementation returns the result of calling + * {@code getServiceObjects(reference).getService()} on the + * {@code BundleContext} with which this {@code ServiceTracker} was created + * passing the specified {@code ServiceReference}. * <p> * This method can be overridden in a subclass to customize the service * object to be tracked for the service being added. In that case, take care @@ -404,14 +404,15 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> { * the service. * * @param reference The reference to the service being added to this - * {@code ServiceTracker}. + * {@code ServiceTracker}. * @return The service object to be tracked for the service added to this * {@code ServiceTracker}. * @see ServiceTrackerCustomizer#addingService(ServiceReference) */ + @Override public T addingService(ServiceReference<S> reference) { @SuppressWarnings("unchecked") - T result = (T) context.getService(reference); + T result = (T) context.getServiceObjects(reference).getService(); return result; } @@ -430,6 +431,7 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> { * @param service The service object for the modified service. * @see ServiceTrackerCustomizer#modifiedService(ServiceReference, Object) */ + @Override public void modifiedService(ServiceReference<S> reference, T service) { /* do nothing */ } @@ -437,15 +439,14 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> { /** * Default implementation of the * {@code ServiceTrackerCustomizer.removedService} method. - * * <p> * This method is only called when this {@code ServiceTracker} has been * constructed with a {@code null ServiceTrackerCustomizer} argument. - * * <p> - * This implementation calls {@code ungetService}, on the + * This implementation calls + * {@code getServiceObjects(reference).ungetService(service)}, on the * {@code BundleContext} with which this {@code ServiceTracker} was created, - * passing the specified {@code ServiceReference}. + * passing the specified {@code ServiceReference} and service. * <p> * This method can be overridden in a subclass. If the default * implementation of {@link #addingService(ServiceReference) addingService} @@ -455,8 +456,11 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> { * @param service The service object for the removed service. * @see ServiceTrackerCustomizer#removedService(ServiceReference, Object) */ + @Override public void removedService(ServiceReference<S> reference, T service) { - context.ungetService(reference); + @SuppressWarnings("unchecked") + S s = (S) service; + context.getServiceObjects(reference).ungetService(s); } /** @@ -526,12 +530,11 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> { return null; } synchronized (t) { - int length = t.size(); - if (length == 0) { + if (t.isEmpty()) { return null; } @SuppressWarnings("unchecked") - ServiceReference<S>[] result = new ServiceReference[length]; + ServiceReference<S>[] result = new ServiceReference[0]; return t.copyKeys(result); } } @@ -881,6 +884,7 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> { * * @param event {@code ServiceEvent} object from the framework. */ + @Override final public void serviceChanged(final ServiceEvent event) { /* * Check if we had a delayed call (which could happen when we diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/package-info.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/package-info.java index 2bb188f92..b72e066d2 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/package-info.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2010, 2013). All Rights Reserved. + * Copyright (c) OSGi Alliance (2010, 2016). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,7 +29,7 @@ * @author $Id$ */ -@Version("1.5.1") +@Version("1.5.2") package org.osgi.util.tracker; import org.osgi.annotation.versioning.Version; diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/packageinfo b/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/packageinfo deleted file mode 100644 index 1213efd61..000000000 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/packageinfo +++ /dev/null @@ -1 +0,0 @@ -version 1.5.1 |