Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2017-08-22 08:45:55 -0400
committerThomas Watson2017-08-22 08:49:54 -0400
commit18b75ba105ec2e868cb0c13dff1662e73813b678 (patch)
tree44a294cac6f394b34718ec24819d3370dd3e049d
parente47a6cbd20d91e10988d4432e449d6ed4663f320 (diff)
downloadrt.equinox.framework-18b75ba105ec2e868cb0c13dff1662e73813b678.tar.gz
rt.equinox.framework-18b75ba105ec2e868cb0c13dff1662e73813b678.tar.xz
rt.equinox.framework-18b75ba105ec2e868cb0c13dff1662e73813b678.zip
Change-Id: Id406562887a18b3afb377f0b8cfa38dddefd837f Signed-off-by: Thomas Watson <tjwatson@us.ibm.com>
-rw-r--r--bundles/org.eclipse.osgi.services/.classpath2
-rw-r--r--bundles/org.eclipse.osgi.services/.settings/.api_filters15
-rw-r--r--bundles/org.eclipse.osgi.services/.settings/org.eclipse.jdt.core.prefs6
-rw-r--r--bundles/org.eclipse.osgi.services/META-INF/MANIFEST.MF6
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/device/Driver.java6
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/device/DriverLocator.java4
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/device/DriverSelector.java4
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/device/Match.java4
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/device/package-info.java5
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/device/packageinfo1
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/event/EventConstants.java4
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/event/EventProperties.java14
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/event/TopicPermission.java4
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/event/packageinfo1
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/log/LogEntry.java8
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/metatype/MetaTypeService.java16
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/metatype/package-info.java15
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/metatype/packageinfo1
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/provisioning/ProvisioningService.java6
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/provisioning/package-info.java5
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/provisioning/packageinfo1
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/upnp/UPnPAction.java4
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/upnp/UPnPDevice.java4
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/upnp/UPnPEventListener.java2
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/upnp/UPnPException.java4
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/upnp/UPnPStateVariable.java4
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/upnp/package-info.java5
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/upnp/packageinfo1
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/useradmin/Role.java4
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/useradmin/User.java4
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/useradmin/UserAdminEvent.java8
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/useradmin/UserAdminPermission.java35
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/useradmin/package-info.java5
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/useradmin/packageinfo1
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/wireadmin/BasicEnvelope.java5
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/wireadmin/Wire.java6
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/wireadmin/WireAdmin.java6
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/wireadmin/WireAdminEvent.java8
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/wireadmin/WirePermission.java35
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/wireadmin/package-info.java5
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/wireadmin/packageinfo1
-rw-r--r--bundles/org.eclipse.osgi.util/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.osgi.util/src/org/osgi/util/measurement/Measurement.java10
-rw-r--r--bundles/org.eclipse.osgi.util/src/org/osgi/util/measurement/State.java7
-rw-r--r--bundles/org.eclipse.osgi.util/src/org/osgi/util/measurement/Unit.java25
-rw-r--r--bundles/org.eclipse.osgi.util/src/org/osgi/util/measurement/package-info.java5
-rw-r--r--bundles/org.eclipse.osgi.util/src/org/osgi/util/measurement/packageinfo1
-rw-r--r--bundles/org.eclipse.osgi.util/src/org/osgi/util/position/package-info.java5
-rw-r--r--bundles/org.eclipse.osgi.util/src/org/osgi/util/position/packageinfo1
-rw-r--r--bundles/org.eclipse.osgi.util/src/org/osgi/util/promise/Deferred.java46
-rw-r--r--bundles/org.eclipse.osgi.util/src/org/osgi/util/promise/PromiseImpl.java247
-rw-r--r--bundles/org.eclipse.osgi.util/src/org/osgi/util/promise/Promises.java138
-rw-r--r--bundles/org.eclipse.osgi.util/src/org/osgi/util/xml/XMLParserActivator.java67
-rw-r--r--bundles/org.eclipse.osgi.util/src/org/osgi/util/xml/package-info.java5
-rw-r--r--bundles/org.eclipse.osgi.util/src/org/osgi/util/xml/packageinfo1
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/service/log/LogEntry.java8
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/service/resolver/Resolver.java10
57 files changed, 554 insertions, 299 deletions
diff --git a/bundles/org.eclipse.osgi.services/.classpath b/bundles/org.eclipse.osgi.services/.classpath
index 09b9f31b1..7ecc55afe 100644
--- a/bundles/org.eclipse.osgi.services/.classpath
+++ b/bundles/org.eclipse.osgi.services/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src">
<attributes>
diff --git a/bundles/org.eclipse.osgi.services/.settings/.api_filters b/bundles/org.eclipse.osgi.services/.settings/.api_filters
index 5799d5790..fc3708d1c 100644
--- a/bundles/org.eclipse.osgi.services/.settings/.api_filters
+++ b/bundles/org.eclipse.osgi.services/.settings/.api_filters
@@ -36,4 +36,19 @@
</message_arguments>
</filter>
</resource>
+ <resource path="src/org/osgi/service/metatype/MetaTypeService.java" type="org.osgi.service.metatype.MetaTypeService">
+ <filter id="403767336">
+ <message_arguments>
+ <message_argument value="org.osgi.service.metatype.MetaTypeService"/>
+ <message_argument value="METATYPE_SPECIFICATION_VERSION"/>
+ </message_arguments>
+ </filter>
+ <filter id="1209008130">
+ <message_arguments>
+ <message_argument value="1.4"/>
+ <message_argument value="3.7"/>
+ <message_argument value="METATYPE_SPECIFICATION_VERSION"/>
+ </message_arguments>
+ </filter>
+ </resource>
</component>
diff --git a/bundles/org.eclipse.osgi.services/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.osgi.services/.settings/org.eclipse.jdt.core.prefs
index ee22cd460..0b08c1840 100644
--- a/bundles/org.eclipse.osgi.services/.settings/org.eclipse.jdt.core.prefs
+++ b/bundles/org.eclipse.osgi.services/.settings/org.eclipse.jdt.core.prefs
@@ -13,9 +13,9 @@ org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annota
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
@@ -113,6 +113,6 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.incompatibleJDKLevel=ignore
org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/bundles/org.eclipse.osgi.services/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi.services/META-INF/MANIFEST.MF
index a14ee70e1..81d50913a 100644
--- a/bundles/org.eclipse.osgi.services/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.osgi.services/META-INF/MANIFEST.MF
@@ -21,7 +21,7 @@ Export-Package: org.osgi.service.cm;version="1.5";uses:="org.osgi.framework",
org.osgi.service.http.runtime.dto;version="1.0";uses:="org.osgi.dto,org.osgi.framework.dto",
org.osgi.service.http.whiteboard;version="1.0",
org.osgi.service.log;version="1.4";uses:="org.osgi.framework",
- org.osgi.service.metatype;version="1.3";uses:="org.osgi.framework",
+ org.osgi.service.metatype;version="1.4";uses:="org.osgi.framework",
org.osgi.service.provisioning;version="1.2",
org.osgi.service.upnp;version="1.2",
org.osgi.service.useradmin;version="1.1";uses:="org.osgi.framework",
@@ -40,7 +40,7 @@ Import-Package: javax.servlet;resolution:=optional,
org.osgi.service.event;version="[1.3,1.4)",
org.osgi.service.http;version="[1.2,1.3)",
org.osgi.service.log;version="[1.4,1.5)",
- org.osgi.service.metatype;version="[1.3,1.4)",
+ org.osgi.service.metatype;version="[1.4,1.5)",
org.osgi.service.provisioning;version="[1.2,1.3)",
org.osgi.service.upnp;version="[1.2,1.3)",
org.osgi.service.useradmin;version="[1.1,1.2)",
@@ -49,4 +49,4 @@ Import-Package: javax.servlet;resolution:=optional,
org.osgi.util.promise;version="[1.0,2.0)"
DynamicImport-Package: javax.servlet,
javax.servlet.http
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/device/Driver.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/device/Driver.java
index db46dfadf..d15f3a264 100644
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/device/Driver.java
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/device/Driver.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 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.
@@ -71,7 +71,7 @@ public interface Driver {
* @throws java.lang.Exception if this Driver service cannot examine the
* Device service
*/
- public int match(ServiceReference reference) throws Exception;
+ public int match(ServiceReference<?> reference) throws Exception;
/**
* Attaches this Driver service to the Device service represented by the
@@ -104,5 +104,5 @@ public interface Driver {
* @throws java.lang.Exception if the driver cannot attach to the given
* device and does not know of a more suitable driver
*/
- public String attach(ServiceReference reference) throws Exception;
+ public String attach(ServiceReference<?> reference) throws Exception;
}
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/device/DriverLocator.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/device/DriverLocator.java
index fdbe1a5d8..78eb7d03b 100644
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/device/DriverLocator.java
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/device/DriverLocator.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 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.
@@ -48,7 +48,7 @@ public interface DriverLocator {
* {@code null} if this Driver Locator service does not know of any
* such drivers
*/
- public String[] findDrivers(Dictionary props);
+ public String[] findDrivers(Dictionary<String, ?> props);
/**
* Get an {@code InputStream} from which the driver bundle providing a
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/device/DriverSelector.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/device/DriverSelector.java
index 179ecc7fc..41d24b1bc 100644
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/device/DriverSelector.java
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/device/DriverSelector.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.
@@ -50,5 +50,5 @@ public interface DriverSelector {
* @return index into the array of {@code Match} objects, or
* {@code SELECT_NONE} if no Driver service should be attached
*/
- public int select(ServiceReference reference, Match[] matches);
+ public int select(ServiceReference<?> reference, Match[] matches);
}
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/device/Match.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/device/Match.java
index d16251848..e1218a1e2 100644
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/device/Match.java
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/device/Match.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.
@@ -35,7 +35,7 @@ public interface Match {
*
* @return {@code ServiceReference} object to a Driver service.
*/
- public ServiceReference getDriver();
+ public ServiceReference<?> getDriver();
/**
* Return the match value of this object.
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/device/package-info.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/device/package-info.java
index 92de050fb..78617d061 100644
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/device/package-info.java
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/device/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2012). 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.
@@ -32,9 +32,10 @@
* <p>
* {@code Import-Package: org.osgi.service.device; version="[1.1,1.2)"}
*
- * @version 1.1
* @author $Id$
*/
+@Version("1.1")
package org.osgi.service.device;
+import org.osgi.annotation.versioning.Version;
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/device/packageinfo b/bundles/org.eclipse.osgi.services/src/org/osgi/service/device/packageinfo
deleted file mode 100644
index 3987f9c4e..000000000
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/device/packageinfo
+++ /dev/null
@@ -1 +0,0 @@
-version 1.1
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/event/EventConstants.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/event/EventConstants.java
index d002775d3..b9345200f 100644
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/event/EventConstants.java
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/event/EventConstants.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.
@@ -237,7 +237,7 @@ public interface EventConstants {
* This constant was released with an incorrectly spelled name. It has been
* replaced by {@link #EXCEPTION_CLASS}
*
- * @deprecated As of 1.1, replaced by EXCEPTION_CLASS
+ * @deprecated As of 1.1. Replaced by {@link #EXCEPTION_CLASS}.
*/
public static final String EXECPTION_CLASS = "exception.class";
}
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/event/EventProperties.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/event/EventProperties.java
index 548895a00..1ecc2e9ea 100644
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/event/EventProperties.java
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/event/EventProperties.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 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.
@@ -109,6 +109,7 @@ public class EventProperties implements Map<String, Object> {
*
* @throws UnsupportedOperationException if called.
*/
+ @Override
public void clear() {
properties.clear();
}
@@ -119,6 +120,7 @@ public class EventProperties implements Map<String, Object> {
* @param name The property name.
* @return {@code true} If the property is present, {@code false} otherwise.
*/
+ @Override
public boolean containsKey(Object name) {
return properties.containsKey(name);
}
@@ -129,6 +131,7 @@ public class EventProperties implements Map<String, Object> {
* @param value The property value.
* @return {@code true} If the value is present, {@code false} otherwise.
*/
+ @Override
public boolean containsValue(Object value) {
return properties.containsValue(value);
}
@@ -138,6 +141,7 @@ public class EventProperties implements Map<String, Object> {
*
* @return A set containing the property name/value pairs.
*/
+ @Override
public Set<java.util.Map.Entry<String, Object>> entrySet() {
return properties.entrySet();
}
@@ -148,6 +152,7 @@ public class EventProperties implements Map<String, Object> {
* @param name The name of the specified property.
* @return The value of the specified property.
*/
+ @Override
public Object get(Object name) {
return properties.get(name);
}
@@ -158,6 +163,7 @@ public class EventProperties implements Map<String, Object> {
* @return {@code true} If this properties is empty, {@code false}
* otherwise.
*/
+ @Override
public boolean isEmpty() {
return properties.isEmpty();
}
@@ -167,6 +173,7 @@ public class EventProperties implements Map<String, Object> {
*
* @return The names of the properties.
*/
+ @Override
public Set<String> keySet() {
return properties.keySet();
}
@@ -176,6 +183,7 @@ public class EventProperties implements Map<String, Object> {
*
* @throws UnsupportedOperationException if called.
*/
+ @Override
public Object put(String key, Object value) {
return properties.put(key, value);
}
@@ -185,6 +193,7 @@ public class EventProperties implements Map<String, Object> {
*
* @throws UnsupportedOperationException if called.
*/
+ @Override
public void putAll(Map<? extends String, ? extends Object> map) {
properties.putAll(map);
}
@@ -194,6 +203,7 @@ public class EventProperties implements Map<String, Object> {
*
* @throws UnsupportedOperationException if called.
*/
+ @Override
public Object remove(Object key) {
return properties.remove(key);
}
@@ -203,6 +213,7 @@ public class EventProperties implements Map<String, Object> {
*
* @return The number of properties.
*/
+ @Override
public int size() {
return properties.size();
}
@@ -212,6 +223,7 @@ public class EventProperties implements Map<String, Object> {
*
* @return The values of the properties.
*/
+ @Override
public Collection<Object> values() {
return properties.values();
}
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/event/TopicPermission.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/event/TopicPermission.java
index dbe0829e7..a315cdc5c 100644
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/event/TopicPermission.java
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/event/TopicPermission.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2005, 2015). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2005, 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.
@@ -289,7 +289,7 @@ public final class TopicPermission extends Permission {
public String getActions() {
String result = actions;
if (result == null) {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
boolean comma = false;
int mask = getActionsMask();
if ((mask & ACTION_PUBLISH) == ACTION_PUBLISH) {
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/event/packageinfo b/bundles/org.eclipse.osgi.services/src/org/osgi/service/event/packageinfo
deleted file mode 100644
index 6435862fd..000000000
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/event/packageinfo
+++ /dev/null
@@ -1 +0,0 @@
-version 1.3.1
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/log/LogEntry.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/log/LogEntry.java
index 6b3ee59f7..9dca75876 100644
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/log/LogEntry.java
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/log/LogEntry.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2016). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2017). 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.
@@ -68,11 +68,11 @@ public interface LogEntry {
int getLevel();
/**
- * Returns the human readable message associated with this {@code LogEntry}
+ * Returns the formatted message associated with this {@code LogEntry}
* object.
*
- * @return {@code String} containing the message associated with this
- * {@code LogEntry} object.
+ * @return {@code String} containing the formatted message associated with
+ * this {@code LogEntry} object.
*/
String getMessage();
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/metatype/MetaTypeService.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/metatype/MetaTypeService.java
index 3a507c14a..c5c96a364 100644
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/metatype/MetaTypeService.java
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/metatype/MetaTypeService.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2005, 2015). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2005, 2017). 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.
@@ -55,17 +55,27 @@ public interface MetaTypeService {
/**
* Capability name for meta type document processors.
- *
* <p>
* Used in {@code Provide-Capability} and {@code Require-Capability}
* manifest headers with the {@code osgi.extender} namespace. For example:
*
* <pre>
* Require-Capability: osgi.extender;
- * filter:="(&amp;(osgi.extender=osgi.metatype)(version&gt;=1.3)(!(version&gt;=2.0)))"
+ * filter:="(&amp;(osgi.extender=osgi.metatype)(version&gt;=1.4)(!(version&gt;=2.0)))"
* </pre>
*
* @since 1.3
*/
public static final String METATYPE_CAPABILITY_NAME = "osgi.metatype";
+
+ /**
+ * Compile time constant for the Specification Version of MetaType Service.
+ * <p>
+ * Used in {@code Version} and {@code Requirement} annotations. The value of
+ * this compile time constant will change when the specification version of
+ * MetaType Service is updated.
+ *
+ * @since 1.4
+ */
+ public static final String METATYPE_SPECIFICATION_VERSION = "1.4.0";
}
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/metatype/package-info.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/metatype/package-info.java
index ca1a06007..c55119ecb 100644
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/metatype/package-info.java
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/metatype/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2017). 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.
@@ -15,28 +15,27 @@
*/
/**
- * Metatype Package Version 1.3.
- *
+ * Metatype Package Version 1.4.
* <p>
* Bundles wishing to use this package must list the package in the
* Import-Package header of the bundle's manifest. This package has two types of
* users: the consumers that use the API in this package and the providers that
* implement the API in this package.
- *
* <p>
* Example import for consumers using the API in this package:
* <p>
- * {@code Import-Package: org.osgi.service.metatype; version="[1.3,2.0)"}
+ * {@code Import-Package: org.osgi.service.metatype; version="[1.4,2.0)"}
* <p>
* Example import for providers implementing the API in this package:
* <p>
- * {@code Import-Package: org.osgi.service.metatype; version="[1.3,1.4)"}
+ * {@code Import-Package: org.osgi.service.metatype; version="[1.4,1.5)"}
*
* @author $Id$
*/
-@Version("1.3")
+@Version(METATYPE_SPECIFICATION_VERSION)
package org.osgi.service.metatype;
-import org.osgi.annotation.versioning.Version;
+import static org.osgi.service.metatype.MetaTypeService.METATYPE_SPECIFICATION_VERSION;
+import org.osgi.annotation.versioning.Version;
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/metatype/packageinfo b/bundles/org.eclipse.osgi.services/src/org/osgi/service/metatype/packageinfo
deleted file mode 100644
index 0117a56c1..000000000
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/metatype/packageinfo
+++ /dev/null
@@ -1 +0,0 @@
-version 1.3
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/provisioning/ProvisioningService.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/provisioning/ProvisioningService.java
index 475106113..7fb7e78e0 100644
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/provisioning/ProvisioningService.java
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/provisioning/ProvisioningService.java
@@ -166,7 +166,7 @@ public interface ProvisioningService {
*
* @return A reference to the Provisioning Dictionary.
*/
- public Dictionary getInformation();
+ public Dictionary<String, Object> getInformation();
/**
* Replaces the Provisioning Information dictionary with the key/value pairs
@@ -178,7 +178,7 @@ public interface ProvisioningService {
* keys are values that are of an invalid type will be silently
* ignored.
*/
- public void setInformation(Dictionary info);
+ public void setInformation(Dictionary<String, ?> info);
/**
* Adds the key/value pairs contained in {@code info} to the Provisioning
@@ -189,7 +189,7 @@ public interface ProvisioningService {
* the Provisioning Information dictionary. Any keys are values that
* are of an invalid type will be silently ignored.
*/
- public void addInformation(Dictionary info);
+ public void addInformation(Dictionary<String, ?> info);
/**
* Processes the {@code ZipInputStream} and extracts information to add to
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/provisioning/package-info.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/provisioning/package-info.java
index d47e07a89..8d2cafd1a 100644
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/provisioning/package-info.java
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/provisioning/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2012). 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.
@@ -32,9 +32,10 @@
* <p>
* {@code Import-Package: org.osgi.service.provisioning; version="[1.2,1.3)"}
*
- * @version 1.2
* @author $Id$
*/
+@Version("1.2")
package org.osgi.service.provisioning;
+import org.osgi.annotation.versioning.Version;
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/provisioning/packageinfo b/bundles/org.eclipse.osgi.services/src/org/osgi/service/provisioning/packageinfo
deleted file mode 100644
index ef7df68cb..000000000
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/provisioning/packageinfo
+++ /dev/null
@@ -1 +0,0 @@
-version 1.2
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/upnp/UPnPAction.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/upnp/UPnPAction.java
index f1ba100ae..1dcd11587 100644
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/upnp/UPnPAction.java
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/upnp/UPnPAction.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.
@@ -138,5 +138,5 @@ public interface UPnPAction {
*
* @see UPnPStateVariable
*/
- Dictionary invoke(Dictionary args) throws Exception;
+ Dictionary<String, Object> invoke(Dictionary<String, ?> args) throws Exception;
}
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/upnp/UPnPDevice.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/upnp/UPnPDevice.java
index a09c1c2f3..fe7d6d7d5 100644
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/upnp/UPnPDevice.java
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/upnp/UPnPDevice.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.
@@ -287,5 +287,5 @@ public interface UPnPDevice {
* Strings
*
*/
- Dictionary getDescriptions(String locale);
+ Dictionary<String, String> getDescriptions(String locale);
}
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/upnp/UPnPEventListener.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/upnp/UPnPEventListener.java
index 80582d96d..fab5adc95 100644
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/upnp/UPnPEventListener.java
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/upnp/UPnPEventListener.java
@@ -81,5 +81,5 @@ public interface UPnPEventListener {
*
*
*/
- void notifyUPnPEvent(String deviceId, String serviceId, Dictionary events);
+ void notifyUPnPEvent(String deviceId, String serviceId, Dictionary<String, ?> events);
}
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/upnp/UPnPException.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/upnp/UPnPException.java
index ffd3b84b0..c37703795 100644
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/upnp/UPnPException.java
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/upnp/UPnPException.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.
@@ -107,7 +107,7 @@ public class UPnPException extends Exception {
*
* @return The UPnPErrorCode defined by a UPnP Forum working committee or
* specified by a UPnP vendor.
- * @deprecated As of version 1.2, replaced by {@link #getUPnPErrorCode()}
+ * @deprecated As of 1.2. Replaced by {@link #getUPnPErrorCode()}.
*/
public int getUPnPError_Code() {
return getUPnPErrorCode();
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/upnp/UPnPStateVariable.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/upnp/UPnPStateVariable.java
index 1ebafb56d..f15242294 100644
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/upnp/UPnPStateVariable.java
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/upnp/UPnPStateVariable.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.
@@ -285,7 +285,7 @@ public interface UPnPStateVariable {
*
* @return A class object corresponding to the Java type of this argument.
*/
- Class getJavaDataType();
+ Class<?> getJavaDataType();
/**
* Returns the UPnP type of this state variable. Valid types are defined as
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/upnp/package-info.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/upnp/package-info.java
index 141651627..15372d222 100644
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/upnp/package-info.java
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/upnp/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2012). 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.
@@ -32,9 +32,10 @@
* <p>
* {@code Import-Package: org.osgi.service.upnp; version="[1.2,1.3)"}
*
- * @version 1.2
* @author $Id$
*/
+@Version("1.2")
package org.osgi.service.upnp;
+import org.osgi.annotation.versioning.Version;
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/upnp/packageinfo b/bundles/org.eclipse.osgi.services/src/org/osgi/service/upnp/packageinfo
deleted file mode 100644
index ef7df68cb..000000000
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/upnp/packageinfo
+++ /dev/null
@@ -1 +0,0 @@
-version 1.2
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/useradmin/Role.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/useradmin/Role.java
index c366d5a63..aff70c8ad 100644
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/useradmin/Role.java
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/useradmin/Role.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.
@@ -113,5 +113,5 @@ public interface Role {
* @return {@code Dictionary} containing the properties of this {@code Role}
* object.
*/
- public Dictionary getProperties();
+ public Dictionary<String, Object> getProperties();
}
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/useradmin/User.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/useradmin/User.java
index 0520ec2dd..4a13bb52e 100644
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/useradmin/User.java
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/useradmin/User.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.
@@ -68,7 +68,7 @@ public interface User extends Role {
* @return {@code Dictionary} object containing the credentials of this
* {@code User} object.
*/
- public Dictionary getCredentials();
+ public Dictionary<String, Object> getCredentials();
/**
* Checks to see if this {@code User} object has a credential with the
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/useradmin/UserAdminEvent.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/useradmin/UserAdminEvent.java
index 606618cc7..3750d209c 100644
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/useradmin/UserAdminEvent.java
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/useradmin/UserAdminEvent.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.
@@ -37,7 +37,7 @@ import org.osgi.framework.ServiceReference;
* @author $Id$
*/
public class UserAdminEvent {
- private ServiceReference ref;
+ private ServiceReference<UserAdmin> ref;
private int type;
private Role role;
/**
@@ -71,7 +71,7 @@ public class UserAdminEvent {
* @param type The event type.
* @param role The {@code Role} object on which this event occurred.
*/
- public UserAdminEvent(ServiceReference ref, int type, Role role) {
+ public UserAdminEvent(ServiceReference<UserAdmin> ref, int type, Role role) {
this.ref = ref;
this.type = type;
this.role = role;
@@ -83,7 +83,7 @@ public class UserAdminEvent {
*
* @return The User Admin service's {@code ServiceReference} object.
*/
- public ServiceReference getServiceReference() {
+ public ServiceReference<UserAdmin> getServiceReference() {
return ref;
}
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/useradmin/UserAdminPermission.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/useradmin/UserAdminPermission.java
index 536a2ac22..b950fbd87 100644
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/useradmin/UserAdminPermission.java
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/useradmin/UserAdminPermission.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2001, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2001, 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,8 +20,11 @@ import java.io.IOException;
import java.security.BasicPermission;
import java.security.Permission;
import java.security.PermissionCollection;
+import java.util.ArrayList;
+import java.util.Collections;
import java.util.Enumeration;
import java.util.Hashtable;
+import java.util.List;
/**
* Permission to configure and access the {@link Role} objects managed by a User
@@ -323,6 +326,7 @@ public final class UserAdminPermission extends BasicPermission {
* @return {@code true} if the specified permission is implied by this
* object; {@code false} otherwise.
*/
+ @Override
public boolean implies(Permission p) {
if (p instanceof UserAdminPermission) {
UserAdminPermission requested = (UserAdminPermission) p;
@@ -345,10 +349,11 @@ public final class UserAdminPermission extends BasicPermission {
*
* @return the canonical string representation of the actions.
*/
+ @Override
public String getActions() {
String result = actions;
if (result == null) {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
boolean comma = false;
int mask = getActionsMask();
if ((mask & ACTION_CHANGE_CREDENTIAL) == ACTION_CHANGE_CREDENTIAL) {
@@ -378,6 +383,7 @@ public final class UserAdminPermission extends BasicPermission {
* @return a new {@code PermissionCollection} object suitable for storing
* {@code UserAdminPermission} objects.
*/
+ @Override
public PermissionCollection newPermissionCollection() {
return new UserAdminPermissionCollection();
}
@@ -393,6 +399,7 @@ public final class UserAdminPermission extends BasicPermission {
* object, and has the same name and actions as this
* {@code UserAdminPermission} object.
*/
+ @Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
@@ -411,6 +418,7 @@ public final class UserAdminPermission extends BasicPermission {
*
* @return A hash code value for this object.
*/
+ @Override
public int hashCode() {
int h = 31 * 17 + getName().hashCode();
h = 31 * h + getActions().hashCode();
@@ -446,8 +454,9 @@ public final class UserAdminPermission extends BasicPermission {
* {@code UserAdminPermission} object.
* @see "org.osgi.service.permissionadmin.PermissionInfo.getEncoded()"
*/
+ @Override
public String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append('(');
sb.append(getClass().getName());
sb.append(" \"");
@@ -475,7 +484,7 @@ final class UserAdminPermissionCollection extends PermissionCollection {
* @serial
* @GuardedBy this
*/
- private final Hashtable permissions;
+ private final Hashtable<String, UserAdminPermission> permissions;
/**
* Boolean saying if "*" is in the collection.
*
@@ -488,7 +497,7 @@ final class UserAdminPermissionCollection extends PermissionCollection {
* Creates an empty {@code UserAdminPermissionCollection} object.
*/
public UserAdminPermissionCollection() {
- permissions = new Hashtable();
+ permissions = new Hashtable<>();
all_allowed = false;
}
@@ -503,6 +512,7 @@ final class UserAdminPermissionCollection extends PermissionCollection {
* @throws SecurityException If this {@code UserAdminPermissionCollection}
* object has been marked readonly
*/
+ @Override
public void add(Permission permission) {
if (!(permission instanceof UserAdminPermission))
throw new IllegalArgumentException("Invalid permission: " + permission);
@@ -512,7 +522,7 @@ final class UserAdminPermissionCollection extends PermissionCollection {
final UserAdminPermission uap = (UserAdminPermission) permission;
final String name = uap.getName();
synchronized (this) {
- final UserAdminPermission existing = (UserAdminPermission) permissions.get(name);
+ final UserAdminPermission existing = permissions.get(name);
if (existing != null) {
int oldMask = existing.getActionsMask();
int newMask = uap.getActionsMask();
@@ -539,6 +549,7 @@ final class UserAdminPermissionCollection extends PermissionCollection {
* @return true if the given permission is implied by this
* {@code PermissionCollection}, false otherwise.
*/
+ @Override
public boolean implies(Permission permission) {
if (!(permission instanceof UserAdminPermission)) {
return false;
@@ -552,7 +563,7 @@ final class UserAdminPermissionCollection extends PermissionCollection {
// Short circuit if the "*" Permission was added.
// desired can only be ACTION_NONE when name is "admin".
if (all_allowed && (desired != UserAdminPermission.ACTION_NONE)) {
- x = (UserAdminPermission) permissions.get("*");
+ x = permissions.get("*");
if (x != null) {
effective |= x.getActionsMask();
if ((effective & desired) == desired) {
@@ -564,7 +575,7 @@ final class UserAdminPermissionCollection extends PermissionCollection {
// Check for full match first. Then work our way up the
// name looking for matches on a.b.*
- x = (UserAdminPermission) permissions.get(name);
+ x = permissions.get(name);
}
if (x != null) {
// we have a direct hit!
@@ -579,7 +590,7 @@ final class UserAdminPermissionCollection extends PermissionCollection {
while ((last = name.lastIndexOf(".", offset)) != -1) {
name = name.substring(0, last + 1) + "*";
synchronized (this) {
- x = (UserAdminPermission) permissions.get(name);
+ x = permissions.get(name);
}
if (x != null) {
effective |= x.getActionsMask();
@@ -600,7 +611,9 @@ final class UserAdminPermissionCollection extends PermissionCollection {
*
* @return an enumeration of all the {@code UserAdminPermission} objects.
*/
- public Enumeration elements() {
- return permissions.elements();
+ @Override
+ public Enumeration<Permission> elements() {
+ List<Permission> all = new ArrayList<Permission>(permissions.values());
+ return Collections.enumeration(all);
}
}
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/useradmin/package-info.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/useradmin/package-info.java
index b79edb198..408a5172f 100644
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/useradmin/package-info.java
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/useradmin/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2012). 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.
@@ -32,9 +32,10 @@
* <p>
* {@code Import-Package: org.osgi.service.useradmin; version="[1.1,1.2)"}
*
- * @version 1.1
* @author $Id$
*/
+@Version("1.1")
package org.osgi.service.useradmin;
+import org.osgi.annotation.versioning.Version;
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/useradmin/packageinfo b/bundles/org.eclipse.osgi.services/src/org/osgi/service/useradmin/packageinfo
deleted file mode 100644
index 3987f9c4e..000000000
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/useradmin/packageinfo
+++ /dev/null
@@ -1 +0,0 @@
-version 1.1
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/wireadmin/BasicEnvelope.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/wireadmin/BasicEnvelope.java
index e7f7111ce..2c6074365 100644
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/wireadmin/BasicEnvelope.java
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/wireadmin/BasicEnvelope.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.
@@ -45,6 +45,7 @@ public class BasicEnvelope implements Envelope {
/**
* @see org.osgi.service.wireadmin.Envelope#getValue()
*/
+ @Override
public Object getValue() {
return value;
}
@@ -52,6 +53,7 @@ public class BasicEnvelope implements Envelope {
/**
* @see org.osgi.service.wireadmin.Envelope#getIdentification()
*/
+ @Override
public Object getIdentification() {
return identification;
}
@@ -59,6 +61,7 @@ public class BasicEnvelope implements Envelope {
/**
* @see org.osgi.service.wireadmin.Envelope#getScope()
*/
+ @Override
public String getScope() {
return scope;
}
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/wireadmin/Wire.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/wireadmin/Wire.java
index de75c27d5..f1c12931b 100644
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/wireadmin/Wire.java
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/wireadmin/Wire.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.
@@ -118,7 +118,7 @@ public interface Wire {
* {@link WireConstants#WIREADMIN_CONSUMER_FLAVORS} property or the
* value of the property is not of type {@code Class[]}.
*/
- public Class[] getFlavors();
+ public Class<?>[] getFlavors();
/**
* Update the value.
@@ -216,7 +216,7 @@ public interface Wire {
* @return The properties for this {@code Wire} object. The returned
* {@code Dictionary} must be read only.
*/
- public Dictionary getProperties();
+ public Dictionary<String, Object> getProperties();
/**
* Return the calculated scope of this {@code Wire} object.
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/wireadmin/WireAdmin.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/wireadmin/WireAdmin.java
index 783de096c..47b38d0f1 100644
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/wireadmin/WireAdmin.java
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/wireadmin/WireAdmin.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.
@@ -90,7 +90,7 @@ public interface WireAdmin {
* @throws java.lang.IllegalArgumentException If {@code properties} contains
* invalid wire types or case variants of the same key name.
*/
- public Wire createWire(String producerPID, String consumerPID, Dictionary properties);
+ public Wire createWire(String producerPID, String consumerPID, Dictionary<String, ?> properties);
/**
* Delete a {@code Wire} object.
@@ -132,7 +132,7 @@ public interface WireAdmin {
* @throws java.lang.IllegalArgumentException If {@code properties} contains
* invalid wire types or case variants of the same key name.
*/
- public void updateWire(Wire wire, Dictionary properties);
+ public void updateWire(Wire wire, Dictionary<String, ?> properties);
/**
* Return the {@code Wire} objects that match the given {@code filter}.
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/wireadmin/WireAdminEvent.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/wireadmin/WireAdminEvent.java
index 665e72cdd..9b407189c 100644
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/wireadmin/WireAdminEvent.java
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/wireadmin/WireAdminEvent.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.
@@ -60,7 +60,7 @@ public class WireAdminEvent {
/**
* The WireAdmin service which created this event.
*/
- private final ServiceReference reference;
+ private final ServiceReference<WireAdmin> reference;
/**
* The {@code Wire} object associated with this event.
*/
@@ -205,7 +205,7 @@ public class WireAdminEvent {
* @param exception An exception associated with this event. This may be
* {@code null} if no exception is associated with this event.
*/
- public WireAdminEvent(ServiceReference reference, int type, Wire wire, Throwable exception) {
+ public WireAdminEvent(ServiceReference<WireAdmin> reference, int type, Wire wire, Throwable exception) {
this.reference = reference;
this.wire = wire;
this.type = type;
@@ -219,7 +219,7 @@ public class WireAdminEvent {
* @return The {@code ServiceReference} object for the Wire Admin service
* that created this event.
*/
- public ServiceReference getServiceReference() {
+ public ServiceReference<WireAdmin> getServiceReference() {
return reference;
}
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/wireadmin/WirePermission.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/wireadmin/WirePermission.java
index ecf1b5fa8..53e2f6000 100644
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/wireadmin/WirePermission.java
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/wireadmin/WirePermission.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2002, 2015). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2002, 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,8 +20,11 @@ import java.io.IOException;
import java.security.BasicPermission;
import java.security.Permission;
import java.security.PermissionCollection;
+import java.util.ArrayList;
+import java.util.Collections;
import java.util.Enumeration;
import java.util.Hashtable;
+import java.util.List;
/**
* Permission for the scope of a {@code Wire} object. When a {@code Envelope}
@@ -190,6 +193,7 @@ final public class WirePermission extends BasicPermission {
* @return {@code true} if the specified permission is implied by this
* object; {@code false} otherwise.
*/
+ @Override
public boolean implies(Permission p) {
if (p instanceof WirePermission) {
WirePermission requested = (WirePermission) p;
@@ -206,10 +210,11 @@ final public class WirePermission extends BasicPermission {
*
* @return The canonical string representation of the actions.
*/
+ @Override
public String getActions() {
String result = actions;
if (result == null) {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
boolean comma = false;
int mask = getActionsMask();
if ((mask & ACTION_PRODUCE) == ACTION_PRODUCE) {
@@ -233,6 +238,7 @@ final public class WirePermission extends BasicPermission {
* @return A new {@code PermissionCollection} object suitable for storing
* {@code WirePermission} objects.
*/
+ @Override
public PermissionCollection newPermissionCollection() {
return new WirePermissionCollection();
}
@@ -248,6 +254,7 @@ final public class WirePermission extends BasicPermission {
* name and actions as this {@code WirePermission} object;
* {@code false} otherwise.
*/
+ @Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
@@ -264,6 +271,7 @@ final public class WirePermission extends BasicPermission {
*
* @return Hash code value for this object.
*/
+ @Override
public int hashCode() {
int h = 31 * 17 + getName().hashCode();
h = 31 * h + getActions().hashCode();
@@ -278,8 +286,9 @@ final public class WirePermission extends BasicPermission {
*
* @return information about this {@code Permission} object.
*/
+ @Override
public String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append('(');
sb.append(getClass().getName());
sb.append(" \"");
@@ -330,7 +339,7 @@ final class WirePermissionCollection extends PermissionCollection {
* @GuardedBy this
* @serial
*/
- private final Hashtable permissions;
+ private final Hashtable<String, WirePermission>permissions;
/**
* Boolean saying if "*" is in the collection.
*
@@ -344,7 +353,7 @@ final class WirePermissionCollection extends PermissionCollection {
*
*/
public WirePermissionCollection() {
- permissions = new Hashtable();
+ permissions = new Hashtable<>();
all_allowed = false;
}
@@ -359,6 +368,7 @@ final class WirePermissionCollection extends PermissionCollection {
* @throws SecurityException If this PermissionCollection has been marked
* read-only.
*/
+ @Override
public void add(Permission permission) {
if (!(permission instanceof WirePermission)) {
throw new IllegalArgumentException("invalid permission: " + permission);
@@ -369,7 +379,7 @@ final class WirePermissionCollection extends PermissionCollection {
WirePermission wp = (WirePermission) permission;
String name = wp.getName();
synchronized (this) {
- WirePermission existing = (WirePermission) permissions.get(name);
+ WirePermission existing = permissions.get(name);
if (existing != null) {
int oldMask = existing.getActionsMask();
int newMask = wp.getActionsMask();
@@ -396,6 +406,7 @@ final class WirePermissionCollection extends PermissionCollection {
* @return {@code true} if {@code permission} is a proper subset of a
* permission in the set; {@code false} otherwise.
*/
+ @Override
public boolean implies(Permission permission) {
if (!(permission instanceof WirePermission)) {
return false;
@@ -408,7 +419,7 @@ final class WirePermissionCollection extends PermissionCollection {
synchronized (this) {
// short circuit if the "*" Permission was added
if (all_allowed) {
- x = (WirePermission) permissions.get("*");
+ x = permissions.get("*");
if (x != null) {
effective |= x.getActionsMask();
if ((effective & desired) == desired)
@@ -418,7 +429,7 @@ final class WirePermissionCollection extends PermissionCollection {
// strategy:
// Check for full match first. Then work our way up the
// name looking for matches on a.b.*
- x = (WirePermission) permissions.get(name);
+ x = permissions.get(name);
}
if (x != null) {
// we have a direct hit!
@@ -433,7 +444,7 @@ final class WirePermissionCollection extends PermissionCollection {
while ((last = name.lastIndexOf(".", offset)) != -1) {
name = name.substring(0, last + 1) + "*";
synchronized (this) {
- x = (WirePermission) permissions.get(name);
+ x = permissions.get(name);
}
if (x != null) {
effective |= x.getActionsMask();
@@ -453,7 +464,9 @@ final class WirePermissionCollection extends PermissionCollection {
*
* @return Enumeration of all the Permission objects.
*/
- public Enumeration elements() {
- return permissions.elements();
+ @Override
+ public Enumeration<Permission> elements() {
+ List<Permission> all = new ArrayList<Permission>(permissions.values());
+ return Collections.enumeration(all);
}
}
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/wireadmin/package-info.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/wireadmin/package-info.java
index b5af96bb0..6058a3d18 100644
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/wireadmin/package-info.java
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/wireadmin/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.
@@ -32,9 +32,10 @@
* <p>
* {@code Import-Package: org.osgi.service.wireadmin; version="[1.0,1.1)"}
*
- * @version 1.0.1
* @author $Id$
*/
+@Version("1.0.1")
package org.osgi.service.wireadmin;
+import org.osgi.annotation.versioning.Version;
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/wireadmin/packageinfo b/bundles/org.eclipse.osgi.services/src/org/osgi/service/wireadmin/packageinfo
deleted file mode 100644
index b3d1f97f7..000000000
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/wireadmin/packageinfo
+++ /dev/null
@@ -1 +0,0 @@
-version 1.0.1
diff --git a/bundles/org.eclipse.osgi.util/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi.util/META-INF/MANIFEST.MF
index f58db0c5e..fd4880949 100644
--- a/bundles/org.eclipse.osgi.util/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.osgi.util/META-INF/MANIFEST.MF
@@ -9,7 +9,7 @@ Bundle-Localization: plugin
Bundle-DocUrl: http://www.eclipse.org
Bundle-ContactAddress: www.eclipse.org
Export-Package: org.osgi.util.function;version="1.1",
- org.osgi.util.measurement;version="1.0.1",
+ org.osgi.util.measurement;version="1.0.2",
org.osgi.util.position;version="1.0.1";uses:="org.osgi.util.measurement",
org.osgi.util.promise;version="1.1";uses:="org.osgi.util.function",
org.osgi.util.xml;version="1.0.1";uses:="org.osgi.framework,javax.xml.parsers"
diff --git a/bundles/org.eclipse.osgi.util/src/org/osgi/util/measurement/Measurement.java b/bundles/org.eclipse.osgi.util/src/org/osgi/util/measurement/Measurement.java
index 5d6be0f87..4a8cf6629 100644
--- a/bundles/org.eclipse.osgi.util/src/org/osgi/util/measurement/Measurement.java
+++ b/bundles/org.eclipse.osgi.util/src/org/osgi/util/measurement/Measurement.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2002, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2002, 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.
@@ -47,7 +47,7 @@ package org.osgi.util.measurement;
* @Immutable
* @author $Id$
*/
-public class Measurement implements Comparable {
+public class Measurement implements Comparable<Object> {
private final double value;
private final double error;
private final long time;
@@ -362,10 +362,11 @@ public class Measurement implements Comparable {
* @return a {@code String} object representing this {@code Measurement}
* object.
*/
+ @Override
public String toString() {
String result = name;
if (result == null) {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append(value);
if (error != 0.0d) {
sb.append(" +/- ");
@@ -408,6 +409,7 @@ public class Measurement implements Comparable {
* {@code Measurement} object is not equal to the {@code Unit}
* object of this object.
*/
+ @Override
public int compareTo(Object obj) {
if (this == obj) {
return 0;
@@ -437,6 +439,7 @@ public class Measurement implements Comparable {
*
* @return A hash code value for this object.
*/
+ @Override
public int hashCode() {
int h = hashCode;
if (h == 0) {
@@ -463,6 +466,7 @@ public class Measurement implements Comparable {
* @return {@code true} if this object is equal to the specified object;
* {@code false} otherwise.
*/
+ @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
diff --git a/bundles/org.eclipse.osgi.util/src/org/osgi/util/measurement/State.java b/bundles/org.eclipse.osgi.util/src/org/osgi/util/measurement/State.java
index 415613f39..e9fcca59e 100644
--- a/bundles/org.eclipse.osgi.util/src/org/osgi/util/measurement/State.java
+++ b/bundles/org.eclipse.osgi.util/src/org/osgi/util/measurement/State.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2002, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2002, 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.
@@ -91,8 +91,9 @@ public class State {
*
* @return a {@code String} object representing this object.
*/
+ @Override
public String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append(value);
if (name != null) {
sb.append(" \"");
@@ -107,6 +108,7 @@ public class State {
*
* @return A hash code value for this object.
*/
+ @Override
public int hashCode() {
int hash = 31 * 17 + value;
if (name != null) {
@@ -123,6 +125,7 @@ public class State {
* @return {@code true} if this object is equal to the specified object;
* {@code false} otherwise.
*/
+ @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
diff --git a/bundles/org.eclipse.osgi.util/src/org/osgi/util/measurement/Unit.java b/bundles/org.eclipse.osgi.util/src/org/osgi/util/measurement/Unit.java
index e97563d26..64d749c23 100644
--- a/bundles/org.eclipse.osgi.util/src/org/osgi/util/measurement/Unit.java
+++ b/bundles/org.eclipse.osgi.util/src/org/osgi/util/measurement/Unit.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2002, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2002, 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.
@@ -16,7 +16,8 @@
package org.osgi.util.measurement;
-import java.util.Hashtable;
+import java.util.HashMap;
+import java.util.Map;
/**
* A unit system for measurements.
@@ -250,8 +251,8 @@ public class Unit {
*/
private final static Unit[] allUnits = new Unit[] {m, s, kg, K, A, mol, cd, rad, m_s, m_s2, m2, m3, Hz, N, Pa, J, W, C, V, F, Ohm, S, Wb, T, lx, Gy, kat, unity};
- /* @GuardedBy("this") */
- private static Hashtable base;
+ /* @GuardedBy("Unit.class") */
+ private static Map<Unit, Unit> base;
private final String name;
private final long type;
@@ -289,6 +290,7 @@ public class Unit {
* @return true if the specified {@code Unit} object is equal to this
* {@code Unit} object.
*/
+ @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
@@ -304,6 +306,7 @@ public class Unit {
*
* @return This object's hash code.
*/
+ @Override
public int hashCode() {
return 31 * 17 + (int) (type ^ (type >>> 32));
}
@@ -399,13 +402,13 @@ public class Unit {
static synchronized Unit find(long type) {
if (base == null) {
int size = allUnits.length;
- base = new Hashtable(size << 1);
+ base = new HashMap<>(size << 1);
for (int i = 0; i < size; i++) {
base.put(allUnits[i], allUnits[i]);
}
}
Unit unit = new Unit(null, type);
- Unit out = (Unit) base.get(unit);
+ Unit out = base.get(unit);
if (out == null) {
base.put(unit, unit);
out = unit;
@@ -418,6 +421,7 @@ public class Unit {
*
* @return A {@code String} object representing the {@code Unit}
*/
+ @Override
public String toString() {
return name;
}
@@ -431,8 +435,8 @@ public class Unit {
int _mol = (int) (((type >> mol_SHIFT) & MASK) - ZERO);
int _cd = (int) (((type >> cd_SHIFT) & MASK) - ZERO);
int _rad = (int) (((type >> rad_SHIFT) & MASK) - ZERO);
- StringBuffer numerator = new StringBuffer();
- StringBuffer denominator = new StringBuffer();
+ StringBuilder numerator = new StringBuilder();
+ StringBuilder denominator = new StringBuilder();
addSIname(_m, "m", numerator, denominator);
addSIname(_s, "s", numerator, denominator);
addSIname(_kg, "kg", numerator, denominator);
@@ -451,9 +455,10 @@ public class Unit {
return numerator.toString();
}
- private static void addSIname(int si, String name, StringBuffer numerator, StringBuffer denominator) {
+ private static void addSIname(int si, String name, StringBuilder numerator,
+ StringBuilder denominator) {
if (si != 0) {
- StringBuffer sb = (si > 0) ? numerator : denominator;
+ StringBuilder sb = (si > 0) ? numerator : denominator;
if (sb.length() > 0) {
sb.append("*");
}
diff --git a/bundles/org.eclipse.osgi.util/src/org/osgi/util/measurement/package-info.java b/bundles/org.eclipse.osgi.util/src/org/osgi/util/measurement/package-info.java
index 7603bac0b..bac289ab2 100644
--- a/bundles/org.eclipse.osgi.util/src/org/osgi/util/measurement/package-info.java
+++ b/bundles/org.eclipse.osgi.util/src/org/osgi/util/measurement/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.
@@ -26,9 +26,10 @@
* <p>
* {@code Import-Package: org.osgi.util.measurement; version="[1.0,2.0)"}
*
- * @version 1.0.1
* @author $Id$
*/
+@Version("1.0.2")
package org.osgi.util.measurement;
+import org.osgi.annotation.versioning.Version;
diff --git a/bundles/org.eclipse.osgi.util/src/org/osgi/util/measurement/packageinfo b/bundles/org.eclipse.osgi.util/src/org/osgi/util/measurement/packageinfo
deleted file mode 100644
index c2664475c..000000000
--- a/bundles/org.eclipse.osgi.util/src/org/osgi/util/measurement/packageinfo
+++ /dev/null
@@ -1 +0,0 @@
-version 1.0.1 \ No newline at end of file
diff --git a/bundles/org.eclipse.osgi.util/src/org/osgi/util/position/package-info.java b/bundles/org.eclipse.osgi.util/src/org/osgi/util/position/package-info.java
index 63af1b6e6..b67b8069b 100644
--- a/bundles/org.eclipse.osgi.util/src/org/osgi/util/position/package-info.java
+++ b/bundles/org.eclipse.osgi.util/src/org/osgi/util/position/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.
@@ -26,9 +26,10 @@
* <p>
* {@code Import-Package: org.osgi.util.position; version="[1.0,2.0)"}
*
- * @version 1.0.1
* @author $Id$
*/
+@Version("1.0.1")
package org.osgi.util.position;
+import org.osgi.annotation.versioning.Version;
diff --git a/bundles/org.eclipse.osgi.util/src/org/osgi/util/position/packageinfo b/bundles/org.eclipse.osgi.util/src/org/osgi/util/position/packageinfo
deleted file mode 100644
index c2664475c..000000000
--- a/bundles/org.eclipse.osgi.util/src/org/osgi/util/position/packageinfo
+++ /dev/null
@@ -1 +0,0 @@
-version 1.0.1 \ No newline at end of file
diff --git a/bundles/org.eclipse.osgi.util/src/org/osgi/util/promise/Deferred.java b/bundles/org.eclipse.osgi.util/src/org/osgi/util/promise/Deferred.java
index 004925fa1..25c7442d3 100644
--- a/bundles/org.eclipse.osgi.util/src/org/osgi/util/promise/Deferred.java
+++ b/bundles/org.eclipse.osgi.util/src/org/osgi/util/promise/Deferred.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2014, 2016). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2014, 2017). 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.
@@ -16,7 +16,10 @@
package org.osgi.util.promise;
-import static org.osgi.util.promise.PromiseImpl.requireNonNull;
+import static java.util.Objects.requireNonNull;
+
+import java.util.concurrent.Executor;
+import java.util.concurrent.ScheduledExecutorService;
/**
* A Deferred Promise resolution.
@@ -42,14 +45,49 @@ public class Deferred<T> {
private final PromiseImpl<T> promise;
/**
- * Create a new Deferred with an associated Promise.
+ * Create a new Deferred.
+ * <p>
+ * The default callback executor and default scheduled executor will be
+ * used.
*/
public Deferred() {
- promise = new PromiseImpl<>();
+ this(null, null);
+ }
+
+ /**
+ * Create a new Deferred with the specified callback executor.
+ * <p>
+ * The default scheduled executor will be used.
+ *
+ * @param callbackExecutor The executor to use for callbacks. {@code null}
+ * can be specified for the default callback executor.
+ * @since 1.1
+ */
+ public Deferred(Executor callbackExecutor) {
+ this(callbackExecutor, null);
+ }
+
+ /**
+ * Create a new Deferred with the specified callback and scheduled
+ * executors.
+ *
+ * @param callbackExecutor The executor to use for callbacks. {@code null}
+ * can be specified for the default callback executor.
+ * @param scheduledExecutor The scheduled executor for use for scheduled
+ * operations. {@code null} can be specified for the default
+ * scheduled executor.
+ * @since 1.1
+ */
+ public Deferred(Executor callbackExecutor,
+ ScheduledExecutorService scheduledExecutor) {
+ promise = new PromiseImpl<>(callbackExecutor, scheduledExecutor);
}
/**
* Returns the Promise associated with this Deferred.
+ * <p>
+ * All Promise objects created by the associated Promise will use the
+ * executors of the associated Promise.
*
* @return The Promise associated with this Deferred.
*/
diff --git a/bundles/org.eclipse.osgi.util/src/org/osgi/util/promise/PromiseImpl.java b/bundles/org.eclipse.osgi.util/src/org/osgi/util/promise/PromiseImpl.java
index 2afb3771f..1a65fc8ef 100644
--- a/bundles/org.eclipse.osgi.util/src/org/osgi/util/promise/PromiseImpl.java
+++ b/bundles/org.eclipse.osgi.util/src/org/osgi/util/promise/PromiseImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2014, 2016). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2014, 2017). 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.
@@ -16,6 +16,8 @@
package org.osgi.util.promise;
+import static java.util.Objects.requireNonNull;
+
import java.lang.reflect.InvocationTargetException;
import java.util.NoSuchElementException;
import java.util.concurrent.BlockingQueue;
@@ -23,11 +25,13 @@ import java.util.concurrent.CancellationException;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.RunnableScheduledFuture;
+import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.SynchronousQueue;
@@ -42,18 +46,26 @@ import org.osgi.util.function.Predicate;
/**
* Promise implementation.
- *
* <p>
* This class is not used directly by clients. Clients should use
* {@link Deferred} to create a resolvable {@link Promise}.
*
* @param <T> The result type associated with the Promise.
- *
* @ThreadSafe
* @author $Id$
*/
final class PromiseImpl<T> implements Promise<T> {
/**
+ * The executor to use for callbacks. If {@code null}, the default callback
+ * executor is used.
+ */
+ private final Executor callbackExecutor;
+ /**
+ * The executor to use for scheduled operations. If {@code null}, the
+ * default scheduled executor is used.
+ */
+ private final ScheduledExecutorService scheduledExecutor;
+ /**
* A ConcurrentLinkedQueue to hold the callbacks for this Promise, so no
* additional synchronization is required to write to or read from the
* queue.
@@ -91,8 +103,17 @@ final class PromiseImpl<T> implements Promise<T> {
/**
* Initialize this Promise.
+ *
+ * @param callbackExecutor The executor to use for callbacks. {@code null}
+ * can be specified for the default callback executor.
+ * @param scheduledExecutor The scheduled executor for use for scheduled
+ * operations. {@code null} can be specified for the default
+ * scheduled executor.
*/
- PromiseImpl() {
+ PromiseImpl(Executor callbackExecutor,
+ ScheduledExecutorService scheduledExecutor) {
+ this.callbackExecutor = callbackExecutor;
+ this.scheduledExecutor = scheduledExecutor;
callbacks = new ConcurrentLinkedQueue<>();
resolved = new CountDownLatch(1);
}
@@ -102,13 +123,21 @@ final class PromiseImpl<T> implements Promise<T> {
*
* @param v The value of this resolved Promise.
* @param f The failure of this resolved Promise.
+ * @param callbackExecutor The executor to use for callbacks. {@code null}
+ * can be specified for the default callback executor.
+ * @param scheduledExecutor The scheduled executor for use for scheduled
+ * operations. {@code null} can be specified for the default
+ * scheduled executor.
*/
- PromiseImpl(T v, Throwable f) {
+ PromiseImpl(T v, Throwable f, Executor callbackExecutor,
+ ScheduledExecutorService scheduledExecutor) {
if (f == null) {
value = v;
} else {
fail = f;
}
+ this.callbackExecutor = callbackExecutor;
+ this.scheduledExecutor = scheduledExecutor;
callbacks = new ConcurrentLinkedQueue<>();
resolved = new CountDownLatch(0);
}
@@ -164,24 +193,6 @@ final class PromiseImpl<T> implements Promise<T> {
}
/**
- * Call any registered callbacks if this Promise is resolved.
- */
- private void notifyCallbacks() {
- if (resolved.getCount() != 0) {
- return; // return if not resolved
- }
-
- /*
- * Note: multiple threads can be in this method removing callbacks from
- * the queue and executing them, so the order in which callbacks are
- * executed cannot be specified.
- */
- for (Runnable callback = callbacks.poll(); callback != null; callback = callbacks.poll()) {
- Callbacks.execute(callback);
- }
- }
-
- /**
* {@inheritDoc}
*/
@Override
@@ -245,17 +256,65 @@ final class PromiseImpl<T> implements Promise<T> {
}
/**
+ * Call any registered callbacks if this Promise is resolved.
+ */
+ private void notifyCallbacks() {
+ if (resolved.getCount() != 0) {
+ return; // return if not resolved
+ }
+
+ /*
+ * Note: multiple threads can be in this method removing callbacks from
+ * the queue and executing them, so the order in which callbacks are
+ * executed cannot be specified.
+ */
+ Executor executor = callbackExecutor;
+ for (Runnable callback = callbacks.poll(); callback != null; callback = callbacks.poll()) {
+ if (executor == null) {
+ executor = DefaultExecutors.callbackExecutor();
+ }
+ try {
+ try {
+ executor.execute(callback);
+ } catch (RejectedExecutionException e) {
+ callback.run();
+ }
+ } catch (Throwable t) {
+ uncaughtException(t);
+ }
+ }
+ }
+
+ /**
+ * Handle an uncaught exception from a Runnable.
+ *
+ * @param t The uncaught exception.
+ * @since 1.1
+ */
+ static void uncaughtException(Throwable t) {
+ try {
+ Thread thread = Thread.currentThread();
+ thread.getUncaughtExceptionHandler().uncaughtException(thread, t);
+ } catch (Throwable ignored) {
+ // we ignore this
+ }
+ }
+
+ /**
* {@inheritDoc}
*/
@Override
public <R> Promise<R> then(Success<? super T, ? extends R> success, Failure failure) {
- PromiseImpl<R> chained = new PromiseImpl<>();
+ PromiseImpl<R> chained = new PromiseImpl<>(callbackExecutor,
+ scheduledExecutor);
onResolve(chained.new Then<>(this, success, failure));
return chained;
}
/**
* {@inheritDoc}
+ *
+ * @since 1.1
*/
@Override
public <R> Promise<R> then(Success<? super T, ? extends R> success) {
@@ -263,6 +322,17 @@ final class PromiseImpl<T> implements Promise<T> {
}
/**
+ * {@inheritDoc}
+ */
+ @Override
+ public Promise<T> then(Callback callback) {
+ PromiseImpl<T> chained = new PromiseImpl<>(callbackExecutor,
+ scheduledExecutor);
+ onResolve(chained.new Chain(this, callback));
+ return chained;
+ }
+
+ /**
* A callback used to chain promises for the {@link #then(Success, Failure)}
* method.
*
@@ -357,16 +427,6 @@ final class PromiseImpl<T> implements Promise<T> {
}
/**
- * {@inheritDoc}
- */
- @Override
- public Promise<T> then(Callback callback) {
- PromiseImpl<T> chained = new PromiseImpl<>();
- onResolve(chained.new Chain(this, callback));
- return chained;
- }
-
- /**
* Resolve this Promise with the specified Promise.
*
* <p>
@@ -386,7 +446,8 @@ final class PromiseImpl<T> implements Promise<T> {
* resolved.
*/
Promise<Void> resolveWith(Promise<? extends T> with) {
- PromiseImpl<Void> chained = new PromiseImpl<>();
+ PromiseImpl<Void> chained = new PromiseImpl<>(callbackExecutor,
+ scheduledExecutor);
with.onResolve(new ResolveWith(with, chained));
return chained;
}
@@ -424,7 +485,8 @@ final class PromiseImpl<T> implements Promise<T> {
*/
@Override
public Promise<T> filter(Predicate<? super T> predicate) {
- PromiseImpl<T> chained = new PromiseImpl<>();
+ PromiseImpl<T> chained = new PromiseImpl<>(callbackExecutor,
+ scheduledExecutor);
onResolve(chained.new Filter(this, predicate));
return chained;
}
@@ -464,7 +526,8 @@ final class PromiseImpl<T> implements Promise<T> {
*/
@Override
public <R> Promise<R> map(Function<? super T, ? extends R> mapper) {
- PromiseImpl<R> chained = new PromiseImpl<>();
+ PromiseImpl<R> chained = new PromiseImpl<>(callbackExecutor,
+ scheduledExecutor);
onResolve(chained.new Map<>(this, mapper));
return chained;
}
@@ -504,7 +567,8 @@ final class PromiseImpl<T> implements Promise<T> {
*/
@Override
public <R> Promise<R> flatMap(Function<? super T, Promise<? extends R>> mapper) {
- PromiseImpl<R> chained = new PromiseImpl<>();
+ PromiseImpl<R> chained = new PromiseImpl<>(callbackExecutor,
+ scheduledExecutor);
onResolve(chained.new FlatMap<>(this, mapper));
return chained;
}
@@ -548,7 +612,8 @@ final class PromiseImpl<T> implements Promise<T> {
*/
@Override
public Promise<T> recover(Function<Promise<?>, ? extends T> recovery) {
- PromiseImpl<T> chained = new PromiseImpl<>();
+ PromiseImpl<T> chained = new PromiseImpl<>(callbackExecutor,
+ scheduledExecutor);
onResolve(chained.new Recover(this, recovery));
return chained;
}
@@ -591,7 +656,8 @@ final class PromiseImpl<T> implements Promise<T> {
*/
@Override
public Promise<T> recoverWith(Function<Promise<?>, Promise<? extends T>> recovery) {
- PromiseImpl<T> chained = new PromiseImpl<>();
+ PromiseImpl<T> chained = new PromiseImpl<>(callbackExecutor,
+ scheduledExecutor);
onResolve(chained.new RecoverWith(this, recovery));
return chained;
}
@@ -635,7 +701,8 @@ final class PromiseImpl<T> implements Promise<T> {
*/
@Override
public Promise<T> fallbackTo(Promise<? extends T> fallback) {
- PromiseImpl<T> chained = new PromiseImpl<>();
+ PromiseImpl<T> chained = new PromiseImpl<>(callbackExecutor,
+ scheduledExecutor);
onResolve(chained.new FallbackTo(this, fallback));
return chained;
}
@@ -666,13 +733,37 @@ final class PromiseImpl<T> implements Promise<T> {
}
/**
+ * Schedule a operation on the scheduled executor.
+ *
+ * @since 1.1
+ */
+ ScheduledFuture< ? > schedule(Runnable operation, long delay,
+ TimeUnit unit) {
+ ScheduledExecutorService executor = scheduledExecutor;
+ if (executor == null) {
+ executor = DefaultExecutors.scheduledExecutor();
+ }
+ try {
+ try {
+ return executor.schedule(operation, delay, unit);
+ } catch (RejectedExecutionException e) {
+ operation.run();
+ }
+ } catch (Throwable t) {
+ uncaughtException(t);
+ }
+ return null;
+ }
+
+ /**
* {@inheritDoc}
*
* @since 1.1
*/
@Override
public Promise<T> timeout(long millis) {
- PromiseImpl<T> chained = new PromiseImpl<>();
+ PromiseImpl<T> chained = new PromiseImpl<>(callbackExecutor,
+ scheduledExecutor);
if (!isDone()) {
onResolve(chained.new Timeout(millis, TimeUnit.MILLISECONDS));
}
@@ -691,7 +782,7 @@ final class PromiseImpl<T> implements Promise<T> {
private final ScheduledFuture< ? > future;
Timeout(long timeout, TimeUnit unit) {
- future = Callbacks.schedule(new TimeoutAction(), timeout, unit);
+ future = schedule(new TimeoutAction(), timeout, unit);
}
@Override
@@ -701,15 +792,16 @@ final class PromiseImpl<T> implements Promise<T> {
}
}
}
-
+
/**
* Callback used to fail the Promise if the timeout expires.
*
* @Immutable
+ * @since 1.1
*/
private final class TimeoutAction implements Runnable {
TimeoutAction() {}
-
+
@Override
public void run() {
tryResolve(null, new TimeoutException());
@@ -723,7 +815,8 @@ final class PromiseImpl<T> implements Promise<T> {
*/
@Override
public Promise<T> delay(long millis) {
- PromiseImpl<T> chained = new PromiseImpl<>();
+ PromiseImpl<T> chained = new PromiseImpl<>(callbackExecutor,
+ scheduledExecutor);
onResolve(new Delay(chained.new Chain(this), millis,
TimeUnit.MILLISECONDS));
return chained;
@@ -736,76 +829,54 @@ final class PromiseImpl<T> implements Promise<T> {
* @Immutable
* @since 1.1
*/
- private static final class Delay implements Runnable {
- private final Runnable callback;
+ private final class Delay implements Runnable {
+ private final Runnable operation;
private final long delay;
private final TimeUnit unit;
- Delay(Runnable callback, long delay, TimeUnit unit) {
- this.callback = callback;
+ Delay(Runnable operation, long delay, TimeUnit unit) {
+ this.operation = operation;
this.delay = delay;
this.unit = unit;
}
@Override
public void run() {
- Callbacks.schedule(callback, delay, unit);
+ schedule(operation, delay, unit);
}
}
/**
- * Callback handler used to asynchronously execute callbacks.
+ * Default executors for callbacks.
*
* @Immutable
* @since 1.1
*/
- private static final class Callbacks
+ private static final class DefaultExecutors
implements ThreadFactory, RejectedExecutionHandler, Runnable {
- private static final Callbacks callbacks;
+ private static final DefaultExecutors callbacks;
private static final ScheduledExecutor scheduledExecutor;
private static final ThreadPoolExecutor callbackExecutor;
static {
- callbacks = new Callbacks();
+ callbacks = new DefaultExecutors();
scheduledExecutor = new ScheduledExecutor(2, callbacks);
callbackExecutor = new ThreadPoolExecutor(0, 64, 60L,
TimeUnit.SECONDS, new SynchronousQueue<Runnable>(),
callbacks, callbacks);
}
- /**
- * Schedule a callback on the scheduled executor
- */
- static ScheduledFuture< ? > schedule(Runnable callback, long delay,
- TimeUnit unit) {
- try {
- return scheduledExecutor.schedule(callback, delay, unit);
- } catch (RejectedExecutionException e) {
- callbacks.rejectedExecution(callback, scheduledExecutor);
- return null;
- }
+ static Executor callbackExecutor() {
+ return callbackExecutor;
}
- /**
- * Execute a callback on the callback executor
- */
- static void execute(Runnable callback) {
- callbackExecutor.execute(callback);
- }
-
- static void uncaughtException(Throwable t) {
- try {
- Thread thread = Thread.currentThread();
- thread.getUncaughtExceptionHandler().uncaughtException(thread,
- t);
- } catch (Throwable ignored) {
- // we ignore this
- }
+ static ScheduledExecutorService scheduledExecutor() {
+ return scheduledExecutor;
}
private final AtomicBoolean shutdownHookInstalled;
private final ThreadFactory delegateThreadFactory;
- private Callbacks() {
+ private DefaultExecutors() {
shutdownHookInstalled = new AtomicBoolean();
delegateThreadFactory = Executors.defaultThreadFactory();
}
@@ -929,13 +1000,14 @@ final class PromiseImpl<T> implements Promise<T> {
* A holder of the result of a promise.
*
* @NotThreadSafe
+ * @since 1.1
*/
static final class Result<P> {
Throwable fail;
P value;
-
+
Result() {}
-
+
static <R> Result<R> collect(Promise< ? extends R> promise) {
Result<R> result = new Result<>();
final boolean interrupted = Thread.interrupted();
@@ -954,11 +1026,4 @@ final class PromiseImpl<T> implements Promise<T> {
return result;
}
}
-
- static <V> V requireNonNull(V value) {
- if (value != null) {
- return value;
- }
- throw new NullPointerException();
- }
}
diff --git a/bundles/org.eclipse.osgi.util/src/org/osgi/util/promise/Promises.java b/bundles/org.eclipse.osgi.util/src/org/osgi/util/promise/Promises.java
index 7067fe50a..394bce4bb 100644
--- a/bundles/org.eclipse.osgi.util/src/org/osgi/util/promise/Promises.java
+++ b/bundles/org.eclipse.osgi.util/src/org/osgi/util/promise/Promises.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2014, 2016). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2014, 2017). 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.
@@ -16,7 +16,7 @@
package org.osgi.util.promise;
-import static org.osgi.util.promise.PromiseImpl.requireNonNull;
+import static java.util.Objects.requireNonNull;
import java.util.ArrayList;
import java.util.Arrays;
@@ -38,43 +38,42 @@ public class Promises {
}
/**
- * Create a new Promise that has been resolved with the specified value.
+ * Returns a new Promise that has been resolved with the specified value.
*
* @param <T> The value type associated with the returned Promise.
* @param value The value of the resolved Promise.
* @return A new Promise that has been resolved with the specified value.
*/
public static <T> Promise<T> resolved(T value) {
- return new PromiseImpl<>(value, null);
+ return new PromiseImpl<>(value, null, null, null);
}
/**
- * Create a new Promise that has been resolved with the specified failure.
+ * Returns a new Promise that has been resolved with the specified failure.
*
* @param <T> The value type associated with the returned Promise.
* @param failure The failure of the resolved Promise. Must not be
- * {@code null}.
+ * {@code null}.
* @return A new Promise that has been resolved with the specified failure.
*/
public static <T> Promise<T> failed(Throwable failure) {
- return new PromiseImpl<>(null, requireNonNull(failure));
+ return new PromiseImpl<>(null, requireNonNull(failure), null, null);
}
/**
- * Create a new Promise that is a latch on the resolution of the specified
+ * Returns a new Promise that is a latch on the resolution of the specified
* Promises.
- *
* <p>
- * The new Promise acts as a gate and must be resolved after all of the
+ * The returned Promise acts as a gate and must be resolved after all of the
* specified Promises are resolved.
*
* @param <T> The value type of the List value associated with the returned
- * Promise.
+ * Promise.
* @param <S> A subtype of the value type of the List value associated with
- * the returned Promise.
+ * the returned Promise.
* @param promises The Promises which must be resolved before the returned
- * Promise must be resolved. Must not be {@code null} and all of the
- * elements in the collection must not be {@code null}.
+ * Promise must be resolved. Must not be {@code null} and all of
+ * the elements in the collection must not be {@code null}.
* @return A Promise that is resolved only when all the specified Promises
* are resolved. The returned Promise must be successfully resolved
* with a List of the values in the order of the specified Promises
@@ -87,33 +86,67 @@ public class Promises {
* Promises which resolved with a failure.
*/
public static <T, S extends T> Promise<List<T>> all(Collection<Promise<S>> promises) {
+ return all(new Deferred<List<T>>(), promises);
+ }
+
+ /**
+ * Resolves the Promise returned by the specified Deferred when the
+ * specified Promises are all resolved.
+ * <p>
+ * The returned Promise acts as a gate and must be resolved after all of the
+ * specified Promises are resolved.
+ *
+ * @param <T> The value type of the List value associated with the returned
+ * Promise.
+ * @param <S> A subtype of the value type of the List value associated with
+ * the returned Promise.
+ * @param deferred The specified Deferred is used to obtain and resolve the
+ * returned Promise. Must not be {@code null} and must not have
+ * already resolved the returned Promise.
+ * @param promises The Promises which must be resolved before the returned
+ * Promise must be resolved. Must not be {@code null} and all of
+ * the elements in the collection must not be {@code null}.
+ * @return The Promise from the specified Deferred. It is resolved only when
+ * all the specified Promises are resolved. The returned Promise
+ * must be successfully resolved with a List of the values in the
+ * order of the specified Promises if all the specified Promises are
+ * successfully resolved. The List in the returned Promise is the
+ * property of the caller and is modifiable. The returned Promise
+ * must be resolved with a failure of
+ * {@link FailedPromisesException} if any of the specified Promises
+ * are resolved with a failure. The failure
+ * {@link FailedPromisesException} must contain all of the specified
+ * Promises which resolved with a failure.
+ * @since 1.1
+ */
+ public static <T, S extends T> Promise<List<T>> all(
+ Deferred<List<T>> deferred, Collection<Promise<S>> promises) {
if (promises.isEmpty()) {
List<T> result = new ArrayList<>();
- return resolved(result);
- }
- /* make a copy and capture the ordering */
- List<Promise< ? extends T>> list = new ArrayList<Promise< ? extends T>>(
- promises);
- PromiseImpl<List<T>> chained = new PromiseImpl<>();
- All<T> all = new All<>(chained, list);
- for (Promise<? extends T> promise : list) {
- promise.onResolve(all);
+ deferred.resolve(result);
+ } else {
+ /* make a copy and capture the ordering */
+ List<Promise< ? extends T>> list = new ArrayList<Promise< ? extends T>>(
+ promises);
+ All<T> all = new All<>(deferred, list);
+ for (Promise< ? extends T> promise : list) {
+ promise.onResolve(all);
+ }
}
- return chained;
+ return deferred.getPromise();
}
/**
- * Create a new Promise that is a latch on the resolution of the specified
+ * Returns a new Promise that is a latch on the resolution of the specified
* Promises.
- *
* <p>
* The new Promise acts as a gate and must be resolved after all of the
* specified Promises are resolved.
*
* @param <T> The value type associated with the specified Promises.
* @param promises The Promises which must be resolved before the returned
- * Promise must be resolved. Must not be {@code null} and all of the
- * arguments must not be {@code null}.
+ * Promise must be resolved. Must not be {@code null} and all of
+ * the arguments must not be {@code null}.
* @return A Promise that is resolved only when all the specified Promises
* are resolved. The returned Promise must be successfully resolved
* with a List of the values in the order of the specified Promises
@@ -133,17 +166,55 @@ public class Promises {
}
/**
- * A callback used to resolve a Promise when the specified list of Promises
+ * Resolves the Promise returned by the specified Deferred when the
+ * specified Promises are all resolved.
+ * <p>
+ * The new Promise acts as a gate and must be resolved after all of the
+ * specified Promises are resolved.
+ *
+ * @param <T> The value type associated with the specified Promises.
+ * @param deferred The specified Deferred is used to obtain and resolve the
+ * returned Promise. Must not be {@code null} and must not have
+ * already resolved the returned Promise.
+ * @param promises The Promises which must be resolved before the returned
+ * Promise must be resolved. Must not be {@code null} and all of
+ * the arguments must not be {@code null}.
+ * @return The Promise from the specified Deferred. It is resolved only when
+ * all the specified Promises are resolved. The returned Promise
+ * must be successfully resolved with a List of the values in the
+ * order of the specified Promises if all the specified Promises are
+ * successfully resolved. The List in the returned Promise is the
+ * property of the caller and is modifiable. The returned Promise
+ * must be resolved with a failure of
+ * {@link FailedPromisesException} if any of the specified Promises
+ * are resolved with a failure. The failure
+ * {@link FailedPromisesException} must contain all of the specified
+ * Promises which resolved with a failure.
+ * @since 1.1
+ */
+ @SafeVarargs
+ public static <T> Promise<List<T>> all(Deferred<List<T>> deferred,
+ Promise< ? extends T>... promises) {
+ @SuppressWarnings("unchecked")
+ List<Promise<T>> list = Arrays.asList((Promise<T>[]) promises);
+ return all(deferred, list);
+ }
+
+ /**
+ * A callback used to resolve a Deferred when the specified list of Promises
* are resolved for the {@link Promises#all(Collection)} method.
*
* @ThreadSafe
*/
private static final class All<T> implements Runnable {
- private final PromiseImpl<List<T>> chained;
+ private final Deferred<List<T>> chained;
private final List<Promise<? extends T>> promises;
private final AtomicInteger promiseCount;
- All(PromiseImpl<List<T>> chained, List<Promise<? extends T>> promises) {
+ All(Deferred<List<T>> chained, List<Promise< ? extends T>> promises) {
+ if (chained.getPromise().isDone()) {
+ throw new IllegalStateException("Already resolved");
+ }
this.chained = chained;
this.promises = promises;
this.promiseCount = new AtomicInteger(promises.size());
@@ -169,10 +240,9 @@ public class Promises {
}
}
if (failed.isEmpty()) {
- chained.tryResolve(value, null);
+ chained.resolve(value);
} else {
- chained.tryResolve(null,
- new FailedPromisesException(failed, cause));
+ chained.fail(new FailedPromisesException(failed, cause));
}
}
}
diff --git a/bundles/org.eclipse.osgi.util/src/org/osgi/util/xml/XMLParserActivator.java b/bundles/org.eclipse.osgi.util/src/org/osgi/util/xml/XMLParserActivator.java
index c73b3c061..64be3f5cf 100644
--- a/bundles/org.eclipse.osgi.util/src/org/osgi/util/xml/XMLParserActivator.java
+++ b/bundles/org.eclipse.osgi.util/src/org/osgi/util/xml/XMLParserActivator.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.
@@ -91,9 +91,9 @@ import org.osgi.framework.ServiceRegistration;
* @ThreadSafe
* @author $Id$
*/
-public class XMLParserActivator implements BundleActivator, ServiceFactory {
+public class XMLParserActivator implements BundleActivator, ServiceFactory<Object> {
/** Context of this bundle */
- private volatile BundleContext context;
+ private volatile BundleContext bundleContext;
/**
* Filename containing the SAX Parser Factory Class name. Also used as the
* basis for the {@code SERVICE_PID} registration property.
@@ -150,8 +150,9 @@ public class XMLParserActivator implements BundleActivator, ServiceFactory {
* bundle's listeners, unregister all services registered by this
* bundle, and release all services used by this bundle.
*/
+ @Override
public void start(BundleContext context) throws Exception {
- this.context = context;
+ this.bundleContext = context;
Bundle parserBundle = context.getBundle();
// check for sax parsers
registerSAXParsers(getParserFactoryClassNames(parserBundle.getResource(SAXCLASSFILE)));
@@ -169,6 +170,7 @@ public class XMLParserActivator implements BundleActivator, ServiceFactory {
* the bundle's listeners, unregister all services registered by the
* bundle, and release all services used by the bundle.
*/
+ @Override
public void stop(BundleContext context) throws Exception {
// framework will automatically unregister the parser services
}
@@ -183,11 +185,11 @@ public class XMLParserActivator implements BundleActivator, ServiceFactory {
* @return A List of strings containing the parser class names.
* @throws IOException if there is a problem reading the URL input stream
*/
- private List getParserFactoryClassNames(URL parserUrl) throws IOException {
+ private List<String> getParserFactoryClassNames(URL parserUrl) throws IOException {
if (parserUrl == null) {
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
- List v = new ArrayList(1);
+ List<String> v = new ArrayList<String>(1);
String parserFactoryClassName = null;
InputStream is = parserUrl.openStream();
BufferedReader br = new BufferedReader(new InputStreamReader(is));
@@ -220,17 +222,17 @@ public class XMLParserActivator implements BundleActivator, ServiceFactory {
* containing the names of the parser Factory Classes
* @throws FactoryConfigurationError if thrown from {@code getFactory}
*/
- private void registerSAXParsers(List parserFactoryClassNames) throws FactoryConfigurationError {
- Iterator e = parserFactoryClassNames.iterator();
+ private void registerSAXParsers(List<String> parserFactoryClassNames) throws FactoryConfigurationError {
+ Iterator<String> e = parserFactoryClassNames.iterator();
int index = 0;
while (e.hasNext()) {
- String parserFactoryClassName = (String) e.next();
+ String parserFactoryClassName = e.next();
// create a sax parser factory just to get it's default
// properties. It will never be used since
// this class will operate as a service factory and give each
// service requestor it's own SaxParserFactory
SAXParserFactory factory = (SAXParserFactory) getFactory(parserFactoryClassName);
- Hashtable properties = new Hashtable(7);
+ Hashtable<String, Object> properties = new Hashtable<String, Object>(7);
// figure out the default properties of the parser
setDefaultSAXProperties(factory, properties, index);
// store the parser factory class name in the properties so that
@@ -238,7 +240,7 @@ public class XMLParserActivator implements BundleActivator, ServiceFactory {
// to return a parser factory
properties.put(FACTORYNAMEKEY, parserFactoryClassName);
// register the factory as a service
- context.registerService(SAXFACTORYNAME, this, properties);
+ bundleContext.registerService(SAXFACTORYNAME, this, properties);
index++;
}
}
@@ -259,9 +261,9 @@ public class XMLParserActivator implements BundleActivator, ServiceFactory {
* @param factory The {@code SAXParserFactory} object
* @param props {@code Hashtable} of service properties.
*/
- private void setDefaultSAXProperties(SAXParserFactory factory, Hashtable props, int index) {
+ private void setDefaultSAXProperties(SAXParserFactory factory, Hashtable<String, Object> props, int index) {
props.put(Constants.SERVICE_DESCRIPTION, SAXFACTORYDESCRIPTION);
- props.put(Constants.SERVICE_PID, SAXFACTORYNAME + "." + context.getBundle().getBundleId() + "." + index);
+ props.put(Constants.SERVICE_PID, SAXFACTORYNAME + "." + bundleContext.getBundle().getBundleId() + "." + index);
setSAXProperties(factory, props);
}
@@ -285,7 +287,7 @@ public class XMLParserActivator implements BundleActivator, ServiceFactory {
* @param factory - the SAXParserFactory object
* @param properties - the properties object for the service
*/
- public void setSAXProperties(SAXParserFactory factory, Hashtable properties) {
+ public void setSAXProperties(SAXParserFactory factory, Hashtable<String, Object> properties) {
// check if this parser can be configured to validate
boolean validating = true;
factory.setValidating(true);
@@ -308,8 +310,8 @@ public class XMLParserActivator implements BundleActivator, ServiceFactory {
factory.setValidating(validating);
factory.setNamespaceAware(namespaceaware);
// set the OSGi service properties
- properties.put(PARSER_NAMESPACEAWARE, new Boolean(namespaceaware));
- properties.put(PARSER_VALIDATING, new Boolean(validating));
+ properties.put(PARSER_NAMESPACEAWARE, Boolean.valueOf(namespaceaware));
+ properties.put(PARSER_VALIDATING, Boolean.valueOf(validating));
}
/**
@@ -319,17 +321,17 @@ public class XMLParserActivator implements BundleActivator, ServiceFactory {
* containing the names of the parser Factory Classes
* @throws FactoryConfigurationError if thrown from {@code getFactory}
*/
- private void registerDOMParsers(List parserFactoryClassNames) throws FactoryConfigurationError {
- Iterator e = parserFactoryClassNames.iterator();
+ private void registerDOMParsers(List<String> parserFactoryClassNames) throws FactoryConfigurationError {
+ Iterator<String> e = parserFactoryClassNames.iterator();
int index = 0;
while (e.hasNext()) {
- String parserFactoryClassName = (String) e.next();
+ String parserFactoryClassName = e.next();
// create a dom parser factory just to get it's default
// properties. It will never be used since
// this class will operate as a service factory and give each
// service requestor it's own DocumentBuilderFactory
DocumentBuilderFactory factory = (DocumentBuilderFactory) getFactory(parserFactoryClassName);
- Hashtable properties = new Hashtable(7);
+ Hashtable<String, Object> properties = new Hashtable<String, Object>(7);
// figure out the default properties of the parser
setDefaultDOMProperties(factory, properties, index);
// store the parser factory class name in the properties so that
@@ -337,7 +339,7 @@ public class XMLParserActivator implements BundleActivator, ServiceFactory {
// to return a parser factory
properties.put(FACTORYNAMEKEY, parserFactoryClassName);
// register the factory as a service
- context.registerService(DOMFACTORYNAME, this, properties);
+ bundleContext.registerService(DOMFACTORYNAME, this, properties);
index++;
}
}
@@ -356,9 +358,9 @@ public class XMLParserActivator implements BundleActivator, ServiceFactory {
* @param factory The {@code DocumentBuilderFactory} object
* @param props {@code Hashtable} of service properties.
*/
- private void setDefaultDOMProperties(DocumentBuilderFactory factory, Hashtable props, int index) {
+ private void setDefaultDOMProperties(DocumentBuilderFactory factory, Hashtable<String, Object> props, int index) {
props.put(Constants.SERVICE_DESCRIPTION, DOMFACTORYDESCRIPTION);
- props.put(Constants.SERVICE_PID, DOMFACTORYNAME + "." + context.getBundle().getBundleId() + "." + index);
+ props.put(Constants.SERVICE_PID, DOMFACTORYNAME + "." + bundleContext.getBundle().getBundleId() + "." + index);
setDOMProperties(factory, props);
}
@@ -382,7 +384,7 @@ public class XMLParserActivator implements BundleActivator, ServiceFactory {
* @param factory - the DocumentBuilderFactory object
* @param props - Hashtable of service properties.
*/
- public void setDOMProperties(DocumentBuilderFactory factory, Hashtable props) {
+ public void setDOMProperties(DocumentBuilderFactory factory, Hashtable<String, Object> props) {
// check if this parser can be configured to validate
boolean validating = true;
factory.setValidating(true);
@@ -405,8 +407,8 @@ public class XMLParserActivator implements BundleActivator, ServiceFactory {
factory.setValidating(validating);
factory.setNamespaceAware(namespaceaware);
// set the OSGi service properties
- props.put(PARSER_VALIDATING, new Boolean(validating));
- props.put(PARSER_NAMESPACEAWARE, new Boolean(namespaceaware));
+ props.put(PARSER_VALIDATING, Boolean.valueOf(validating));
+ props.put(PARSER_NAMESPACEAWARE, Boolean.valueOf(namespaceaware));
}
/**
@@ -419,7 +421,7 @@ public class XMLParserActivator implements BundleActivator, ServiceFactory {
*/
private Object getFactory(String parserFactoryClassName) throws FactoryConfigurationError {
try {
- return context.getBundle().loadClass(parserFactoryClassName).newInstance();
+ return bundleContext.getBundle().loadClass(parserFactoryClassName).newInstance();
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
@@ -448,8 +450,9 @@ public class XMLParserActivator implements BundleActivator, ServiceFactory {
* @return A new, configured XML Parser Factory object or null if a
* configuration error was encountered
*/
- public Object getService(Bundle bundle, ServiceRegistration registration) {
- ServiceReference sref = registration.getReference();
+ @Override
+ public Object getService(Bundle bundle, ServiceRegistration<Object> registration) {
+ ServiceReference<Object> sref = registration.getReference();
String parserFactoryClassName = (String) sref.getProperty(FACTORYNAMEKEY);
// need to set factory properties
Object factory = getFactory(parserFactoryClassName);
@@ -474,6 +477,8 @@ public class XMLParserActivator implements BundleActivator, ServiceFactory {
* @param service The XML Parser Factory object returned by a previous call
* to the {@code getService} method.
*/
- public void ungetService(Bundle bundle, ServiceRegistration registration, Object service) {
+ @Override
+ public void ungetService(Bundle bundle, ServiceRegistration<Object> registration, Object service) {
+ // nothing to do
}
}
diff --git a/bundles/org.eclipse.osgi.util/src/org/osgi/util/xml/package-info.java b/bundles/org.eclipse.osgi.util/src/org/osgi/util/xml/package-info.java
index 8d3c57bb5..1f05ed780 100644
--- a/bundles/org.eclipse.osgi.util/src/org/osgi/util/xml/package-info.java
+++ b/bundles/org.eclipse.osgi.util/src/org/osgi/util/xml/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.
@@ -26,9 +26,10 @@
* <p>
* {@code Import-Package: org.osgi.util.xml; version="[1.0,2.0)"}
*
- * @version 1.0.1
* @author $Id$
*/
+@Version("1.0.1")
package org.osgi.util.xml;
+import org.osgi.annotation.versioning.Version;
diff --git a/bundles/org.eclipse.osgi.util/src/org/osgi/util/xml/packageinfo b/bundles/org.eclipse.osgi.util/src/org/osgi/util/xml/packageinfo
deleted file mode 100644
index c2664475c..000000000
--- a/bundles/org.eclipse.osgi.util/src/org/osgi/util/xml/packageinfo
+++ /dev/null
@@ -1 +0,0 @@
-version 1.0.1 \ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/log/LogEntry.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/log/LogEntry.java
index 6b3ee59f7..9dca75876 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/log/LogEntry.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/log/LogEntry.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2016). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2017). 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.
@@ -68,11 +68,11 @@ public interface LogEntry {
int getLevel();
/**
- * Returns the human readable message associated with this {@code LogEntry}
+ * Returns the formatted message associated with this {@code LogEntry}
* object.
*
- * @return {@code String} containing the message associated with this
- * {@code LogEntry} object.
+ * @return {@code String} containing the formatted message associated with
+ * this {@code LogEntry} object.
*/
String getMessage();
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/resolver/Resolver.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/resolver/Resolver.java
index 555f3cd15..b51c25d7a 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/resolver/Resolver.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/resolver/Resolver.java
@@ -77,13 +77,15 @@ public interface Resolver {
Map<Resource, List<Wire>> resolve(ResolveContext context) throws ResolutionException;
/**
- * Resolves a given dynamic requirement dynamically for the given host
- * wiring using the given resolve context and return any new resources and
- * wires to the caller.
+ * Resolves a given requirement dynamically for the given host wiring using
+ * the given resolve context and return any new resources and wires to the
+ * caller.
* <p>
* The requirement must be a {@link Wiring#getResourceRequirements(String)
* requirement} of the wiring and must use the
- * {@link PackageNamespace#PACKAGE_NAMESPACE package} namespace.
+ * {@link PackageNamespace#PACKAGE_NAMESPACE package} namespace with a
+ * {@link Namespace#REQUIREMENT_RESOLUTION_DIRECTIVE resolution} of type
+ * {@link PackageNamespace#RESOLUTION_DYNAMIC dynamic}.
* <p>
* The resolve context is not asked for
* {@link ResolveContext#getMandatoryResources() mandatory} resources or for

Back to the top