Bug 498925: NullPointerException in Config.delegateGetMethodBodies
- another bugfix: don't overwrite valid bundledCompleteTypeBindings
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/control/Config.java b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/control/Config.java
index 6d12aef..0dc262c 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/control/Config.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/control/Config.java
@@ -282,18 +282,23 @@
 	
 	static Config getOrCreateMatchingConfig(Object client, Parser parser, LookupEnvironment environment) {
 		Config config = safeGetConfig();
+		Boolean bundledCompleteBindings = null;
 		if (configMatchesRequest(config, client, parser, environment)) {
 			parser = config.parser;
 			environment = config.lookupEnvironment;
+			bundledCompleteBindings = config.bundledCompleteTypeBindings;
 		}
 		if (parser == null || environment == null) {
 			config = configsByClient.get(client);
 			if (configMatchesRequest(config, client, parser, environment)) {
 				parser = config.parser;
 				environment = config.lookupEnvironment;
+				bundledCompleteBindings = config.bundledCompleteTypeBindings;
 			}
 		}
 		config = new Config(client, parser, environment);
+		if (bundledCompleteBindings != null)
+			config.bundledCompleteTypeBindings = bundledCompleteBindings;
 		configsByClient.put(client, config);
 		addConfig(config);
 		return config;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/control/Dependencies.java b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/control/Dependencies.java
index 8a6fefb..965d67b 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/control/Dependencies.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/control/Dependencies.java
@@ -125,7 +125,7 @@
 			boolean           analyzeCode,
 			boolean           generateCode,
 			boolean           buildFieldsAndMethods,
-			boolean           bundledCompleteTypeBindings,
+			Boolean           bundledCompleteTypeBindings,
 			boolean           strictDiet)
     {
     	Config config = Config.getOrCreateMatchingConfig(client, parser, environment);
@@ -133,7 +133,8 @@
     	config.analyzeCode = analyzeCode;
     	config.generateCode = generateCode;
     	config.buildFieldsAndMethods = buildFieldsAndMethods;
-    	config.bundledCompleteTypeBindings = bundledCompleteTypeBindings;
+    	if (bundledCompleteTypeBindings != null)
+    		config.bundledCompleteTypeBindings = bundledCompleteTypeBindings;
     	config.strictDiet = strictDiet;
 
     	// Debugging
@@ -159,7 +160,7 @@
 			boolean           strictDiet)
     {
     	return Dependencies.setup(client, parser, lookupEnvironment, true, true, true,
-    			buildFieldsAndMethods, false, strictDiet);
+    			buildFieldsAndMethods, null, strictDiet);
     }
 
     /**
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/model/org/eclipse/objectteams/otdt/tests/otmodel/OTReconcilerTests.java b/testplugins/org.eclipse.objectteams.otdt.tests/model/org/eclipse/objectteams/otdt/tests/otmodel/OTReconcilerTests.java
index 885cda2..be0159d 100644
--- a/testplugins/org.eclipse.objectteams.otdt.tests/model/org/eclipse/objectteams/otdt/tests/otmodel/OTReconcilerTests.java
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/model/org/eclipse/objectteams/otdt/tests/otmodel/OTReconcilerTests.java
@@ -1524,12 +1524,12 @@
 				"2. ERROR in /P/SubTeam.java (at line 1)\n" + 
 				"	public team class SubTeam extends SuperTeam {\n" + 
 				"	                  ^^^^^^^\n" + 
-				"Team introduces binding ambiguity for role R0<@tthis[SubTeam]>, which may break clients of the super team (OTJLD 2.3.5(d)).\n" + 
+				"Team introduces binding ambiguity for role R1<@tthis[SubTeam]>, which may break clients of the super team (OTJLD 2.3.5(d)).\n" + 
 				"----------\n" + 
 				"3. ERROR in /P/SubTeam.java (at line 1)\n" + 
 				"	public team class SubTeam extends SuperTeam {\n" + 
 				"	                  ^^^^^^^\n" + 
-				"Team introduces binding ambiguity for role R1<@tthis[SubTeam]>, which may break clients of the super team (OTJLD 2.3.5(d)).\n" + 
+				"Team introduces binding ambiguity for role R0<@tthis[SubTeam]>, which may break clients of the super team (OTJLD 2.3.5(d)).\n" + 
 				"----------\n");
     	} finally {
     		deleteProject("P");