clarifications re https://bugs.eclipse.org/311503 "hasRole(Object, class) getRole(Object, class) by (Sub-)type"
- updated source and OTJLD
diff --git a/othersrc/OTRE/src/org/objectteams/ITeam.java b/othersrc/OTRE/src/org/objectteams/ITeam.java
index 84b1cd0..b77c5f0 100644
--- a/othersrc/OTRE/src/org/objectteams/ITeam.java
+++ b/othersrc/OTRE/src/org/objectteams/ITeam.java
@@ -94,12 +94,12 @@
*
* @param aBase any object, i.e., no checks are performed whether the base object's
* class is bound by any role class in this team.
- * @param roleClass Class instance specifying the required role type.
- * If this does not specify an existing role class an IllegalArgumentException will be thrown.
+ * @param roleType Class instance specifying the required role type.
* TODO (SH): is it legal to pass an unbound role class?
+ * @throws IllegalArgumentException if <code>roleType</code> does not represent a member type of this team.
* @return
*/
- public abstract boolean hasRole(Object aBase, Class<?> roleType);
+ public abstract boolean hasRole(Object aBase, Class<?> roleType) throws IllegalArgumentException;
/**
* Retrieve a role for a given base object.
@@ -116,11 +116,11 @@
*
* @param aBase any object, i.e., no checks are performed whether the base object's
* class is bound by any role class in this team.
- * @param roleClass Class instance specifying the required role type.
- * If this does not specify an existing role class an IllegalArgumentException will be thrown.
+ * @param roleType Class instance specifying the required role type.
* @return
+ * @throws IllegalArgumentException if <code>roleType</code> does not represent a member type of this team.
*/
- public abstract <T> T getRole(Object aBase, Class<T> roleType);
+ public abstract <T> T getRole(Object aBase, Class<T> roleType) throws IllegalArgumentException;
/**
* Retrieve all bound roles registered in the current team.
@@ -147,8 +147,9 @@
*
* @param roleType must be a top-most bound role of this team.
* @return a non-null array.
+ * @throws IllegalArgumentException if <code>roleType</code> does not represent a member type of this team.
*/
- public abstract <T> T[] getAllRoles(Class<T> roleType);
+ public abstract <T> T[] getAllRoles(Class<T> roleType) throws IllegalArgumentException;
/**
* Query whether any role instance of this team instance is currently executing a
@@ -171,8 +172,9 @@
*
* @param aRole
* @param roleType
+ * @throws IllegalArgumentException if <code>roleType</code> does not represent a member type of this team.
*/
- public abstract void unregisterRole(Object aRole, Class<?> roleType);
+ public abstract void unregisterRole(Object aRole, Class<?> roleType) throws IllegalArgumentException;
/**
* Not API.
diff --git a/othersrc/OTRE/src/org/objectteams/Team.java b/othersrc/OTRE/src/org/objectteams/Team.java
index 1968c99..fe0a514 100644
--- a/othersrc/OTRE/src/org/objectteams/Team.java
+++ b/othersrc/OTRE/src/org/objectteams/Team.java
@@ -414,7 +414,7 @@
/**
* {@inheritDoc}
*/
- public boolean hasRole(Object aBase, Class<?> roleType) {
+ public boolean hasRole(Object aBase, Class<?> roleType) throws IllegalArgumentException {
// overriding method to be generated by the compiler for each team with bound roles.
throw new IllegalArgumentException("No such bound role type in this team: "+roleType.getName());
}
@@ -430,7 +430,7 @@
/**
* {@inheritDoc}
*/
- public <T> T getRole(Object aBase, Class<T> roleType) {
+ public <T> T getRole(Object aBase, Class<T> roleType) throws IllegalArgumentException {
// overriding method to be generated by the compiler for each team with bound roles.
return null;
}
@@ -446,7 +446,7 @@
/**
* {@inheritDoc}
*/
- public <T> T[] getAllRoles(Class<T> roleType) {
+ public <T> T[] getAllRoles(Class<T> roleType) throws IllegalArgumentException {
// overriding method to be generated by the compiler for each team with bound roles.
throw new IllegalArgumentException("Class org.objectteams.Team has no bound roles.");
}
@@ -480,7 +480,7 @@
/**
* {@inheritDoc}
*/
- public void unregisterRole(Object aRole, Class<?> roleType) {
+ public void unregisterRole(Object aRole, Class<?> roleType) throws IllegalArgumentException {
// overriding method to be generated by the compiler for each team with bound roles.
}