### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java,v retrieving revision 1.126 diff -u -r1.126 CompilationUnitScope.java --- compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java 22 Apr 2009 19:49:57 -0000 1.126 +++ compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java 25 Mar 2010 13:18:57 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -396,8 +396,13 @@ ReferenceBinding existingType = typesBySimpleNames.get(compoundName[compoundName.length - 1]); if (existingType != null) { // duplicate test above should have caught this case, but make sure - if (existingType == referenceBinding) + if (!importReference.isStatic() && existingType == referenceBinding) { + if (existingType.isStatic()) { + // JLS 7.5.3 case + problemReporter().duplicateImport(importReference); + } continue nextImport; + } // either the type collides with a top level type or another imported type for (int j = 0, length = this.topLevelTypes.length; j < length; j++) { if (CharOperation.equals(this.topLevelTypes[j].sourceName, existingType.sourceName)) { @@ -405,8 +410,19 @@ continue nextImport; } } - problemReporter().duplicateImport(importReference); - continue nextImport; + boolean flag = false; + if (!importReference.isStatic() || (flag = existingType.isStatic())) { + if (flag) { + // JLS 7.5.3 case + // report some new error message saying that the static import is trying to import + // an already imported static type + // can't use problemReporter().duplicateImport(importReference) because the static import + // may not be an exact duplicate if its also trying to import some static method/field. + } else { + problemReporter().duplicateImport(importReference); + } + continue nextImport; + } } typesBySimpleNames.put(compoundName[compoundName.length - 1], referenceBinding); } else if (importBinding instanceof FieldBinding) {