View | Details | Raw Unified | Return to bug 302865 | Differences between
and this patch

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java (-4 / +20 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 396-403 Link Here
396
				ReferenceBinding existingType = typesBySimpleNames.get(compoundName[compoundName.length - 1]);
396
				ReferenceBinding existingType = typesBySimpleNames.get(compoundName[compoundName.length - 1]);
397
				if (existingType != null) {
397
				if (existingType != null) {
398
					// duplicate test above should have caught this case, but make sure
398
					// duplicate test above should have caught this case, but make sure
399
					if (existingType == referenceBinding)
399
					if (!importReference.isStatic() && existingType == referenceBinding) {
400
						if (existingType.isStatic()) {
401
							// JLS 7.5.3 case
402
							problemReporter().duplicateImport(importReference);
403
						}
400
						continue nextImport;
404
						continue nextImport;
405
					}
401
					// either the type collides with a top level type or another imported type
406
					// either the type collides with a top level type or another imported type
402
					for (int j = 0, length = this.topLevelTypes.length; j < length; j++) {
407
					for (int j = 0, length = this.topLevelTypes.length; j < length; j++) {
403
						if (CharOperation.equals(this.topLevelTypes[j].sourceName, existingType.sourceName)) {
408
						if (CharOperation.equals(this.topLevelTypes[j].sourceName, existingType.sourceName)) {
Lines 405-412 Link Here
405
							continue nextImport;
410
							continue nextImport;
406
						}
411
						}
407
					}
412
					}
408
					problemReporter().duplicateImport(importReference);
413
					boolean flag = false;
409
					continue nextImport;
414
					if (!importReference.isStatic() || (flag = existingType.isStatic())) {
415
						if (flag) {
416
							// JLS 7.5.3 case
417
							// report some new error message saying that the static import is trying to import
418
							// an already imported static type
419
							// can't use problemReporter().duplicateImport(importReference) because the static import
420
							// may not be an exact duplicate if its also trying to import some static method/field.
421
						} else {
422
							problemReporter().duplicateImport(importReference);
423
						}
424
						continue nextImport;
425
					}
410
				}
426
				}
411
				typesBySimpleNames.put(compoundName[compoundName.length - 1], referenceBinding);
427
				typesBySimpleNames.put(compoundName[compoundName.length - 1], referenceBinding);
412
			} else if (importBinding instanceof FieldBinding) {
428
			} else if (importBinding instanceof FieldBinding) {

Return to bug 302865