BETA_JAVA7:  Preparatory changes for <>
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java b/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java
index bd515fe..0e168df 100644
--- a/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java
+++ b/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java
@@ -33,6 +33,7 @@
 	public TypeReference[] typeArguments;
 	public TypeBinding[] genericTypeArguments;
 	public FieldDeclaration enumConstant; // for enum constant initializations
+	private TypeBinding expectedTypeForInference;	  // for <> inference
 
 public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
 	// check captured variables are initialized in current context (26134)
@@ -259,25 +260,12 @@
 		// initialization of an enum constant
 		this.resolvedType = scope.enclosingReceiverType();
 	} else {
-		this.resolvedType = this.type.resolveType(scope, true /* check bounds*/);
-		checkParameterizedAllocation: {
-			if (this.type instanceof ParameterizedQualifiedTypeReference) { // disallow new X<String>.Y<Integer>()
-				ReferenceBinding currentType = (ReferenceBinding)this.resolvedType;
-				if (currentType == null) return currentType;
-				do {
-					// isStatic() is answering true for toplevel types
-					if ((currentType.modifiers & ClassFileConstants.AccStatic) != 0) break checkParameterizedAllocation;
-					if (currentType.isRawType()) break checkParameterizedAllocation;
-				} while ((currentType = currentType.enclosingType())!= null);
-				ParameterizedQualifiedTypeReference qRef = (ParameterizedQualifiedTypeReference) this.type;
-				for (int i = qRef.typeArguments.length - 2; i >= 0; i--) {
-					if (qRef.typeArguments[i] != null) {
-						scope.problemReporter().illegalQualifiedParameterizedTypeAllocation(this.type, this.resolvedType);
-						break;
-					}
-				}
-			}
+		if ((this.type.bits & ASTNode.IsDiamond) != 0) {
+			this.resolvedType = null; // can be done only after type arguments and method arguments resolution.
+		} else {
+			this.resolvedType = this.type.resolveType(scope, true /* check bounds*/);
 		}
+		// check for parameterized allocation deferred to below.
 	}
 	// will check for null after args are resolved
 
@@ -350,6 +338,28 @@
 			return this.resolvedType;
 		}
 	}
+	if (this.type != null && (this.type.bits & ASTNode.IsDiamond) != 0) {
+		// Perform diamond inference here. (Not done yet.) 
+		this.resolvedType = this.type.resolveType(scope, true /* check bounds*/);  // for now just do what we do for 1.6-
+	}
+	checkParameterizedAllocation: {
+		if (this.type instanceof ParameterizedQualifiedTypeReference) { // disallow new X<String>.Y<Integer>()
+			ReferenceBinding currentType = (ReferenceBinding)this.resolvedType;
+			if (currentType == null) return currentType;
+			do {
+				// isStatic() is answering true for toplevel types
+				if ((currentType.modifiers & ClassFileConstants.AccStatic) != 0) break checkParameterizedAllocation;
+				if (currentType.isRawType()) break checkParameterizedAllocation;
+			} while ((currentType = currentType.enclosingType())!= null);
+			ParameterizedQualifiedTypeReference qRef = (ParameterizedQualifiedTypeReference) this.type;
+			for (int i = qRef.typeArguments.length - 2; i >= 0; i--) {
+				if (qRef.typeArguments[i] != null) {
+					scope.problemReporter().illegalQualifiedParameterizedTypeAllocation(this.type, this.resolvedType);
+					break;
+				}
+			}
+		}
+	}
 	if (this.resolvedType == null || !this.resolvedType.isValidBinding()) {
 		return null;
 	}
@@ -413,4 +423,17 @@
 	}
 	visitor.endVisit(this, scope);
 }
+/**
+ * @see org.eclipse.jdt.internal.compiler.ast.Expression#setExpectedType(org.eclipse.jdt.internal.compiler.lookup.TypeBinding)
+ */
+public void setExpectedType(TypeBinding expectedType) {
+	this.expectedTypeForInference = expectedType;
+}
+/**
+ * @see org.eclipse.jdt.internal.compiler.lookup.InvocationSite#expectedType()
+ */
+public TypeBinding expectedType() {
+	return this.expectedTypeForInference;
+}
+
 }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java b/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java
index 6818cbf..b960702 100644
--- a/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java
+++ b/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java
@@ -275,30 +275,14 @@
 				// initialization of an enum constant
 				receiverType = scope.enclosingSourceType();
 			} else {
-				receiverType = this.type.resolveType(scope, true /* check bounds*/);
-				checkParameterizedAllocation: {
-					if (receiverType == null || !receiverType.isValidBinding()) break checkParameterizedAllocation;
-					if (this.type instanceof ParameterizedQualifiedTypeReference) { // disallow new X<String>.Y<Integer>()
-						ReferenceBinding currentType = (ReferenceBinding)receiverType;
-						do {
-							// isStatic() is answering true for toplevel types
-							if ((currentType.modifiers & ClassFileConstants.AccStatic) != 0) break checkParameterizedAllocation;
-							if (currentType.isRawType()) break checkParameterizedAllocation;
-						} while ((currentType = currentType.enclosingType())!= null);
-						ParameterizedQualifiedTypeReference qRef = (ParameterizedQualifiedTypeReference) this.type;
-						for (int i = qRef.typeArguments.length - 2; i >= 0; i--) {
-							if (qRef.typeArguments[i] != null) {
-								scope.problemReporter().illegalQualifiedParameterizedTypeAllocation(this.type, receiverType);
-								break;
-							}
-						}
-					}
+				if ((this.type.bits & ASTNode.IsDiamond) == 0) {
+					receiverType = this.type.resolveType(scope, true /* check bounds*/);
+				} else {
+					// can be done only after type arguments and method arguments resolution
 				}
+				// check for parameterized allocation deferred to below.
 			}
 		}
-		if (receiverType == null || !receiverType.isValidBinding()) {
-			hasError = true;
-		}
 
 		// resolve type arguments (for generic constructor call)
 		if (this.typeArguments != null) {
@@ -340,6 +324,31 @@
 				}
 			}
 		}
+		if (this.type != null && (this.type.bits & ASTNode.IsDiamond) != 0) {
+			// Perform diamond inference here. (Not done yet.)
+			receiverType = this.type.resolveType(scope, true /* check bounds*/); // for now just do what we do for 1.6-
+		}	
+		checkParameterizedAllocation: {
+			if (receiverType == null || !receiverType.isValidBinding()) break checkParameterizedAllocation;
+			if (this.type instanceof ParameterizedQualifiedTypeReference) { // disallow new X<String>.Y<Integer>()
+				ReferenceBinding currentType = (ReferenceBinding)receiverType;
+				do {
+					// isStatic() is answering true for toplevel types
+					if ((currentType.modifiers & ClassFileConstants.AccStatic) != 0) break checkParameterizedAllocation;
+					if (currentType.isRawType()) break checkParameterizedAllocation;
+				} while ((currentType = currentType.enclosingType())!= null);
+				ParameterizedQualifiedTypeReference qRef = (ParameterizedQualifiedTypeReference) this.type;
+				for (int i = qRef.typeArguments.length - 2; i >= 0; i--) {
+					if (qRef.typeArguments[i] != null) {
+						scope.problemReporter().illegalQualifiedParameterizedTypeAllocation(this.type, receiverType);
+						break;
+					}
+				}
+			}
+		}
+		if (receiverType == null || !receiverType.isValidBinding()) {
+			hasError = true;
+		}
 
 		// limit of fault-tolerance
 		if (hasError) {