Bug 397182 - Prepare OTDT for new (dynamic) weaver
OTREDyn:
- more complete handling of OTSpecialAccessAttribute
- consolidate handling of accessId for OTDyn
diff --git a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/AbstractBoundClass.java b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/AbstractBoundClass.java
index ff292ad..69b20bb 100644
--- a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/AbstractBoundClass.java
+++ b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/AbstractBoundClass.java
@@ -1,7 +1,7 @@
 /**********************************************************************
  * This file is part of "Object Teams Dynamic Runtime Environment"
  * 
- * Copyright 2009, 2012 Oliver Frank and others.
+ * Copyright 2009, 2014 Oliver Frank and others.
  * 
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
@@ -663,7 +663,7 @@
 				prepareForFirstMemberAccess();
 				Field field = getField(task.getMemberName(), task
 						.getMemberSignature());
-				weaveFieldAccess(field, field.getId(this));
+				weaveFieldAccess(field, field.getGlobalId(this));
 				if (!field.isStatic()) {
 					// If the field is not static it could be accessed through a subclass
 					// so weave the subclass
@@ -680,7 +680,7 @@
 				prepareForFirstMemberAccess();
 				Method method = getMethod(task.getMemberName(), task.getMemberSignature(),
 										  task.isHandleCovariantReturn());
-				weaveMethodAccess(method, method.getId(this));
+				weaveMethodAccess(method, method.getGlobalId(this));
 				if (!method.isStatic()) {
 					// If the method is not static it could be accessed through a subclass
 					// so weave the subclass
@@ -874,7 +874,7 @@
 								  false/*covariantReturn*/);
 		int joinpointId = TeamManager
 				.getJoinpointId(getMethodIdentifier(method));
-		int boundMethodId = method.getId(this);
+		int boundMethodId = method.getGlobalId(this);
 
 		moveCodeToCallOrig(method, boundMethodId);
 		createDispatchCodeInOrgMethod(method, joinpointId, boundMethodId);
@@ -891,7 +891,7 @@
 								  task.isHandleCovariantReturn());
 		int joinpointId = TeamManager
 				.getJoinpointId(getMethodIdentifier(method));
-		int boundMethodId = method.getId(this);
+		int boundMethodId = method.getGlobalId(this);
 		if (task.doAllTransformations()) {
 			createDispatchCodeInCallAllBindings(joinpointId, boundMethodId);
 			// TODO(SH): instead of iterating superclasses fetch it from the Binding
@@ -927,7 +927,7 @@
 		prepareForFirstTransformation();
 		Method method = getMethod(task.getMemberName(), task.getMemberSignature(),
 				                  task.isHandleCovariantReturn());
-		int boundMethodId = method.getId(this);
+		int boundMethodId = method.getGlobalId(this);
 		if (task.doAllTransformations()) {
 			createSuperCallInCallOrig(boundMethodId);
 		}		
@@ -944,7 +944,7 @@
 								  task.isHandleCovariantReturn());
 		int joinpointId = TeamManager
 				.getJoinpointId(getMethodIdentifier(method));
-		int boundMethodId = method.getId(this);
+		int boundMethodId = method.getGlobalId(this);
 		if (task.doAllTransformations()) {
 			moveCodeToCallOrig(method, boundMethodId);
 			createDispatchCodeInCallAllBindings(joinpointId, boundMethodId);
@@ -963,7 +963,7 @@
 		prepareForFirstTransformation();
 		Method method = getMethod(task.getMemberName(), task.getMemberSignature(),
 								  task.isHandleCovariantReturn());
-		int boundMethodId = method.getId(this);
+		int boundMethodId = method.getGlobalId(this);
 		moveCodeToCallOrig(method, boundMethodId);
 		createCallAllBindingsCallInOrgMethod(method, boundMethodId, false);
 
diff --git a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/AbstractTeam.java b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/AbstractTeam.java
index 31504ca..fd6a495 100644
--- a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/AbstractTeam.java
+++ b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/AbstractTeam.java
@@ -1,7 +1,7 @@
 /**********************************************************************

  * This file is part of "Object Teams Dynamic Runtime Environment"

  * 

- * Copyright 2009, 2012 Oliver Frank and others.

+ * Copyright 2009, 2014 Oliver Frank and others.

  * 

  * All rights reserved. This program and the accompanying materials

  * are made available under the terms of the Eclipse Public License v1.0

@@ -32,6 +32,9 @@
 	 * based on {@link Binding#compareTo(Binding)} (see there).

 	 */

 	private Set<Binding> bindings;

+	/**

+	 * The highest perTeamAccessId that has been read from an OTSpecialAccess attribute

+	 */

 	private int highestAccessId;

 

 	protected AbstractTeam(String name, String id, ClassLoader loader) {

diff --git a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/Binding.java b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/Binding.java
index 852e176..4f9e6d7 100644
--- a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/Binding.java
+++ b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/Binding.java
@@ -1,7 +1,7 @@
 /**********************************************************************

  * This file is part of "Object Teams Dynamic Runtime Environment"

  * 

- * Copyright 2009, 2012 Oliver Frank and others.

+ * Copyright 2009, 2014 Oliver Frank and others.

  * 

  * All rights reserved. This program and the accompanying materials

  * are made available under the terms of the Eclipse Public License v1.0

@@ -38,7 +38,12 @@
 	private String memberSignature;

 	private String declaringBaseClassName;

 	private int callinModifier;

-	private int callinId;

+	/**

+	 * Locally unique id for (an element in) this binding:

+	 * For CALLIN_BINDING this is the callinId,

+	 * for METHOD_ACCESS or FIELD_ACCESS it is the perTeamAccessId

+	 */

+	private int perTeamId;

 	private IBinding.BindingType type;

 	private boolean isHandleCovariantReturn;

 	

@@ -61,7 +66,7 @@
 		this.memberSignature = memberSignature;

 		this.declaringBaseClassName = declaringBaseClassName;

 		this.callinModifier = callinModifier;

-		this.callinId = callinId;

+		this.perTeamId = callinId;

 		this.type = IBinding.BindingType.CALLIN_BINDING;

 		this.isHandleCovariantReturn = handleCovariantReturn;

 	}

@@ -71,13 +76,13 @@
 	 */

 	public Binding(AbstractBoundClass teamClass,

 			String boundClassName, 

-			String memberName, String memberSignature, int callinId, IBinding.BindingType type) 

+			String memberName, String memberSignature, int perTeamAccessId, IBinding.BindingType type) 

 	{

 		this.teamClass = teamClass;

 		this.boundClass = boundClassName;

 		this.memberName = memberName;

 		this.memberSignature = memberSignature;

-		this.callinId = callinId;

+		this.perTeamId = perTeamAccessId;

 		this.type = type;

 	}

 

@@ -93,8 +98,8 @@
 		return memberSignature;

 	}

 

-	public int getCallinId() {

-		return callinId;

+	public int getPerTeamId() {

+		return perTeamId;

 	}

 

 	public boolean isHandleCovariantReturn() {

@@ -111,7 +116,7 @@
 		return boundClass.equals(other.boundClass)

 				&& memberName.equals(other.memberName)

 				&& memberSignature.equals(other.memberSignature)

-				&& type == other.type && callinId == other.callinId;

+				&& type == other.type && perTeamId == other.perTeamId;

 	}

 	

 	public int compareTo(Binding other) {

@@ -154,7 +159,7 @@
 		case FIELD_ACCESS: buf.append("callout-to-field: ");break;

 		}

 		buf.append('{');

-		buf.append(this.callinId);

+		buf.append(this.perTeamId);

 		buf.append("} ");

 		buf.append(this.boundClass);

 		buf.append('.');

diff --git a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/Field.java b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/Field.java
index 617d209..47eb542 100644
--- a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/Field.java
+++ b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/Field.java
@@ -1,7 +1,7 @@
 /**********************************************************************

  * This file is part of "Object Teams Dynamic Runtime Environment"

  * 

- * Copyright 2009, 2012 Oliver Frank and others.

+ * Copyright 2009, 2014 Oliver Frank and others.

  * 

  * All rights reserved. This program and the accompanying materials

  * are made available under the terms of the Eclipse Public License v1.0

@@ -38,7 +38,7 @@
 	 * @return 

 	 */

 	@Override

-	public int getId(IBoundClass clazz) {

+	public int getGlobalId(IBoundClass clazz) {

 		String key = null;

 		key = clazz.getId() + getName() + getSignature();

 		return getId(key);

diff --git a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/Member.java b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/Member.java
index a017daf..f6e1a8e 100644
--- a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/Member.java
+++ b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/Member.java
@@ -1,7 +1,7 @@
 /**********************************************************************

  * This file is part of "Object Teams Dynamic Runtime Environment"

  * 

- * Copyright 2009, 2012 Oliver Frank and others.

+ * Copyright 2009, 2014 Oliver Frank and others.

  * 

  * All rights reserved. This program and the accompanying materials

  * are made available under the terms of the Eclipse Public License v1.0

@@ -30,7 +30,8 @@
  * @author Oliver Frank

  */

 public abstract class Member implements IMember {

-	

+

+	/** Map of globally unique Ids by keys that are constructed from the resolved target member. */

 	private static Map<String, Integer> idMap = new HashMap<String, Integer>();

 	private static int currentId = 0;

 	

@@ -91,5 +92,5 @@
 		return id;

 	}

 	

-	public abstract int getId(IBoundClass clazz);

+	public abstract int getGlobalId(IBoundClass clazz);

 }

diff --git a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/Method.java b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/Method.java
index b988f51..37aa887 100644
--- a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/Method.java
+++ b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/Method.java
@@ -1,7 +1,7 @@
 /**********************************************************************
  * This file is part of "Object Teams Dynamic Runtime Environment"
  * 
- * Copyright 2009, 2012 Oliver Frank and others.
+ * Copyright 2009, 2014 Oliver Frank and others.
  * 
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
@@ -46,14 +46,14 @@
 	/**
 	 * Returns a globally unique id for the method
 	 * @param clazz
-	 * @return 
+	 * @return the ID
 	 */
 	@Override
-	public int getId(IBoundClass clazz) {
+	public int getGlobalId(IBoundClass clazz) {
 		String key = null;
 		// special treatment of private conflicts with test415_nonexistingBaseMethod3i
 		// see also AbstractBoundClass.handleTaskList()
-		if (/*isPrivate() ||*/ isStatic()) {
+		if (/*isPrivate() ||*/ isStatic() || "<init>".equals(getName())) { // also no dynamic binding for constructors
 			key = clazz.getId() + getName() + getSignature();
 		} else {
 			key = getName() + getSignature();
diff --git a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/Attributes.java b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/Attributes.java
index e53a3f7..978b494 100644
--- a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/Attributes.java
+++ b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/Attributes.java
@@ -231,25 +231,25 @@
 			String accessMode;

 			boolean isStatic;

 			String baseclass, name, desc;

-			public int accessId;

+			public int perTeamAccessId;

 			public DecapsField(String baseclass, String name, String desc, int accessId, String accessMode, boolean isStatic) {

 				this.baseclass = baseclass;

 				this.name = name;

 				this.desc = desc;

-				this.accessId = accessId;

+				this.perTeamAccessId = accessId;

 				this.accessMode = accessMode;

 				this.isStatic = isStatic;

 			}

 		}

 		class DecapsMethod {

 			String baseclass, name, desc;

-			int id;

+			int perTeamAccessId;

 			boolean isStatic;

 			DecapsMethod(String baseclass, String name, String desc, int id, boolean isStatic) {

 				this.baseclass = baseclass;

 				this.name = name;

 				this.desc = desc;

-				this.id = id;

+				this.perTeamAccessId = id;

 				this.isStatic = isStatic;

 			}

 		}

@@ -277,7 +277,7 @@
 					attr.readMethodAccess(cr, off, buf);	off+=8;

 					break;

 				case CALLOUT_FIELD_ACCESS:

-					attr.readFieldAccess(cr, off, buf); 	off+=8;

+					attr.readFieldAccess(cr, off, buf); 	off+=9;

 					break;

 				case SUPER_METHOD_ACCESS:

 					throw new IllegalStateException("Not yet handled: OTSpecialAccess for SUPER_METHOD_ACCESS");

@@ -300,7 +300,7 @@
 			String className   = cr.readUTF8(off, buf);

 			String encodedName = cr.readUTF8(off+2, buf);

 			String methodDesc  = cr.readUTF8(off+4, buf);

-			int id = cr.readUnsignedShort(off+6);

+			int accessId = cr.readUnsignedShort(off+6);

 			boolean isStatic = false;

 			String baseClass;

 			String methodName;

@@ -318,14 +318,14 @@
 				baseClass = encodedName.substring(0, pos);

 				methodName = encodedName.substring(pos+1);

 			}

-			this.methods.add(new DecapsMethod(baseClass, methodName, methodDesc, id, isStatic));

+			this.methods.add(new DecapsMethod(baseClass, methodName, methodDesc, accessId, isStatic));

 		}

 		private void readFieldAccess(ClassReader cr, int off, char[] buf) {

-			int accessId = cr.readByte(off);

-			int flags = cr.readByte(off+1);

-			String className   = cr.readUTF8(off+2, buf);

-			String fieldName = cr.readUTF8(off+4, buf);

-			String fieldDesc  = cr.readUTF8(off+6, buf);

+			int accessId = cr.readUnsignedShort(off);

+			int flags = cr.readByte(off+2);

+			String className   = cr.readUTF8(off+3, buf);

+			String fieldName = cr.readUTF8(off+5, buf);

+			String fieldDesc  = cr.readUTF8(off+7, buf);

 			boolean isStatic = (flags & 2) != 0;

 			String accessMode = (flags & 1) == 1 ? "set" : "get";

 			this.fields.add(new DecapsField(className, fieldName, fieldDesc, accessId, accessMode, isStatic));

@@ -341,8 +341,8 @@
 				AbstractBoundClass baseclass = repo.getBoundClass(dMethod.baseclass, dMethod.baseclass.replace('.', '/'), clazz.getClassLoader());

 				// register the target method:

 				baseclass.getMethod(dMethod.name, dMethod.desc, false/*covariantReturn*/, dMethod.isStatic);

-				clazz.recordAccessId(dMethod.id);

-				clazz.addBinding(new Binding(clazz, dMethod.baseclass, dMethod.name, dMethod.desc, dMethod.id, IBinding.BindingType.METHOD_ACCESS));

+				clazz.recordAccessId(dMethod.perTeamAccessId);

+				clazz.addBinding(new Binding(clazz, dMethod.baseclass, dMethod.name, dMethod.desc, dMethod.perTeamAccessId, IBinding.BindingType.METHOD_ACCESS));

 			}

 

 			for (DecapsField dField: this.fields) {

@@ -352,8 +352,8 @@
 				AbstractBoundClass baseclass = repo.getBoundClass(dField.baseclass, dField.baseclass.replace('.', '/'), clazz.getClassLoader());

 				// register the target field:

 				baseclass.getField(dField.name, dField.desc);

-				clazz.recordAccessId(dField.accessId);

-				clazz.addBinding(new Binding(clazz, dField.baseclass, dField.name, dField.desc, dField.accessId, IBinding.BindingType.FIELD_ACCESS));

+				clazz.recordAccessId(dField.perTeamAccessId);

+				clazz.addBinding(new Binding(clazz, dField.baseclass, dField.name, dField.desc, dField.perTeamAccessId, IBinding.BindingType.FIELD_ACCESS));

 			}

 		}

 	}

diff --git a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/runtime/IBinding.java b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/runtime/IBinding.java
index 13b02c4..096ad82 100644
--- a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/runtime/IBinding.java
+++ b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/runtime/IBinding.java
@@ -1,7 +1,7 @@
 /**********************************************************************
  * This file is part of "Object Teams Dynamic Runtime Environment"
  * 
- * Copyright 2011, 2012 GK Software AG and others.
+ * Copyright 2011, 2014 GK Software AG and others.
  * 
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
@@ -43,8 +43,8 @@
 	/** Signature (JVM encoding) of the bound base member. */
 	String getMemberSignature();
 
-	/** Answer the callin ID (also used for callout decapsulation bindings) */
-	int getCallinId();
+	/** Answer the ID (callinId or perTeamAccessId) */
+	int getPerTeamId();
 
 	/** Does base method matching include overrides with covariant return type?. */
 	boolean isHandleCovariantReturn();
diff --git a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/runtime/IMember.java b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/runtime/IMember.java
index d0cbd47..3cedc80 100644
--- a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/runtime/IMember.java
+++ b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/runtime/IMember.java
@@ -1,7 +1,7 @@
 /**********************************************************************
  * This file is part of "Object Teams Dynamic Runtime Environment"
  * 
- * Copyright 2011, 2012 GK Software AG and others.
+ * Copyright 2011, 2014 GK Software AG and others.
  * 
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
@@ -23,5 +23,5 @@
  */
 public interface IMember {
 
-	int getId(IBoundClass boundClass);
+	int getGlobalId(IBoundClass boundClass);
 }
diff --git a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/runtime/TeamManager.java b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/runtime/TeamManager.java
index cfab9fb..18045f6 100644
--- a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/runtime/TeamManager.java
+++ b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/runtime/TeamManager.java
@@ -1,7 +1,7 @@
 /**********************************************************************
  * This file is part of "Object Teams Dynamic Runtime Environment"
  * 
- * Copyright 2009, 2012 Oliver Frank and others.
+ * Copyright 2009, 2014 Oliver Frank and others.
  * 
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
@@ -44,6 +44,7 @@
 	private static List<List<ITeam>> _teams = new ArrayList<List<ITeam>>();
 	private static List<List<Integer>> _callinIds = new ArrayList<List<Integer>>();
 	private static Map<String, Integer> joinpointMap = new HashMap<String, Integer>();
+	// key: Team class, value: list of global memberIds, indexed by local accessId
 	private static Map<Class<?>, List<Integer>> accessIdMap = new HashMap<Class<?>, List<Integer>>();
 	private static int currentJoinpointId = 0;
 	// map all original joinpoints to their inherited versions in subclasses
@@ -102,7 +103,8 @@
 	 * @return
 	 */
 	public static int getMemberId(int accessId, Class<? extends ITeam> teamClass) {
-		return accessIdMap.get(teamClass).get(accessId);
+		Integer id = accessIdMap.get(teamClass).get(accessId);
+		return id;
 	}
 
 	/**
@@ -162,11 +164,11 @@
 				int joinpointId = getJoinpointId(boundClass
 						.getMethodIdentifier(method));
 				synchronized (method) {
-					changeTeamsForJoinpoint(t, binding.getCallinId(), joinpointId, stateChange);
+					changeTeamsForJoinpoint(t, binding.getPerTeamId(), joinpointId, stateChange);
 					List<Integer> subJoinpoints = joinpointToSubJoinpoints.get(joinpointId);
 					if (subJoinpoints != null)
 						for (Integer subJoinpoint : subJoinpoints)
-							changeTeamsForJoinpoint(t, binding.getCallinId(), subJoinpoint, stateChange);
+							changeTeamsForJoinpoint(t, binding.getPerTeamId(), subJoinpoint, stateChange);
 				}
 				boundClass.handleAddingOfBinding(binding); // TODO(SH): more lazy
 				break;
@@ -201,9 +203,9 @@
 					member = boundClass.getMethod(binding.getMemberName(), binding.getMemberSignature(), false/*covariantReturn*/);
 				}
 				
-				int memberId = member.getId(boundClass);
+				int memberId = member.getGlobalId(boundClass);
 				synchronized (member) {
-					addAccessIds(teamClass, teem, binding.getCallinId(), memberId);
+					addAccessIds(teamClass, teem, binding.getPerTeamId(), memberId);
 				}
 				boundClass.handleAddingOfBinding(binding);
 				break;
@@ -211,22 +213,23 @@
 		}
 	}
 	/**
-	 * Stores the access ids of a team and the corresponding member ids
-	 * @param t
+	 * Stores the access ids of a team and the corresponding member ids,
+	 * where accessId is local to the team and the member id is globally unique.
+	 * @param teamClass
 	 * @param teem
 	 * @param accessId
 	 * @param memberId
 	 * @param stateChange
 	 */
-	private static void addAccessIds(Class<? extends ITeam> clazz, IBoundTeam teem, int accessId, int memberId) {
-		List<Integer> accessIds = accessIdMap.get(clazz);
+	private static void addAccessIds(Class<? extends ITeam> teamClass, IBoundTeam teem, int accessId, int memberId) {
+		List<Integer> accessIds = accessIdMap.get(teamClass);
 		if (accessIds == null) {
 			int highestAccessId = teem.getHighestAccessId() + 1;
 			accessIds = new ArrayList<Integer>(highestAccessId);
 			for (int i = 0; i <= highestAccessId; i++) {
 				accessIds.add(0);
 			}
-			accessIdMap.put(clazz, accessIds);
+			accessIdMap.put(teamClass, accessIds);
 		}
 		accessIds.set(accessId, memberId);
 	}