Fix so that for new class() that if the name of the class and the
name of a field where the same, that it no longer resolves to
field instead of the type. We know that "class" is a type not a field
for class instance creation.
diff --git a/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/workbench/utility/ASTBoundResolver.java b/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/workbench/utility/ASTBoundResolver.java
index f49ff80..b92496d 100644
--- a/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/workbench/utility/ASTBoundResolver.java
+++ b/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/workbench/utility/ASTBoundResolver.java
@@ -10,7 +10,7 @@
  *******************************************************************************/
 /*
  *  $RCSfile: ASTBoundResolver.java,v $
- *  $Revision: 1.2 $  $Date: 2004/02/05 15:45:24 $ 
+ *  $Revision: 1.3 $  $Date: 2004/06/04 18:38:39 $ 
  */
 package org.eclipse.jem.workbench.utility;
 
@@ -21,6 +21,7 @@
 import org.eclipse.jem.internal.instantiation.*;
 import org.eclipse.jem.internal.instantiation.PTExpression;
 import org.eclipse.jem.internal.instantiation.PTName;
+import org.eclipse.jem.workbench.utility.ParseTreeCreationFromAST.InvalidExpressionException;
  
 /**
  * This works on resolved AST nodes. If the nodes had not been resolved, this will return noting.
@@ -77,6 +78,14 @@
 		return (binding != null) ? getTypeName(binding) : null; 
 	}
 	
+	/* (non-Javadoc)
+	 * @see org.eclipse.jem.workbench.utility.ParseTreeCreationFromAST.Resolver#resolveType(org.eclipse.jdt.core.dom.Name)
+	 */
+	public String resolveType(Name name) throws InvalidExpressionException {
+		ITypeBinding binding = name.resolveTypeBinding();
+		return (binding != null) ? getTypeName(binding) : null; 
+	}
+	
 	private String getTypeName(ITypeBinding typeBinding) {
 		StringBuffer name;
 		if (typeBinding.isArray()) {
@@ -99,6 +108,4 @@
 		}
 		return name.toString();
 	}
-	
-
 }
diff --git a/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/workbench/utility/ParseTreeCreationFromAST.java b/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/workbench/utility/ParseTreeCreationFromAST.java
index 01c1abc..eef9811 100644
--- a/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/workbench/utility/ParseTreeCreationFromAST.java
+++ b/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/workbench/utility/ParseTreeCreationFromAST.java
@@ -10,7 +10,7 @@
  *******************************************************************************/
 /*
  *  $RCSfile: ParseTreeCreationFromAST.java,v $
- *  $Revision: 1.7 $  $Date: 2004/06/02 20:02:54 $ 
+ *  $Revision: 1.8 $  $Date: 2004/06/04 18:38:39 $ 
  */
 package org.eclipse.jem.workbench.utility;
 
@@ -79,6 +79,19 @@
 		public abstract String resolveType(Type type) throws InvalidExpressionException;
 		
 		/**
+		 * Resolve the type specified as a Name. It may be a simple name or it may be
+		 * a qualified name. This is used when we have Name that we know must be a
+		 * type. This is so that there is no confusion with it possibly being a field or variable
+		 * that has the same case and spelling as a type name.
+		 * @param name
+		 * @return the type name.
+		 * @throws InvalidExpressionException
+		 * 
+		 * @since 1.0.0
+		 */
+		public abstract String resolveType(Name name) throws InvalidExpressionException;
+		
+		/**
 		 * This is used by the resolver if it can't resolve for some reason. This will throw
 		 * an invalid expression exception which will be handled by the ParseTreeCreationFromAST.
 		 * 
@@ -270,11 +283,13 @@
 			throw new InvalidExpressionException(WorkbenchUtilityMessages.getString("ParseTreeCreationFromAST.CannotProcessAnonymousDeclarations.")); //$NON-NLS-1$
 		}
 		PTClassInstanceCreation cic = InstantiationFactory.eINSTANCE.createPTClassInstanceCreation();
-		PTExpression type = perform(node.getName());
-		if (type instanceof PTName)
-		    cic.setType(((PTName) type).getName());
-	    else if (type instanceof PTInstanceReference)
-	    	cic.setType(((PTInstanceReference)type).getObject().getJavaType().getQualifiedName());
+		// If ast level = 2, then you must use getName, but the name needs to be turned into a type
+		// so that it can be resolved. If ast level > 2, then it will return a type to be resolved.
+		// Note: can't just use resolve name on the name because if a field and a class were spelled
+		// the same then the codegen resolver would return an instance ref to the field instead.
+		cic.setType(node.getAST().apiLevel() == AST.JLS2 ? 
+				resolver.resolveType(node.getName()) :
+				resolver.resolveType(node.getType())); 					
 		List args = cic.getArguments();
 		List nargs = node.arguments();
 		int nsize = nargs.size();