Index: compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java,v retrieving revision 1.67 diff -u -r1.67 QualifiedAllocationExpression.java --- compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java 1 Jun 2005 15:16:53 -0000 1.67 +++ compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java 13 Jun 2005 18:19:04 -0000 @@ -253,9 +253,14 @@ } if (receiverType == null) { hasError = true; - } else if (((ReferenceBinding) receiverType).isFinal() && this.anonymousType != null) { - if (!receiverType.isEnum()) { - scope.problemReporter().anonymousClassCannotExtendFinalClass(type, receiverType); + } else if (((ReferenceBinding) receiverType).isFinal()) { + if (this.anonymousType != null) { + if (!receiverType.isEnum()) { + scope.problemReporter().anonymousClassCannotExtendFinalClass(type, receiverType); + } + } else if (!receiverType.canBeInstantiated()) { + scope.problemReporter().cannotInstantiate(type, receiverType); + return this.resolvedType = receiverType; } hasError = true; } @@ -290,11 +295,11 @@ if (hasError) return this.resolvedType = receiverType; if (this.anonymousType == null) { // qualified allocation with no anonymous type - ReferenceBinding allocationType = (ReferenceBinding) receiverType; if (!receiverType.canBeInstantiated()) { scope.problemReporter().cannotInstantiate(type, receiverType); return this.resolvedType = receiverType; } + ReferenceBinding allocationType = (ReferenceBinding) receiverType; if ((this.binding = scope.getConstructor(allocationType, argumentTypes, this)).isValidBinding()) { if (isMethodUseDeprecated(binding, scope)) { scope.problemReporter().deprecatedMethod(this.binding, this); Index: compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java,v retrieving revision 1.116 diff -u -r1.116 ClassScope.java --- compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java 8 Jun 2005 21:11:01 -0000 1.116 +++ compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java 13 Jun 2005 18:19:04 -0000 @@ -491,6 +491,7 @@ modifiers |= AccAbstract; } } + modifiers |= AccFinal; } else { // detect abnormal cases for classes if (isMemberType) { // includes member types defined inside local types @@ -588,6 +589,9 @@ // set the modifiers int implicitValue = AccPublic | AccStatic | AccFinal | AccEnum; + if (fieldDecl.initialization instanceof QualifiedAllocationExpression) { + declaringClass.modifiers &= ~AccFinal; + } fieldBinding.modifiers|= implicitValue; return; }