Bug 443453 - Some robustness of the new OT/Equinox with OTDRE
- handle ClassCircularityError during team instantiation
diff --git a/plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/internal/osgi/weaving/TeamLoader.java b/plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/internal/osgi/weaving/TeamLoader.java
index 404c252..d5d1a13 100644
--- a/plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/internal/osgi/weaving/TeamLoader.java
+++ b/plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/internal/osgi/weaving/TeamLoader.java
@@ -215,7 +215,7 @@
 					break;
 				}
 				if (Util.PROFILE) Util.profile(time, ProfileKind.Activation, teamName);
-			} catch (NoClassDefFoundError e) {
+			} catch (NoClassDefFoundError|ClassCircularityError e) {
 				try { // clean up:
 					switch (activationKind) {
 					case ALL_THREADS: instance.deactivate(Team.ALL_THREADS); break;
@@ -235,6 +235,14 @@
 				log(t, "Failed to activate team "+teamName);
 			}
 			return instance;
+		} catch (ClassCircularityError e) {
+			for (TeamBinding eq : team.equivalenceSet)
+				eq.isActivated = false;
+			@SuppressWarnings("null") @NonNull // known API
+			String notFoundName = e.getMessage().replace('/', '.');
+			synchronized (this.deferredTeams) {
+				this.deferredTeams.add(new WaitingTeamRecord(team, activationKind, notFoundName));
+			}
 		} catch (Throwable e) {
 			// application error during constructor execution?
 			log(e, "Failed to instantiate team "+teamName);