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

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/core/compiler/IProblem.java (-2 / +1 lines)
Lines 943-950 Link Here
943
	int MissingArgumentsForParameterizedMemberType = TypeRelated + 562;	
943
	int MissingArgumentsForParameterizedMemberType = TypeRelated + 562;	
944
	/** @since 3.1 */
944
	/** @since 3.1 */
945
	int StaticMemberOfParameterizedType = TypeRelated + 563;	
945
	int StaticMemberOfParameterizedType = TypeRelated + 563;	
946
    /** @since 3.1 */
946
947
	int BoundHasConflictingArguments = TypeRelated + 564;	
948
    /** @since 3.1 */
947
    /** @since 3.1 */
949
	int DuplicateParameterizedMethods = MethodRelated + 565;
948
	int DuplicateParameterizedMethods = MethodRelated + 565;
950
	/** @since 3.1 */
949
	/** @since 3.1 */
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java (-13 / +30 lines)
Lines 372-378 Link Here
372
	protected boolean connectTypeVariables(TypeParameter[] typeParameters) {
372
	protected boolean connectTypeVariables(TypeParameter[] typeParameters) {
373
		boolean noProblems = true;
373
		boolean noProblems = true;
374
		if (typeParameters == null || compilerOptions().sourceLevel < ClassFileConstants.JDK1_5) return true;
374
		if (typeParameters == null || compilerOptions().sourceLevel < ClassFileConstants.JDK1_5) return true;
375
375
		TypeBinding[] types = new TypeBinding[2];
376
		Map invocations = new HashMap(2);
376
		nextVariable : for (int i = 0, paramLength = typeParameters.length; i < paramLength; i++) {
377
		nextVariable : for (int i = 0, paramLength = typeParameters.length; i < paramLength; i++) {
377
			TypeParameter typeParameter = typeParameters[i];
378
			TypeParameter typeParameter = typeParameters[i];
378
			TypeVariableBinding typeVariable = typeParameter.binding;
379
			TypeVariableBinding typeVariable = typeParameter.binding;
Lines 415-424 Link Here
415
				typeVariable.superclass = superRefType;
416
				typeVariable.superclass = superRefType;
416
			} else {
417
			} else {
417
				typeVariable.superInterfaces = new ReferenceBinding[] {superRefType};
418
				typeVariable.superInterfaces = new ReferenceBinding[] {superRefType};
418
				typeVariable.modifiers |= AccInterface;
419
			}
419
			}
420
			typeVariable.firstBound = superRefType; // first bound used to compute erasure
420
			typeVariable.firstBound = superRefType; // first bound used to compute erasure
421
422
			TypeReference[] boundRefs = typeParameter.bounds;
421
			TypeReference[] boundRefs = typeParameter.bounds;
423
			if (boundRefs != null) {
422
			if (boundRefs != null) {
424
				for (int j = 0, k = boundRefs.length; j < k; j++) {
423
				for (int j = 0, k = boundRefs.length; j < k; j++) {
Lines 432-437 Link Here
432
						continue nextVariable;
431
						continue nextVariable;
433
					}
432
					}
434
					typeRef.resolvedType = superType; // hold onto the problem type
433
					typeRef.resolvedType = superType; // hold onto the problem type
434
					types[0] = superType;
435
					if (superType.isArrayType()) {
435
					if (superType.isArrayType()) {
436
						problemReporter().boundCannotBeArray(typeRef, superType);
436
						problemReporter().boundCannotBeArray(typeRef, superType);
437
						continue nextVariable;
437
						continue nextVariable;
Lines 443-469 Link Here
443
						noProblems = false;
443
						noProblems = false;
444
						continue nextVariable;
444
						continue nextVariable;
445
					}
445
					}
446
					if (superType.isParameterizedType()) {
446
					// check against superclass
447
					if (typeVariable.firstBound == typeVariable.superclass) {
447
						ReferenceBinding match = typeVariable.superclass.findSuperTypeWithSameErasure(superType);
448
						ReferenceBinding match = typeVariable.superclass.findSuperTypeWithSameErasure(superType);
448
						boolean isCollision = match != null && match != superType;
449
						if (match != null && match != superType) {
449
						for (int index = typeVariable.superInterfaces.length; !isCollision && --index >= 0;) {
450
							problemReporter().superinterfacesCollide(superType.erasure(), typeRef, superType, match);
450
							ReferenceBinding temp = typeVariable.superInterfaces[index];
451
							isCollision = superType != temp && superType.erasure() == temp.erasure();
452
						}
453
						if (isCollision) {
454
							problemReporter().boundHasConflictingArguments(typeRef, superType);
455
							typeVariable.tagBits |= HierarchyHasProblems;
451
							typeVariable.tagBits |= HierarchyHasProblems;
456
							noProblems = false;
452
							noProblems = false;
457
							continue nextVariable;
453
							continue nextVariable;
458
						}
454
						}						
459
					}
455
					}
456
					// check against superinterfaces
460
					for (int index = typeVariable.superInterfaces.length; --index >= 0;) {
457
					for (int index = typeVariable.superInterfaces.length; --index >= 0;) {
461
						if (superType.erasure() == typeVariable.superInterfaces[index].erasure()) {
458
						ReferenceBinding previousInterface = typeVariable.superInterfaces[index];
459
						if (previousInterface == superRefType) {
462
							problemReporter().duplicateBounds(typeRef, superType);
460
							problemReporter().duplicateBounds(typeRef, superType);
463
							typeVariable.tagBits |= HierarchyHasProblems;
461
							typeVariable.tagBits |= HierarchyHasProblems;
464
							noProblems = false;
462
							noProblems = false;
465
							continue nextVariable;
463
							continue nextVariable;
466
						}
464
						}
465
						types[1] = previousInterface;
466
						invocations.clear();
467
						TypeBinding[] mecs = minimalErasedCandidates(types, invocations);
468
						if (mecs != null) {
469
							nextCandidate: for (int m = 0, max = mecs.length; m < max; m++) {
470
								TypeBinding mec = mecs[m];
471
								if (mec == null) continue nextCandidate;
472
								Set invalidInvocations = (Set)invocations.get(mec);
473
								int invalidSize = invalidInvocations.size();
474
								if (invalidSize > 1) {
475
									TypeBinding[] collisions;
476
									invalidInvocations.toArray(collisions = new TypeBinding[invalidSize]);
477
									problemReporter().superinterfacesCollide(collisions[0].erasure(), typeRef, collisions[0], collisions[1]);
478
									typeVariable.tagBits |= HierarchyHasProblems;
479
									noProblems = false;
480
									continue nextVariable;
481
								}
482
							}					
483
						}
467
					}
484
					}
468
					int size = typeVariable.superInterfaces.length;
485
					int size = typeVariable.superInterfaces.length;
469
					System.arraycopy(typeVariable.superInterfaces, 0, typeVariable.superInterfaces = new ReferenceBinding[size + 1], 0, size);
486
					System.arraycopy(typeVariable.superInterfaces, 0, typeVariable.superInterfaces = new ReferenceBinding[size + 1], 0, size);
(-)compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java (-11 / +3 lines)
Lines 314-327 Link Here
314
		location.sourceStart,
314
		location.sourceStart,
315
		location.sourceEnd);
315
		location.sourceEnd);
316
}
316
}
317
public void boundHasConflictingArguments(ASTNode location, TypeBinding type) {
318
	this.handle(
319
		IProblem.BoundHasConflictingArguments,
320
		new String[] {new String(type.readableName())},
321
		new String[] {new String(type.shortReadableName())},
322
		location.sourceStart,
323
		location.sourceEnd);
324
}
325
public void boundMustBeAnInterface(ASTNode location, TypeBinding type) {
317
public void boundMustBeAnInterface(ASTNode location, TypeBinding type) {
326
	this.handle(
318
	this.handle(
327
		IProblem.BoundMustBeAnInterface,
319
		IProblem.BoundMustBeAnInterface,
Lines 4888-4900 Link Here
4888
		superInterfaceRef.sourceStart,
4880
		superInterfaceRef.sourceStart,
4889
		superInterfaceRef.sourceEnd);
4881
		superInterfaceRef.sourceEnd);
4890
}
4882
}
4891
public void superinterfacesCollide(TypeBinding type, TypeDeclaration typeDecl, TypeBinding superType, TypeBinding inheritedSuperType) {
4883
public void superinterfacesCollide(TypeBinding type, ASTNode decl, TypeBinding superType, TypeBinding inheritedSuperType) {
4892
	this.handle(
4884
	this.handle(
4893
		IProblem.SuperInterfacesCollide,
4885
		IProblem.SuperInterfacesCollide,
4894
		new String[] {new String(superType.readableName()), new String(inheritedSuperType.readableName()), new String(type.sourceName())},
4886
		new String[] {new String(superType.readableName()), new String(inheritedSuperType.readableName()), new String(type.sourceName())},
4895
		new String[] {new String(superType.shortReadableName()), new String(inheritedSuperType.shortReadableName()), new String(type.sourceName())},
4887
		new String[] {new String(superType.shortReadableName()), new String(inheritedSuperType.shortReadableName()), new String(type.sourceName())},
4896
		typeDecl.sourceStart,
4888
		decl.sourceStart,
4897
		typeDecl.sourceEnd);
4889
		decl.sourceEnd);
4898
}
4890
}
4899
public void superTypeCannotUseWildcard(SourceTypeBinding type, TypeReference superclass, TypeBinding superTypeBinding) {
4891
public void superTypeCannotUseWildcard(SourceTypeBinding type, TypeReference superclass, TypeBinding superTypeBinding) {
4900
	String name = new String(type.sourceName());
4892
	String name = new String(type.sourceName());
(-)compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties (-1 / +1 lines)
Lines 456-462 Link Here
456
561 = The member type {0}<{1}> must be qualified with a parameterized type, since it is not static
456
561 = The member type {0}<{1}> must be qualified with a parameterized type, since it is not static
457
562 = The member type {0} must be parameterized, since it is qualified with a parameterized type
457
562 = The member type {0} must be parameterized, since it is qualified with a parameterized type
458
563 = The member type {0} cannot be qualified with a parameterized type, since it is static. Remove arguments from qualifying type {1}
458
563 = The member type {0} cannot be qualified with a parameterized type, since it is static. Remove arguments from qualifying type {1}
459
564 = Bound conflict: {0} is inherited with conflicting arguments
459
460
565 = Duplicate methods named {0} with the parameters ({2}) and ({3}) are defined by the type {1}
460
565 = Duplicate methods named {0} with the parameters ({2}) and ({3}) are defined by the type {1}
461
566 = Cannot allocate the member type {0} using a parameterized compound name; use its simple name and an enclosing instance of type {1}
461
566 = Cannot allocate the member type {0} using a parameterized compound name; use its simple name and an enclosing instance of type {1}
462
567 = Duplicate bound {0}
462
567 = Duplicate bound {0}

Return to bug 100619