Bug 411591 - [hierarchy] HierarchyResolver.resolve may skip essential
steps
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java
index a851b6e..d97eed5 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java
@@ -748,7 +748,7 @@
 	/**
 	 * build Callin and Callout
 	 */
-	private void buildCallinCallouts() {
+	public void buildCallinCallouts() {
 		if (this.referenceContext.callinCallouts == null) {
 			this.referenceContext.binding.callinCallouts = Binding.NO_CALLIN_CALLOUT_BINDINGS;
 			return;
@@ -761,6 +761,9 @@
 			return;
 		}
 
+		if (this.referenceContext.binding.callinCallouts != null)
+			return; // already done
+
 		// iterate the binding declarations to create the bindings
 		AbstractMethodMappingDeclaration[] callinCallouts = this.referenceContext.callinCallouts;
 		int size = callinCallouts.length;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/mappings/MethodMappingResolver.java b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/mappings/MethodMappingResolver.java
index 163b403..7ecaf82 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/mappings/MethodMappingResolver.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/mappings/MethodMappingResolver.java
@@ -80,6 +80,9 @@
 			return true;
 		}
 
+		// just in case this step was skipped when doing STATE_LENV_DONE_FIELDS_AND_METHODS:
+		this._roleScope.buildCallinCallouts();
+
 		boolean result = true;
 		for (int idx = 0; idx < methodMappings.length; idx++)
 		{
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/statemachine/transformer/StandardElementGenerator.java b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/statemachine/transformer/StandardElementGenerator.java
index 0e14a2c..3644ebc 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/statemachine/transformer/StandardElementGenerator.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/statemachine/transformer/StandardElementGenerator.java
@@ -621,7 +621,7 @@
 											   null);
 		boolean hasTypeProblem = baseclass instanceof MissingTypeBinding;
 		AstEdit.addField(roleType, baseField, createBinding, hasTypeProblem, false);
-		if (hasTypeProblem) {
+		if (hasTypeProblem && createBinding) {
 			// faked resolving for missing type
 			baseField.binding.type= baseclass;
 			baseField.binding.modifiers &= ~ExtraCompilerModifiers.AccUnresolved;