diff options
author | Stephan Herrmann | 2010-04-29 22:49:19 +0000 |
---|---|---|
committer | Stephan Herrmann | 2010-04-29 22:49:19 +0000 |
commit | 0fc937fce0dbdc096dcda6e953070eed07ef40e8 (patch) | |
tree | 43eb5bf7f9e9c24fef81319b41841acef2450f33 | |
parent | b388703b01e9f40fc321565f4790253699a5e10e (diff) | |
download | org.eclipse.objectteams-0fc937fce0dbdc096dcda6e953070eed07ef40e8.tar.gz org.eclipse.objectteams-0fc937fce0dbdc096dcda6e953070eed07ef40e8.tar.xz org.eclipse.objectteams-0fc937fce0dbdc096dcda6e953070eed07ef40e8.zip |
Fix for Bug 311109 - nested teams must be specified using their internal name with "$__OT__"
-rw-r--r-- | plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/otequinox/internal/MasterTeamLoader.java | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/otequinox/internal/MasterTeamLoader.java b/plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/otequinox/internal/MasterTeamLoader.java index 989a83bb0..b927046d9 100644 --- a/plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/otequinox/internal/MasterTeamLoader.java +++ b/plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/otequinox/internal/MasterTeamLoader.java @@ -109,7 +109,14 @@ public class MasterTeamLoader { { TransformerPlugin.getDefault().log(IStatus.OK, "reading attributes of team "+teamName); ClassLoader loader = (ClassLoader) ((BundleHost)aspectBundle).getLoaderProxy().getBundleLoader().createClassLoader(); - scanner.readOTAttributes(aspectBundle, teamName, loader); + while (teamName != null) { + try { + scanner.readOTAttributes(aspectBundle, teamName, loader); + break; + } catch (ClassNotFoundException e) { + teamName = nextTeamName(teamName); + } + } Collection<String> baseClassNames = scanner.getCollectedBaseClassNames(teamName); if (baseClassNames != null && !baseClassNames.isEmpty()) TransformerPlugin.getDefault().storeAdaptedBaseClassNames(this.aspectBundle.getSymbolicName(), teamName, baseClassNames); @@ -117,17 +124,39 @@ public class MasterTeamLoader { public boolean isAlreadyHandled() throws ClassNotFoundException { if (this.clazz == null) - this.clazz = this.aspectBundle.loadClass(this.teamName); + loadClass(); return allInstantiatedTeams.contains(this.clazz); } public Object newInstance() throws Exception { if (this.clazz == null) - this.clazz = this.aspectBundle.loadClass(this.teamName); + loadClass(); allInstantiatedTeams.add(this.clazz); // do this before accessing the constructor to avoid circularity (see Trac #257). Object newInstance = this.clazz.newInstance(); return newInstance; } + + private void loadClass() throws ClassNotFoundException { + String teamName = this.teamName; + while (teamName != null) { + try { + this.clazz = this.aspectBundle.loadClass(teamName); + return; + } catch (ClassNotFoundException ex) { + teamName = nextTeamName(teamName); + } + } + throw new ClassNotFoundException(this.teamName); + } + + private String nextTeamName(String teamName) { + int pos = teamName.lastIndexOf('.'); + if (pos < 0) + return null; + String prefix = teamName.substring(0, pos); + String postfix = teamName.substring(pos+1); + return prefix+"$__OT__"+postfix; + } public void markAsActivated() { allActivations.put(this.clazz, this.activation); |