Bug 481060: [otdre] Example wizard does nothing on "Next"
Bug 483954: [otdre] OT/Equinox does not weave in base-super class
StandardJavaElementContentProvider
diff --git a/plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/internal/osgi/weaving/AspectBinding.java b/plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/internal/osgi/weaving/AspectBinding.java
index f29b888..3f35a46 100644
--- a/plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/internal/osgi/weaving/AspectBinding.java
+++ b/plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/internal/osgi/weaving/AspectBinding.java
@@ -1,7 +1,7 @@
 /**********************************************************************
  * This file is part of "Object Teams Development Tooling"-Software
  * 
- * Copyright 2009, 2014 Germany and Technical University Berlin, Germany and others.
+ * Copyright 2009, 2015 Germany and Technical University Berlin, Germany and others.
  * 
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
@@ -327,8 +327,9 @@
 	/**
 	 * Read OT attributes of all teams in this aspectBinding 
 	 * and collect affected base classes into the teamBindings.
+	 * @return the names of all base classes bound via this aspect binding
 	 */
-	public synchronized void scanTeamClasses(Bundle bundle, DelegatingTransformer transformer) {
+	public synchronized Collection<String> scanTeamClasses(Bundle bundle, DelegatingTransformer transformer) {
 		long time = 0;
 		if (Util.PROFILE) time= System.nanoTime();
 		ClassScanner scanner = new ClassScanner();
@@ -356,6 +357,7 @@
 		}
 		this.hasScannedTeams = true;
 		if (Util.PROFILE) Util.profile(time, ProfileKind.Scan, bundle.getSymbolicName());
+		return this.allBaseClassNames;
 	}
 
 	private List<TeamBinding> getAllTeamBindings() {
diff --git a/plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/internal/osgi/weaving/AspectBindingRegistry.java b/plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/internal/osgi/weaving/AspectBindingRegistry.java
index a5639cc..f55c11d 100644
--- a/plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/internal/osgi/weaving/AspectBindingRegistry.java
+++ b/plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/internal/osgi/weaving/AspectBindingRegistry.java
@@ -1,7 +1,7 @@
 /**********************************************************************
  * This file is part of "Object Teams Development Tooling"-Software
  * 
- * Copyright 2008, 2014 Technical University Berlin, Germany and others.
+ * Copyright 2008, 2015 Technical University Berlin, Germany and others.
  *  
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
@@ -29,6 +29,7 @@
 import static org.eclipse.objectteams.otequinox.TransformerPlugin.log;
 
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -70,6 +71,8 @@
 
 	private Set<String> selfAdaptingAspects= new HashSet<String>(); // TODO, never read / evaluated
 	
+	private Set<String> allAllBoundBaseClasses = new HashSet<>(1024);
+
 	public static boolean IS_OTDT = false;
 	
 	public boolean isOTDT() {
@@ -252,6 +255,16 @@
 		return list != null && !list.isEmpty();
 	}
 
+	/** Does className denote a class to which a role is bound via any aspectBinding? */
+	public boolean isBoundBaseClass(String className) {
+		return this.allAllBoundBaseClasses.contains(className);
+	}
+
+	/** Record the given class names as bound base classes. */
+	public void addBoundBaseClasses(Collection<String> boundBaseclassNames) {
+		this.allAllBoundBaseClasses.addAll(boundBaseclassNames);
+	}
+
 	/**
 	 * Get the list of aspect bindings affecting the given base plugin.
 	 */
diff --git a/plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/internal/osgi/weaving/BaseBundleLoadTrigger.java b/plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/internal/osgi/weaving/BaseBundleLoadTrigger.java
index c768ee1..c14dbed 100644
--- a/plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/internal/osgi/weaving/BaseBundleLoadTrigger.java
+++ b/plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/internal/osgi/weaving/BaseBundleLoadTrigger.java
@@ -18,6 +18,7 @@
 import static org.eclipse.objectteams.otequinox.TransformerPlugin.log;
 
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.List;
 import java.util.Set;
 
@@ -98,9 +99,10 @@
 					assert aspectBundle != null : "Package admin should not return a null array element";
 				}
 				// (2) scan all teams in affecting aspect bindings:
-				if (!aspectBinding.hasScannedTeams)
-					aspectBinding.scanTeamClasses(aspectBundle, DelegatingTransformer.newTransformer(useDynamicWeaver, hook, baseClass.getBundleWiring()));
-					// TODO: record adapted base classes?
+				if (!aspectBinding.hasScannedTeams) {
+					Collection<String> boundBases = aspectBinding.scanTeamClasses(aspectBundle, DelegatingTransformer.newTransformer(useDynamicWeaver, hook, baseClass.getBundleWiring()));
+					aspectBindingRegistry.addBoundBaseClasses(boundBases);
+				}
 				
 				// (3) add dependencies to the base bundle:
 				if (!useDynamicWeaver) // OTDRE access aspects by generic interface in o.o.Team
diff --git a/plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/internal/osgi/weaving/DelegatingTransformer.java b/plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/internal/osgi/weaving/DelegatingTransformer.java
index 50c50e4..97077e7 100644
--- a/plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/internal/osgi/weaving/DelegatingTransformer.java
+++ b/plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/internal/osgi/weaving/DelegatingTransformer.java
@@ -134,7 +134,7 @@
 		return new IWeavingContext() {
 			@Override
 			public boolean isWeavable(String className) {
-				return hook.requiresWeaving(bundleWiring, className, null) != WeavingReason.None;
+				return className != null && hook.requiresWeaving(bundleWiring, className, null) != WeavingReason.None;
 			}
 			
 			@Override
diff --git a/plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/internal/osgi/weaving/OTWeavingHook.java b/plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/internal/osgi/weaving/OTWeavingHook.java
index 25e836d..2e8ec3d 100644
--- a/plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/internal/osgi/weaving/OTWeavingHook.java
+++ b/plugins/org.eclipse.objectteams.otequinox/src/org/eclipse/objectteams/internal/osgi/weaving/OTWeavingHook.java
@@ -306,7 +306,7 @@
 		return false;
 	}
 
-	WeavingReason requiresWeaving(BundleWiring bundleWiring, String className, byte[] bytes) {
+	WeavingReason requiresWeaving(BundleWiring bundleWiring, @NonNull String className, byte[] bytes) {
 		
 		// 1. consult the aspect binding registry (for per-bundle info):
 		@SuppressWarnings("null")@NonNull // FIXME: org.eclipse.osgi.internal.resolver.BundleDescriptionImpl.getBundle() can return null!
@@ -314,6 +314,8 @@
 		if (aspectBindingRegistry.getAdaptedBasePlugins(bundle) != null)
 			return WeavingReason.Aspect;
 
+		if (aspectBindingRegistry.isBoundBaseClass(className))
+			return WeavingReason.Base;
 		List<AspectBinding> aspectBindings = aspectBindingRegistry.getAdaptingAspectBindings(bundle.getSymbolicName());
 		if (aspectBindings != null && !aspectBindings.isEmpty()) {
 			// potential base class: look deeper:
@@ -387,6 +389,7 @@
 	private void recordBaseClasses(DelegatingTransformer transformer, @NonNull String aspectBundle, String className) {
 		Collection<String> adaptedBases = transformer.fetchAdaptedBases();
 		if (adaptedBases == null || adaptedBases.isEmpty()) return;
+		aspectBindingRegistry.addBoundBaseClasses(adaptedBases);
 		List<AspectBinding> aspectBindings = aspectBindingRegistry.getAspectBindings(aspectBundle);
 		if (aspectBindings != null)
 			for (AspectBinding aspectBinding : aspectBindings)