Fup of Bug 352914 - Avoid unnecessary decapsulation accessors for callout to field
Some c-t-f now have no base method bindings, use field binding instead.
diff --git a/plugins/org.eclipse.objectteams.otdt.jdt.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.objectteams.otdt.jdt.ui/META-INF/MANIFEST.MF
index 00c2c40..ffd3cc9 100644
--- a/plugins/org.eclipse.objectteams.otdt.jdt.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.objectteams.otdt.jdt.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.objectteams.otdt.jdt.ui;singleton:=true
-Bundle-Version: 2.0.0.qualifier
+Bundle-Version: 2.0.1.qualifier
 Require-Bundle: org.eclipse.jdt.ui;bundle-version="[3.7.0,4.0.0)",
  org.eclipse.core.runtime;bundle-version="[3.7.0,4.0.0)",
  org.eclipse.core.resources;bundle-version="[3.7.0,4.0.0)",
diff --git a/plugins/org.eclipse.objectteams.otdt.jdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/text/correction/MappingProposalSubProcessor.java b/plugins/org.eclipse.objectteams.otdt.jdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/text/correction/MappingProposalSubProcessor.java
index 45569db..131dcfb 100644
--- a/plugins/org.eclipse.objectteams.otdt.jdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/text/correction/MappingProposalSubProcessor.java
+++ b/plugins/org.eclipse.objectteams.otdt.jdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/text/correction/MappingProposalSubProcessor.java
@@ -38,6 +38,7 @@
 import org.eclipse.jdt.core.dom.IMethodBinding;
 import org.eclipse.jdt.core.dom.IMethodMappingBinding;
 import org.eclipse.jdt.core.dom.ITypeBinding;
+import org.eclipse.jdt.core.dom.IVariableBinding;
 import org.eclipse.jdt.core.dom.MethodDeclaration;
 import org.eclipse.jdt.core.dom.MethodInvocation;
 import org.eclipse.jdt.core.dom.MethodSpec;
@@ -343,7 +344,8 @@
 	{
 		CalloutMappingDeclaration callout = ast.newCalloutMappingDeclaration();
 		String[] argNames = mapping.getBaseArgumentNames(); // possibly adjusted for fieldset
-		IMethodBinding baseMethod = mapping.getBaseMethods()[0];
+		IMethodBinding[] baseMethods = mapping.getBaseMethods();
+		IMethodBinding baseMethod = baseMethods.length > 0 ? baseMethods[0] : null;
 		switch (kind) {
 		case INTERFACE:
 		case SELFCALL:
@@ -352,10 +354,18 @@
 			break;
 		case FIELDSET:
 			{
-				String baseMethodName = baseMethod.getName();
-				int pos= baseMethodName.lastIndexOf('$');
-				String fieldName= baseMethodName.substring(pos+1);
-				ITypeBinding fieldType= baseMethod.getParameterTypes()[1];
+				String fieldName;
+				ITypeBinding fieldType;
+				if (baseMethod != null) {
+					String baseMethodName = baseMethod.getName();
+					int pos= baseMethodName.lastIndexOf('$');
+					fieldName= baseMethodName.substring(pos+1);
+					fieldType= baseMethod.getParameterTypes()[1];
+				} else {
+					IVariableBinding baseField = mapping.getBaseField();
+					fieldName= baseField.getName();
+					fieldType= baseField.getType();
+				}
 				callout.setBaseMappingElement(createFieldSpec(ast, imports, fieldName, fieldType));
 				callout.bindingOperator().setBindingModifier(Modifier.OT_SET_CALLOUT);
 				argNames= new String[] { fieldName };
@@ -363,10 +373,18 @@
 			}
 		case FIELDGET:
 			{
-				String baseMethodName = baseMethod.getName();
-				int pos= baseMethodName.lastIndexOf('$');
-				String fieldName= baseMethodName.substring(pos+1);
-				ITypeBinding fieldType= baseMethod.getReturnType();
+				String fieldName;
+				ITypeBinding fieldType;
+				if (baseMethod != null) {
+					String baseMethodName = baseMethod.getName();
+					int pos= baseMethodName.lastIndexOf('$');
+					fieldName= baseMethodName.substring(pos+1);
+					fieldType= baseMethod.getReturnType();
+				} else {
+					IVariableBinding baseField = mapping.getBaseField();
+					fieldName= baseField.getName();
+					fieldType= baseField.getType();
+				}
 				callout.setBaseMappingElement(createFieldSpec(ast, imports, fieldName, fieldType));
 				callout.bindingOperator().setBindingModifier(Modifier.OT_GET_CALLOUT);
 				break;