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

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/ast/NameReference.java (-4 / +12 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
2
 * Copyright (c) 2000, 2009 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 26-64 Link Here
26
	//will be a TypeReference (static message sends.....) and there is
26
	//will be a TypeReference (static message sends.....) and there is
27
	//no changeClass in java.
27
	//no changeClass in java.
28
public NameReference() {
28
public NameReference() {
29
	super();
30
	this.bits |= Binding.TYPE | Binding.VARIABLE; // restrictiveFlag
29
	this.bits |= Binding.TYPE | Binding.VARIABLE; // restrictiveFlag
31
32
}
30
}
31
33
public FieldBinding fieldBinding() {
32
public FieldBinding fieldBinding() {
34
	//this method should be sent ONLY after a check against isFieldReference()
33
	//this method should be sent ONLY after a check against isFieldReference()
35
	//check its use doing senders.........
34
	//check its use doing senders.........
36
37
	return (FieldBinding) this.binding ;
35
	return (FieldBinding) this.binding ;
38
}
36
}
37
39
public boolean isSuperAccess() {
38
public boolean isSuperAccess() {
40
	return false;
39
	return false;
41
}
40
}
41
42
public boolean isTypeAccess() {
42
public boolean isTypeAccess() {
43
	// null is acceptable when we are resolving the first part of a reference
43
	// null is acceptable when we are resolving the first part of a reference
44
	return this.binding == null || this.binding instanceof ReferenceBinding;
44
	return this.binding == null || this.binding instanceof ReferenceBinding;
45
}
45
}
46
46
public boolean isTypeReference() {
47
public boolean isTypeReference() {
47
	return this.binding instanceof ReferenceBinding;
48
	return this.binding instanceof ReferenceBinding;
48
}
49
}
50
49
public void setActualReceiverType(ReferenceBinding receiverType) {
51
public void setActualReceiverType(ReferenceBinding receiverType) {
50
	if (receiverType == null) return; // error scenario only
52
	if (receiverType == null) return; // error scenario only
51
	this.actualReceiverType = receiverType;
53
	this.actualReceiverType = receiverType;
52
}
54
}
55
53
public void setDepth(int depth) {
56
public void setDepth(int depth) {
54
	this.bits &= ~DepthMASK; // flush previous depth if any
57
	this.bits &= ~DepthMASK; // flush previous depth if any
55
	if (depth > 0) {
58
	if (depth > 0) {
56
		this.bits |= (depth & 0xFF) << DepthSHIFT; // encoded on 8 bits
59
		this.bits |= (depth & 0xFF) << DepthSHIFT; // encoded on 8 bits
57
	}
60
	}
58
}
61
}
62
59
public void setFieldIndex(int index){
63
public void setFieldIndex(int index){
60
	// ignored
64
	// ignored
61
}
65
}
62
66
67
public void setUnchecked(boolean isUnchecked) {
68
	// ignored
69
}
70
63
public abstract String unboundReferenceErrorName();
71
public abstract String unboundReferenceErrorName();
64
}
72
}
(-)compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java (-24 / +23 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2009 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 260-295 Link Here
260
			resolveReference(this.seeReferences[i], methScope);
260
			resolveReference(this.seeReferences[i], methScope);
261
261
262
			// see whether we can have a super reference
262
			// see whether we can have a super reference
263
			if (methDecl != null && (methDecl.isConstructor() || overriding) && !superRef) {
263
			if (methDecl != null && !superRef) {
264
				if (this.seeReferences[i] instanceof JavadocMessageSend) {
264
				if (!methDecl.isConstructor()) {
265
					JavadocMessageSend messageSend = (JavadocMessageSend) this.seeReferences[i];
265
					if (overriding && this.seeReferences[i] instanceof JavadocMessageSend) {
266
					// if binding is valid then look if we have a reference to an overriden method/constructor
266
						JavadocMessageSend messageSend = (JavadocMessageSend) this.seeReferences[i];
267
					if (messageSend.binding != null && messageSend.binding.isValidBinding() && messageSend.actualReceiverType instanceof ReferenceBinding) {
267
						// if binding is valid then look if we have a reference to an overriden method/constructor
268
						ReferenceBinding methodReceiverType = (ReferenceBinding) messageSend.actualReceiverType;
268
						if (messageSend.binding != null && messageSend.binding.isValidBinding() && messageSend.actualReceiverType instanceof ReferenceBinding) {
269
						if ((methodReceiverType.isSuperclassOf(methDecl.binding.declaringClass) || (methodReceiverType.isInterface() && methDecl.binding.declaringClass.implementsInterface(methodReceiverType, true))) &&
269
							ReferenceBinding methodReceiverType = (ReferenceBinding) messageSend.actualReceiverType;
270
								CharOperation.equals(messageSend.selector, methDecl.selector) &&
270
							TypeBinding superType = methDecl.binding.declaringClass.findSuperTypeOriginatingFrom(methodReceiverType);
271
								(methDecl.binding.returnType.isCompatibleWith(messageSend.binding.returnType))) {
271
							if (superType != null && superType.original() != methDecl.binding.declaringClass && CharOperation.equals(messageSend.selector, methDecl.selector)) {
272
							if (messageSend.arguments == null && methDecl.arguments == null) {
272
								if (methScope.environment().methodVerifier().doesMethodOverride(methDecl.binding, messageSend.binding.original())) {
273
								superRef = true;
273
									superRef = true;
274
							}
274
								}
275
							else if (messageSend.arguments != null && methDecl.arguments != null) {
276
								superRef = methDecl.binding.areParameterErasuresEqual(messageSend.binding);
277
							}
275
							}
278
						}
276
						}
279
					}
277
					}
280
				}
278
				} else if (this.seeReferences[i] instanceof JavadocAllocationExpression) {
281
				else if (this.seeReferences[i] instanceof JavadocAllocationExpression) {
282
					JavadocAllocationExpression allocationExpr = (JavadocAllocationExpression) this.seeReferences[i];
279
					JavadocAllocationExpression allocationExpr = (JavadocAllocationExpression) this.seeReferences[i];
283
					// if binding is valid then look if we have a reference to an overriden method/constructor
280
					// if binding is valid then look if we have a reference to an overriden method/constructor
284
					if (allocationExpr.binding != null && allocationExpr.binding.isValidBinding()) {
281
					if (allocationExpr.binding != null && allocationExpr.binding.isValidBinding()) {
285
						if (methDecl.binding.declaringClass.isCompatibleWith(allocationExpr.resolvedType)) {
282
						ReferenceBinding allocType = (ReferenceBinding) allocationExpr.resolvedType.original();
286
							if (allocationExpr.arguments == null && methDecl.arguments == null) {
283
						ReferenceBinding superType = (ReferenceBinding) methDecl.binding.declaringClass.findSuperTypeOriginatingFrom(allocType);
287
								superRef = true;
284
						if (superType != null && superType.original() != methDecl.binding.declaringClass) {
288
							}
285
							MethodBinding superConstructor = methScope.getConstructor(superType, methDecl.binding.parameters, allocationExpr);
289
							else if (allocationExpr.arguments != null && methDecl.arguments != null && allocationExpr.arguments.length == methDecl.arguments.length) {
286
							if (superConstructor.isValidBinding() && superConstructor.original() == allocationExpr.binding.original()) {
290
								superRef = methDecl.binding.areParametersCompatibleWith(allocationExpr.binding.parameters);
287
								if (superConstructor.areParametersEqual(methDecl.binding)) {
288
									superRef = true;
289
								}
291
							}
290
							}
292
						}
291
						}						
293
					}
292
					}
294
				}
293
				}
295
			}
294
			}
(-)compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java (-10 / +17 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2009 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 39-45 Link Here
39
	public final static int Bit14 = 0x2000;			// strictly assigned (reference lhs) | discard enclosing instance (explicit constr call) | hasBeenGenerated (type decl)
39
	public final static int Bit14 = 0x2000;			// strictly assigned (reference lhs) | discard enclosing instance (explicit constr call) | hasBeenGenerated (type decl)
40
	public final static int Bit15 = 0x4000;			// is unnecessary cast (expression) | is varargs (type ref) | isSubRoutineEscaping (try statement) | superAccess (javadoc allocation expression/javadoc message send/javadoc return statement)
40
	public final static int Bit15 = 0x4000;			// is unnecessary cast (expression) | is varargs (type ref) | isSubRoutineEscaping (try statement) | superAccess (javadoc allocation expression/javadoc message send/javadoc return statement)
41
	public final static int Bit16 = 0x8000;			// in javadoc comment (name ref, type ref, msg)
41
	public final static int Bit16 = 0x8000;			// in javadoc comment (name ref, type ref, msg)
42
	public final static int Bit17 = 0x10000;			// compound assigned (reference lhs)
42
	public final static int Bit17 = 0x10000;			// compound assigned (reference lhs) | unchecked (msg, alloc, explicit constr call)
43
	public final static int Bit18 = 0x20000;			// non null (expression) | onDemand (import reference)
43
	public final static int Bit18 = 0x20000;			// non null (expression) | onDemand (import reference)
44
	public final static int Bit19 = 0x40000;			// didResolve (parameterized qualified type ref/parameterized single type ref)  | empty (javadoc return statement) | needReceiverGenericCast (msg/fieldref)
44
	public final static int Bit19 = 0x40000;			// didResolve (parameterized qualified type ref/parameterized single type ref)  | empty (javadoc return statement) | needReceiverGenericCast (msg/fieldref)
45
	public final static int Bit20 = 0x80000;
45
	public final static int Bit20 = 0x80000;
Lines 159-164 Link Here
159
	// for explicit constructor call
159
	// for explicit constructor call
160
	public static final int DiscardEnclosingInstance = Bit14; // used for codegen
160
	public static final int DiscardEnclosingInstance = Bit14; // used for codegen
161
161
162
	// for all method/constructor invocations (msg, alloc, expl. constr call)
163
	public static final int Unchecked = Bit17;
164
	
162
	// for empty statement
165
	// for empty statement
163
	public static final int IsUsefulEmptyStatement = Bit1;
166
	public static final int IsUsefulEmptyStatement = Bit1;
164
167
Lines 241-254 Link Here
241
		    	return INVOCATION_ARGUMENT_WILDCARD;
244
		    	return INVOCATION_ARGUMENT_WILDCARD;
242
			}
245
			}
243
		}
246
		}
244
		TypeBinding checkedParameterType = originalParameterType == null ? parameterType : originalParameterType;
247
		TypeBinding checkedParameterType = parameterType; // originalParameterType == null ? parameterType : originalParameterType;
245
		if (argumentType != checkedParameterType && argumentType.needsUncheckedConversion(checkedParameterType)) {
248
		if (argumentType != checkedParameterType && argumentType.needsUncheckedConversion(checkedParameterType)) {
246
			scope.problemReporter().unsafeTypeConversion(argument, argumentType, checkedParameterType);
249
			scope.problemReporter().unsafeTypeConversion(argument, argumentType, checkedParameterType);
247
			return INVOCATION_ARGUMENT_UNCHECKED;
250
			return INVOCATION_ARGUMENT_UNCHECKED;
248
		}
251
		}
249
		return INVOCATION_ARGUMENT_OK;
252
		return INVOCATION_ARGUMENT_OK;
250
	}
253
	}
251
	public static void checkInvocationArguments(BlockScope scope, Expression receiver, TypeBinding receiverType, MethodBinding method, Expression[] arguments, TypeBinding[] argumentTypes, boolean argsContainCast, InvocationSite invocationSite) {
254
	public static void checkInvocationArguments(BlockScope scope, Expression receiver, TypeBinding receiverType, MethodBinding method, Expression[] arguments, TypeBinding[] argumentTypes, boolean argsContainCast, InvocationSite invocationSite, boolean uncheckedBoundCheck) {
252
		TypeBinding[] params = method.parameters;
255
		TypeBinding[] params = method.parameters;
253
		int paramLength = params.length;
256
		int paramLength = params.length;
254
		boolean isRawMemberInvocation = !method.isStatic()
257
		boolean isRawMemberInvocation = !method.isStatic()
Lines 260-266 Link Here
260
		if (!isRawMemberInvocation) {
263
		if (!isRawMemberInvocation) {
261
			if (method instanceof ParameterizedGenericMethodBinding) {
264
			if (method instanceof ParameterizedGenericMethodBinding) {
262
				ParameterizedGenericMethodBinding paramMethod = (ParameterizedGenericMethodBinding) method;
265
				ParameterizedGenericMethodBinding paramMethod = (ParameterizedGenericMethodBinding) method;
263
				if (paramMethod.isUnchecked || (paramMethod.isRaw && method.hasSubstitutedParameters())) {
266
				if (paramMethod.isRaw && method.hasSubstitutedParameters()) {
264
					rawOriginalGenericMethod = method.original();
267
					rawOriginalGenericMethod = method.original();
265
				}
268
				}
266
			}
269
			}
Lines 296-304 Link Here
296
					for (int i = lastIndex; i < argLength; i++) {
299
					for (int i = lastIndex; i < argLength; i++) {
297
						invocationStatus |= checkInvocationArgument(scope, arguments[i], parameterType, argumentTypes[i], originalRawParam);
300
						invocationStatus |= checkInvocationArgument(scope, arguments[i], parameterType, argumentTypes[i], originalRawParam);
298
					}
301
					}
299
				}
302
				} 
300
303
				if (paramLength == argLength) { // 70056
301
			   if (paramLength == argumentTypes.length) { // 70056
302
					int varargsIndex = paramLength - 1;
304
					int varargsIndex = paramLength - 1;
303
					ArrayBinding varargsType = (ArrayBinding) params[varargsIndex];
305
					ArrayBinding varargsType = (ArrayBinding) params[varargsIndex];
304
					TypeBinding lastArgType = argumentTypes[varargsIndex];
306
					TypeBinding lastArgType = argumentTypes[varargsIndex];
Lines 335-342 Link Here
335
		    scope.problemReporter().wildcardInvocation((ASTNode)invocationSite, receiverType, method, argumentTypes);
337
		    scope.problemReporter().wildcardInvocation((ASTNode)invocationSite, receiverType, method, argumentTypes);
336
		} else if (!method.isStatic() && !receiverType.isUnboundWildcard() && method.declaringClass.isRawType() && method.hasSubstitutedParameters()) {
338
		} else if (!method.isStatic() && !receiverType.isUnboundWildcard() && method.declaringClass.isRawType() && method.hasSubstitutedParameters()) {
337
		    scope.problemReporter().unsafeRawInvocation((ASTNode)invocationSite, method);
339
		    scope.problemReporter().unsafeRawInvocation((ASTNode)invocationSite, method);
338
		} else if (rawOriginalGenericMethod != null) {
340
		} else if (rawOriginalGenericMethod != null 
339
		    scope.problemReporter().unsafeRawGenericMethodInvocation((ASTNode)invocationSite, method);
341
				|| uncheckedBoundCheck
342
				|| ((invocationStatus & INVOCATION_ARGUMENT_UNCHECKED) != 0 
343
						&& method instanceof ParameterizedGenericMethodBinding
344
						/*&& method.returnType != scope.environment().convertToRawType(method.returnType.erasure(), true)*/)) {
345
			invocationSite.setUnchecked(true);
346
		    scope.problemReporter().unsafeRawGenericMethodInvocation((ASTNode)invocationSite, method, argumentTypes);
340
		}
347
		}
341
	}
348
	}
342
	public ASTNode concreteStatement() {
349
	public ASTNode concreteStatement() {
(-)compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java (-4 / +7 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2009 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 82-87 Link Here
82
		// record some dependency information for exception types
82
		// record some dependency information for exception types
83
		ReferenceBinding[] thrownExceptions;
83
		ReferenceBinding[] thrownExceptions;
84
		if (((thrownExceptions = this.binding.thrownExceptions).length) != 0) {
84
		if (((thrownExceptions = this.binding.thrownExceptions).length) != 0) {
85
			if ((this.bits & ASTNode.Unchecked) != 0) {
86
				thrownExceptions = currentScope.environment().convertToRawTypes(this.binding.original().thrownExceptions, true, true);
87
			}			
85
			// check exception handling
88
			// check exception handling
86
			flowContext.checkExceptionHandlers(
89
			flowContext.checkExceptionHandlers(
87
				thrownExceptions,
90
				thrownExceptions,
Lines 369-375 Link Here
369
				if (isMethodUseDeprecated(this.binding, scope, true)) {
372
				if (isMethodUseDeprecated(this.binding, scope, true)) {
370
					scope.problemReporter().deprecatedMethod(this.binding, this);
373
					scope.problemReporter().deprecatedMethod(this.binding, this);
371
				}
374
				}
372
				checkInvocationArguments(scope, null, allocationType, this.binding, this.arguments, argumentTypes, argsContainCast, this);
375
				checkInvocationArguments(scope, null, allocationType, this.binding, this.arguments, argumentTypes, argsContainCast, this, (this.bits & ASTNode.Unchecked) != 0);
373
				if (this.typeArguments != null && this.binding.original().typeVariables == Binding.NO_TYPE_VARIABLES) {
376
				if (this.typeArguments != null && this.binding.original().typeVariables == Binding.NO_TYPE_VARIABLES) {
374
					scope.problemReporter().unnecessaryTypeArgumentsForMethodInvocation(this.binding, this.genericTypeArguments, this.typeArguments);
377
					scope.problemReporter().unnecessaryTypeArgumentsForMethodInvocation(this.binding, this.genericTypeArguments, this.typeArguments);
375
				}
378
				}
Lines 446-458 Link Here
446
			this.enclosingInstance.computeConversion(scope, targetEnclosing, enclosingInstanceType);
449
			this.enclosingInstance.computeConversion(scope, targetEnclosing, enclosingInstanceType);
447
		}
450
		}
448
		if (this.arguments != null) {
451
		if (this.arguments != null) {
449
			checkInvocationArguments(scope, null, anonymousSuperclass, inheritedBinding, this.arguments, argumentTypes, argsContainCast, this);
452
			checkInvocationArguments(scope, null, anonymousSuperclass, inheritedBinding, this.arguments, argumentTypes, argsContainCast, this, (this.bits & ASTNode.Unchecked) != 0);
450
		}
453
		}
451
		if (this.typeArguments != null && inheritedBinding.original().typeVariables == Binding.NO_TYPE_VARIABLES) {
454
		if (this.typeArguments != null && inheritedBinding.original().typeVariables == Binding.NO_TYPE_VARIABLES) {
452
			scope.problemReporter().unnecessaryTypeArgumentsForMethodInvocation(inheritedBinding, this.genericTypeArguments, this.typeArguments);
455
			scope.problemReporter().unnecessaryTypeArgumentsForMethodInvocation(inheritedBinding, this.genericTypeArguments, this.typeArguments);
453
		}
456
		}
454
		// Update the anonymous inner class : superclass, interface
457
		// Update the anonymous inner class : superclass, interface
455
		this.binding = this.anonymousType.createDefaultConstructorWithBinding(inheritedBinding);
458
		this.binding = this.anonymousType.createDefaultConstructorWithBinding(inheritedBinding, 	(this.bits & ASTNode.Unchecked) != 0);
456
		return this.resolvedType;
459
		return this.resolvedType;
457
	}
460
	}
458
461
(-)compiler/org/eclipse/jdt/internal/compiler/ast/AbstractVariableDeclaration.java (-1 / +6 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
2
 * Copyright (c) 2000, 2009 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 128-131 Link Here
128
	public void setFieldIndex(int depth) {
128
	public void setFieldIndex(int depth) {
129
		// do nothing by default
129
		// do nothing by default
130
	}
130
	}
131
	
132
	public void setUnchecked(boolean isUnchecked) {
133
		// ignored
134
	}
135
	
131
}
136
}
(-)compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java (-2 / +14 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2009 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 43-48 Link Here
43
	// record some dependency information for exception types
43
	// record some dependency information for exception types
44
	ReferenceBinding[] thrownExceptions;
44
	ReferenceBinding[] thrownExceptions;
45
	if (((thrownExceptions = this.binding.thrownExceptions).length) != 0) {
45
	if (((thrownExceptions = this.binding.thrownExceptions).length) != 0) {
46
		if ((this.bits & ASTNode.Unchecked) != 0) {
47
			thrownExceptions = currentScope.environment().convertToRawTypes(this.binding.original().thrownExceptions, true, true);
48
		}		
46
		// check exception handling
49
		// check exception handling
47
		flowContext.checkExceptionHandlers(
50
		flowContext.checkExceptionHandlers(
48
			thrownExceptions,
51
			thrownExceptions,
Lines 353-359 Link Here
353
	}
356
	}
354
	if (isMethodUseDeprecated(this.binding, scope, true))
357
	if (isMethodUseDeprecated(this.binding, scope, true))
355
		scope.problemReporter().deprecatedMethod(this.binding, this);
358
		scope.problemReporter().deprecatedMethod(this.binding, this);
356
	checkInvocationArguments(scope, null, allocationType, this.binding, this.arguments, argumentTypes, argsContainCast, this);
359
	checkInvocationArguments(scope, null, allocationType, this.binding, this.arguments, argumentTypes, argsContainCast, this, (this.bits & ASTNode.Unchecked) != 0);
357
	if (this.typeArguments != null && this.binding.original().typeVariables == Binding.NO_TYPE_VARIABLES) {
360
	if (this.typeArguments != null && this.binding.original().typeVariables == Binding.NO_TYPE_VARIABLES) {
358
		scope.problemReporter().unnecessaryTypeArgumentsForMethodInvocation(this.binding, this.genericTypeArguments, this.typeArguments);
361
		scope.problemReporter().unnecessaryTypeArgumentsForMethodInvocation(this.binding, this.genericTypeArguments, this.typeArguments);
359
	}
362
	}
Lines 372-377 Link Here
372
	// ignored
375
	// ignored
373
}
376
}
374
377
378
public void setUnchecked(boolean isUnchecked) {
379
	if (isUnchecked) {
380
		this.bits |= ASTNode.Unchecked;
381
	} else {
382
		this.bits &= ~ASTNode.Unchecked;
383
	}
384
	
385
}
386
375
public void traverse(ASTVisitor visitor, BlockScope scope) {
387
public void traverse(ASTVisitor visitor, BlockScope scope) {
376
	if (visitor.visit(this, scope)) {
388
	if (visitor.visit(this, scope)) {
377
		if (this.typeArguments != null) {
389
		if (this.typeArguments != null) {
(-)compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java (-2 / +14 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2009 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 81-86 Link Here
81
81
82
			ReferenceBinding[] thrownExceptions;
82
			ReferenceBinding[] thrownExceptions;
83
			if ((thrownExceptions = this.binding.thrownExceptions) != Binding.NO_EXCEPTIONS) {
83
			if ((thrownExceptions = this.binding.thrownExceptions) != Binding.NO_EXCEPTIONS) {
84
				if ((this.bits & ASTNode.Unchecked) != 0) {
85
					thrownExceptions = currentScope.environment().convertToRawTypes(this.binding.original().thrownExceptions, true, true);
86
				}				
84
				// check exceptions
87
				// check exceptions
85
				flowContext.checkExceptionHandlers(
88
				flowContext.checkExceptionHandlers(
86
					thrownExceptions,
89
					thrownExceptions,
Lines 397-403 Link Here
397
				if (isMethodUseDeprecated(this.binding, scope, this.accessMode != ExplicitConstructorCall.ImplicitSuper)) {
400
				if (isMethodUseDeprecated(this.binding, scope, this.accessMode != ExplicitConstructorCall.ImplicitSuper)) {
398
					scope.problemReporter().deprecatedMethod(this.binding, this);
401
					scope.problemReporter().deprecatedMethod(this.binding, this);
399
				}
402
				}
400
				checkInvocationArguments(scope, null, receiverType, this.binding, this.arguments, argumentTypes, argsContainCast, this);
403
				checkInvocationArguments(scope, null, receiverType, this.binding, this.arguments, argumentTypes, argsContainCast, this, (this.bits & ASTNode.Unchecked) != 0);
401
				if (this.binding.isPrivate() || receiverType.isLocalType()) {
404
				if (this.binding.isPrivate() || receiverType.isLocalType()) {
402
					this.binding.original().modifiers |= ExtraCompilerModifiers.AccLocallyUsed;
405
					this.binding.original().modifiers |= ExtraCompilerModifiers.AccLocallyUsed;
403
				}
406
				}
Lines 430-435 Link Here
430
		// ignore for here
433
		// ignore for here
431
	}
434
	}
432
435
436
	public void setUnchecked(boolean isUnchecked) {
437
		if (isUnchecked) {
438
			this.bits |= ASTNode.Unchecked;
439
		} else {
440
			this.bits &= ~ASTNode.Unchecked;
441
		}
442
		
443
	}
444
	
433
	public void traverse(ASTVisitor visitor, BlockScope scope) {
445
	public void traverse(ASTVisitor visitor, BlockScope scope) {
434
		if (visitor.visit(this, scope)) {
446
		if (visitor.visit(this, scope)) {
435
			if (this.qualification != null) {
447
			if (this.qualification != null) {
(-)compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java (-3 / +7 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2009 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 345-351 Link Here
345
}
345
}
346
346
347
// anonymous type constructor creation: rank is important since bindings already got sorted
347
// anonymous type constructor creation: rank is important since bindings already got sorted
348
public MethodBinding createDefaultConstructorWithBinding(MethodBinding inheritedConstructorBinding) {
348
public MethodBinding createDefaultConstructorWithBinding(MethodBinding inheritedConstructorBinding, boolean isUnchecked) {
349
	//Add to method'set, the default constuctor that just recall the
349
	//Add to method'set, the default constuctor that just recall the
350
	//super constructor with the same arguments
350
	//super constructor with the same arguments
351
	String baseName = "$anonymous"; //$NON-NLS-1$
351
	String baseName = "$anonymous"; //$NON-NLS-1$
Lines 393-403 Link Here
393
	}
393
	}
394
394
395
	//============BINDING UPDATE==========================
395
	//============BINDING UPDATE==========================
396
	ReferenceBinding[] thrownExceptions = isUnchecked
397
			? this.scope.environment().convertToRawTypes(inheritedConstructorBinding.original().thrownExceptions, true, true)
398
			: inheritedConstructorBinding.thrownExceptions;
399
396
	SourceTypeBinding sourceType = this.binding;
400
	SourceTypeBinding sourceType = this.binding;
397
	constructor.binding = new MethodBinding(
401
	constructor.binding = new MethodBinding(
398
			constructor.modifiers, //methodDeclaration
402
			constructor.modifiers, //methodDeclaration
399
			argumentsLength == 0 ? Binding.NO_PARAMETERS : argumentTypes, //arguments bindings
403
			argumentsLength == 0 ? Binding.NO_PARAMETERS : argumentTypes, //arguments bindings
400
			inheritedConstructorBinding.thrownExceptions, //exceptions
404
			thrownExceptions, //exceptions
401
			sourceType); //declaringClass
405
			sourceType); //declaringClass
402
	constructor.binding.tagBits |= (inheritedConstructorBinding.tagBits & TagBits.HasMissingType);
406
	constructor.binding.tagBits |= (inheritedConstructorBinding.tagBits & TagBits.HasMissingType);
403
	constructor.binding.modifiers |= ExtraCompilerModifiers.AccIsDefaultConstructor;
407
	constructor.binding.modifiers |= ExtraCompilerModifiers.AccIsDefaultConstructor;
(-)compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java (-1 / +5 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2009 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 609-614 Link Here
609
	// ignored
609
	// ignored
610
}
610
}
611
611
612
public void setUnchecked(boolean isUnchecked) {
613
	// ignored
614
}
615
612
public void traverse(ASTVisitor visitor, BlockScope scope) {
616
public void traverse(ASTVisitor visitor, BlockScope scope) {
613
	if (visitor.visit(this, scope)) {
617
	if (visitor.visit(this, scope)) {
614
		this.receiver.traverse(visitor, scope);
618
		this.receiver.traverse(visitor, scope);
(-)compiler/org/eclipse/jdt/internal/compiler/ast/CastExpression.java (-2 / +4 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2009 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 256-261 Link Here
256
			public void setActualReceiverType(ReferenceBinding actualReceiverType) { /* ignore */}
256
			public void setActualReceiverType(ReferenceBinding actualReceiverType) { /* ignore */}
257
			public void setDepth(int depth) { /* ignore */}
257
			public void setDepth(int depth) { /* ignore */}
258
			public void setFieldIndex(int depth){ /* ignore */}
258
			public void setFieldIndex(int depth){ /* ignore */}
259
			public void setUnchecked(boolean isUnchecked) {/* ignore */}
259
			public int sourceStart() { return 0; }
260
			public int sourceStart() { return 0; }
260
			public int sourceEnd() { return 0; }
261
			public int sourceEnd() { return 0; }
261
		};
262
		};
Lines 287-293 Link Here
287
				}
288
				}
288
			}
289
			}
289
			for (int i = 0; i < argumentLength; i++) {
290
			for (int i = 0; i < argumentLength; i++) {
290
				if (originalArgumentTypes[i] != alternateArgumentTypes[i]) {
291
				if (originalArgumentTypes[i] != alternateArgumentTypes[i]
292
                       /*&& !originalArgumentTypes[i].needsUncheckedConversion(alternateArgumentTypes[i])*/) {
291
					scope.problemReporter().unnecessaryCast((CastExpression)arguments[i]);
293
					scope.problemReporter().unnecessaryCast((CastExpression)arguments[i]);
292
				}
294
				}
293
			}
295
			}
(-)compiler/org/eclipse/jdt/internal/compiler/ast/Argument.java (-2 / +1 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2009 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 93-99 Link Here
93
	}
93
	}
94
94
95
	public TypeBinding resolveForCatch(BlockScope scope) {
95
	public TypeBinding resolveForCatch(BlockScope scope) {
96
97
		// resolution on an argument of a catch clause
96
		// resolution on an argument of a catch clause
98
		// provide the scope with a side effect : insertion of a LOCAL
97
		// provide the scope with a side effect : insertion of a LOCAL
99
		// that represents the argument. The type must be from JavaThrowable
98
		// that represents the argument. The type must be from JavaThrowable
(-)compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java (-6 / +26 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2009 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 69-74 Link Here
69
	}
69
	}
70
	ReferenceBinding[] thrownExceptions;
70
	ReferenceBinding[] thrownExceptions;
71
	if ((thrownExceptions = this.binding.thrownExceptions) != Binding.NO_EXCEPTIONS) {
71
	if ((thrownExceptions = this.binding.thrownExceptions) != Binding.NO_EXCEPTIONS) {
72
		if ((this.bits & ASTNode.Unchecked) != 0) {
73
			thrownExceptions = currentScope.environment().convertToRawTypes(this.binding.original().thrownExceptions, true, true);
74
		}
72
		// must verify that exceptions potentially thrown by this expression are caught in the method
75
		// must verify that exceptions potentially thrown by this expression are caught in the method
73
		flowContext.checkExceptionHandlers(thrownExceptions, this, flowInfo.copy(), currentScope);
76
		flowContext.checkExceptionHandlers(thrownExceptions, this, flowInfo.copy(), currentScope);
74
		// TODO (maxime) the copy above is needed because of a side effect into
77
		// TODO (maxime) the copy above is needed because of a side effect into
Lines 394-401 Link Here
394
		scope.problemReporter().errorNoMethodFor(this, this.actualReceiverType, argumentTypes);
397
		scope.problemReporter().errorNoMethodFor(this, this.actualReceiverType, argumentTypes);
395
		return null;
398
		return null;
396
	}
399
	}
397
	this.binding =
400
	this.binding = this.receiver.isImplicitThis()
398
		this.receiver.isImplicitThis()
399
			? scope.getImplicitMethod(this.selector, argumentTypes, this)
401
			? scope.getImplicitMethod(this.selector, argumentTypes, this)
400
			: scope.getMethod(this.actualReceiverType, this.selector, argumentTypes, this);
402
			: scope.getMethod(this.actualReceiverType, this.selector, argumentTypes, this);
401
	if (!this.binding.isValidBinding()) {
403
	if (!this.binding.isValidBinding()) {
Lines 466-472 Link Here
466
			scope.problemReporter().indirectAccessToStaticMethod(this, this.binding);
468
			scope.problemReporter().indirectAccessToStaticMethod(this, this.binding);
467
		}
469
		}
468
	}
470
	}
469
	checkInvocationArguments(scope, this.receiver, this.actualReceiverType, this.binding, this.arguments, argumentTypes, argsContainCast, this);
471
	checkInvocationArguments(scope, this.receiver, this.actualReceiverType, this.binding, this.arguments, argumentTypes, argsContainCast, this, (this.bits & ASTNode.Unchecked) != 0);
470
472
471
	//-------message send that are known to fail at compile time-----------
473
	//-------message send that are known to fail at compile time-----------
472
	if (this.binding.isAbstract()) {
474
	if (this.binding.isAbstract()) {
Lines 482-489 Link Here
482
	if (this.binding == scope.environment().arrayClone && compilerOptions.sourceLevel >= ClassFileConstants.JDK1_5) {
484
	if (this.binding == scope.environment().arrayClone && compilerOptions.sourceLevel >= ClassFileConstants.JDK1_5) {
483
		this.resolvedType = this.actualReceiverType;
485
		this.resolvedType = this.actualReceiverType;
484
	} else {
486
	} else {
485
		TypeBinding returnType = this.binding.returnType;
487
		TypeBinding returnType;
486
		if (returnType != null) returnType = returnType.capture(scope, this.sourceEnd);
488
		if ((this.bits & ASTNode.Unchecked) != 0) {
489
			returnType = this.binding.original().returnType;
490
			if (returnType != null) {
491
				returnType = scope.environment().convertToRawType(returnType.erasure(), true);
492
			}
493
		} else {
494
			returnType = this.binding.returnType;
495
			if (returnType != null) {
496
				returnType = returnType.capture(scope, this.sourceEnd);
497
			}
498
		}
487
		this.resolvedType = returnType;
499
		this.resolvedType = returnType;
488
	}
500
	}
489
	if (this.receiver.isSuper() && compilerOptions.getSeverity(CompilerOptions.OverridingMethodWithoutSuperInvocation) != ProblemSeverities.Ignore) {
501
	if (this.receiver.isSuper() && compilerOptions.getSeverity(CompilerOptions.OverridingMethodWithoutSuperInvocation) != ProblemSeverities.Ignore) {
Lines 527-532 Link Here
527
	// ignore for here
539
	// ignore for here
528
}
540
}
529
541
542
public void setUnchecked(boolean isUnchecked) {
543
	if (isUnchecked) {
544
		this.bits |= ASTNode.Unchecked;
545
	} else {
546
		this.bits &= ~ASTNode.Unchecked;
547
	}
548
}
549
530
public void traverse(ASTVisitor visitor, BlockScope blockScope) {
550
public void traverse(ASTVisitor visitor, BlockScope blockScope) {
531
	if (visitor.visit(this, blockScope)) {
551
	if (visitor.visit(this, blockScope)) {
532
		this.receiver.traverse(visitor, blockScope);
552
		this.receiver.traverse(visitor, blockScope);
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java (-5 / +12 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2008 IBM Corporation and others.
2
 * Copyright (c) 2005, 2009 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 33-39 Link Here
33
	private ReferenceBinding enclosingType;
33
	private ReferenceBinding enclosingType;
34
34
35
	public ParameterizedTypeBinding(ReferenceBinding type, TypeBinding[] arguments,  ReferenceBinding enclosingType, LookupEnvironment environment){
35
	public ParameterizedTypeBinding(ReferenceBinding type, TypeBinding[] arguments,  ReferenceBinding enclosingType, LookupEnvironment environment){
36
37
		this.environment = environment;
36
		this.environment = environment;
38
		this.enclosingType = enclosingType; // never unresolved, never lazy per construction
37
		this.enclosingType = enclosingType; // never unresolved, never lazy per construction
39
//		if (enclosingType != null && enclosingType.isGenericType()) {
38
//		if (enclosingType != null && enclosingType.isGenericType()) {
Lines 151-157 Link Here
151
	 *   A >> F   corresponds to:   F.collectSubstitutes(..., A, ..., CONSTRAINT_SUPER (2))
150
	 *   A >> F   corresponds to:   F.collectSubstitutes(..., A, ..., CONSTRAINT_SUPER (2))
152
	 */
151
	 */
153
	public void collectSubstitutes(Scope scope, TypeBinding actualType, InferenceContext inferenceContext, int constraint) {
152
	public void collectSubstitutes(Scope scope, TypeBinding actualType, InferenceContext inferenceContext, int constraint) {
154
		if ((this.tagBits & TagBits.HasTypeVariable) == 0) return;
153
		if ((this.tagBits & TagBits.HasTypeVariable) == 0) {
154
			TypeBinding actualEquivalent = actualType.findSuperTypeOriginatingFrom(this.type);
155
			if (actualEquivalent != null && actualEquivalent.isRawType()) {
156
				inferenceContext.isUnchecked = true;
157
			}
158
			return;
159
		}
155
		if (actualType == TypeBinding.NULL) return;
160
		if (actualType == TypeBinding.NULL) return;
156
161
157
		if (!(actualType instanceof ReferenceBinding)) return;
162
		if (!(actualType instanceof ReferenceBinding)) return;
Lines 186-192 Link Here
186
        		formalArguments = ((ParameterizedTypeBinding)formalEquivalent).arguments;
191
        		formalArguments = ((ParameterizedTypeBinding)formalEquivalent).arguments;
187
        		break;
192
        		break;
188
        	case Binding.RAW_TYPE :
193
        	case Binding.RAW_TYPE :
189
        		if (!inferenceContext.checkRawSubstitution()) {
194
        		if (inferenceContext.depth > 0) {
190
	           		inferenceContext.status = InferenceContext.FAILED; // marker for impossible inference
195
	           		inferenceContext.status = InferenceContext.FAILED; // marker for impossible inference
191
        		}
196
        		}
192
        		return;
197
        		return;
Lines 202-209 Link Here
202
        		actualArguments = ((ParameterizedTypeBinding)actualEquivalent).arguments;
207
        		actualArguments = ((ParameterizedTypeBinding)actualEquivalent).arguments;
203
        		break;
208
        		break;
204
        	case Binding.RAW_TYPE :
209
        	case Binding.RAW_TYPE :
205
        		if (!inferenceContext.checkRawSubstitution()) {
210
        		if (inferenceContext.depth > 0) {
206
	           		inferenceContext.status = InferenceContext.FAILED; // marker for impossible inference
211
	           		inferenceContext.status = InferenceContext.FAILED; // marker for impossible inference
212
        		} else {
213
	        		inferenceContext.isUnchecked = true;
207
        		}
214
        		}
208
        		return;
215
        		return;
209
        	default :
216
        	default :
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedMethodBinding.java (-5 / +4 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2009 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 26-32 Link Here
26
	 * Create method of parameterized type, substituting original parameters/exception/return type with type arguments.
26
	 * Create method of parameterized type, substituting original parameters/exception/return type with type arguments.
27
	 */
27
	 */
28
	public ParameterizedMethodBinding(final ParameterizedTypeBinding parameterizedDeclaringClass, MethodBinding originalMethod) {
28
	public ParameterizedMethodBinding(final ParameterizedTypeBinding parameterizedDeclaringClass, MethodBinding originalMethod) {
29
30
		super(
29
		super(
31
				originalMethod.modifiers,
30
				originalMethod.modifiers,
32
				originalMethod.selector,
31
				originalMethod.selector,
Lines 49-55 Link Here
49
			final TypeVariableBinding[] substitutedVariables = new TypeVariableBinding[length];
48
			final TypeVariableBinding[] substitutedVariables = new TypeVariableBinding[length];
50
			for (int i = 0; i < length; i++) { // copy original type variable to relocate
49
			for (int i = 0; i < length; i++) { // copy original type variable to relocate
51
				TypeVariableBinding originalVariable = originalVariables[i];
50
				TypeVariableBinding originalVariable = originalVariables[i];
52
				substitutedVariables[i] = new TypeVariableBinding(originalVariable.sourceName, this, originalVariable.rank);
51
				substitutedVariables[i] = new TypeVariableBinding(originalVariable.sourceName, this, originalVariable.rank, parameterizedDeclaringClass.environment);
53
			}
52
			}
54
			this.typeVariables = substitutedVariables;
53
			this.typeVariables = substitutedVariables;
55
54
Lines 136-142 Link Here
136
	 * This is a CODE ASSIST method ONLY.
135
	 * This is a CODE ASSIST method ONLY.
137
	 */
136
	 */
138
	public ParameterizedMethodBinding(final ReferenceBinding declaringClass, MethodBinding originalMethod, char[][] alternateParamaterNames, final LookupEnvironment environment) {
137
	public ParameterizedMethodBinding(final ReferenceBinding declaringClass, MethodBinding originalMethod, char[][] alternateParamaterNames, final LookupEnvironment environment) {
139
140
		super(
138
		super(
141
				originalMethod.modifiers,
139
				originalMethod.modifiers,
142
				originalMethod.selector,
140
				originalMethod.selector,
Lines 162-168 Link Here
162
								originalVariable.sourceName :
160
								originalVariable.sourceName :
163
								alternateParamaterNames[i],
161
								alternateParamaterNames[i],
164
							this,
162
							this,
165
							originalVariable.rank);
163
							originalVariable.rank,
164
							environment);
166
			}
165
			}
167
			this.typeVariables = substitutedVariables;
166
			this.typeVariables = substitutedVariables;
168
167
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/InvocationSite.java (-5 / +10 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
2
 * Copyright (c) 2000, 2009 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 15-28 Link Here
15
	TypeBinding[] genericTypeArguments();
15
	TypeBinding[] genericTypeArguments();
16
	boolean isSuperAccess();
16
	boolean isSuperAccess();
17
	boolean isTypeAccess();
17
	boolean isTypeAccess();
18
	void setDepth(int depth);
19
	void setFieldIndex(int depth);
20
21
	// in case the receiver type does not match the actual receiver type
18
	// in case the receiver type does not match the actual receiver type
22
	// e.g. pkg.Type.C (receiver type of C is type of source context,
19
	// e.g. pkg.Type.C (receiver type of C is type of source context,
23
	//		but actual receiver type is pkg.Type)
20
	//		but actual receiver type is pkg.Type)
24
	// e.g2. in presence of implicit access to enclosing type
21
	// e.g2. in presence of implicit access to enclosing type
25
	void setActualReceiverType(ReferenceBinding receiverType);
22
	void setActualReceiverType(ReferenceBinding receiverType);
26
	int sourceStart();
23
	void setDepth(int depth);
24
	void setFieldIndex(int depth);
25
	/**
26
	 * Positioned when a method/constructor invocation is detected having required unchecked conversion
27
	 * for becoming applicable.
28
	 * @param isUnchecked
29
	 */
30
	void setUnchecked(boolean isUnchecked);
27
	int sourceEnd();
31
	int sourceEnd();
32
	int sourceStart();
28
}
33
}
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java (-87 / +69 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2009 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 27-43 Link Here
27
    public boolean wasInferred; // only set to true for instances resulting from method invocation inferrence
27
    public boolean wasInferred; // only set to true for instances resulting from method invocation inferrence
28
    public boolean isRaw; // set to true for method behaving as raw for substitution purpose
28
    public boolean isRaw; // set to true for method behaving as raw for substitution purpose
29
    private MethodBinding tiebreakMethod;
29
    private MethodBinding tiebreakMethod;
30
    public boolean isUnchecked; // transient flag set during inference (warning: bindings are shared, so flag cannot be trusted beyond)
31
30
32
	/**
31
	/**
33
	 * Perform inference of generic method type parameters and/or expected type
32
	 * Perform inference of generic method type parameters and/or expected type
34
	 */
33
	 */
35
	public static MethodBinding computeCompatibleMethod(MethodBinding originalMethod, TypeBinding[] arguments, Scope scope, InvocationSite invocationSite) {
34
	public static MethodBinding computeCompatibleMethod(MethodBinding originalMethod, TypeBinding[] arguments, Scope scope, InvocationSite invocationSite) {
36
37
		ParameterizedGenericMethodBinding methodSubstitute;
35
		ParameterizedGenericMethodBinding methodSubstitute;
38
		TypeVariableBinding[] typeVariables = originalMethod.typeVariables;
36
		TypeVariableBinding[] typeVariables = originalMethod.typeVariables;
39
		TypeBinding[] substitutes = invocationSite.genericTypeArguments();
37
		TypeBinding[] substitutes = invocationSite.genericTypeArguments();
40
38
		TypeBinding[] uncheckedArguments = null;
41
		computeSubstitutes: {
39
		computeSubstitutes: {
42
			if (substitutes != null) {
40
			if (substitutes != null) {
43
				// explicit type arguments got supplied
41
				// explicit type arguments got supplied
Lines 48-66 Link Here
48
				methodSubstitute = scope.environment().createParameterizedGenericMethod(originalMethod, substitutes);
46
				methodSubstitute = scope.environment().createParameterizedGenericMethod(originalMethod, substitutes);
49
				break computeSubstitutes;
47
				break computeSubstitutes;
50
			}
48
			}
51
52
			// perform type argument inference (15.12.2.7)
49
			// perform type argument inference (15.12.2.7)
53
54
			// initializes the map of substitutes (var --> type[][]{ equal, extends, super}
50
			// initializes the map of substitutes (var --> type[][]{ equal, extends, super}
55
			TypeBinding[] parameters = originalMethod.parameters;
51
			TypeBinding[] parameters = originalMethod.parameters;
56
			InferenceContext inferenceContext = new InferenceContext(originalMethod);
52
			InferenceContext inferenceContext = new InferenceContext(originalMethod);
57
			methodSubstitute = inferFromArgumentTypes(scope, originalMethod, arguments, parameters, inferenceContext);
53
			methodSubstitute = inferFromArgumentTypes(scope, originalMethod, arguments, parameters, inferenceContext);
58
			if (methodSubstitute == null)
54
			if (methodSubstitute == null)
59
				return null;
55
				return null;
56
			
60
			// substitutes may hold null to denote unresolved vars, but null arguments got replaced with respective original variable in param method
57
			// substitutes may hold null to denote unresolved vars, but null arguments got replaced with respective original variable in param method
61
62
			// 15.12.2.8 - inferring unresolved type arguments
58
			// 15.12.2.8 - inferring unresolved type arguments
63
			if (inferenceContext.hasUnresolvedTypeArgument()) {
59
			if (inferenceContext.hasUnresolvedTypeArgument()) {
60
				if (inferenceContext.isUnchecked) { // only remember unchecked status post 15.12.2.7
61
					int length = inferenceContext.substitutes.length;
62
					System.arraycopy(inferenceContext.substitutes, 0, uncheckedArguments = new TypeBinding[length], 0, length);
63
				}
64
				if (methodSubstitute.returnType != TypeBinding.VOID) {
64
				if (methodSubstitute.returnType != TypeBinding.VOID) {
65
					TypeBinding expectedType = null;
65
					TypeBinding expectedType = null;
66
					// if message invocation has expected type
66
					// if message invocation has expected type
Lines 83-108 Link Here
83
		}
83
		}
84
84
85
		// bounds check
85
		// bounds check
86
		if (!methodSubstitute.isRaw) {
86
		for (int i = 0, length = typeVariables.length; i < length; i++) {
87
			for (int i = 0, length = typeVariables.length; i < length; i++) {
87
		    TypeVariableBinding typeVariable = typeVariables[i];
88
			    TypeVariableBinding typeVariable = typeVariables[i];
88
		    TypeBinding substitute = methodSubstitute.typeArguments[i];
89
			    TypeBinding substitute = methodSubstitute.typeArguments[i];
89
		    if (uncheckedArguments != null && uncheckedArguments[i] == null) continue; // only bound check if inferred through 15.12.2.6
90
				switch (typeVariable.boundCheck(methodSubstitute, substitute)) {
90
			switch (typeVariable.boundCheck(methodSubstitute, substitute)) {
91
					case TypeConstants.MISMATCH :
91
				case TypeConstants.MISMATCH :
92
				        // incompatible due to bound check
92
			        // incompatible due to bound check
93
						int argLength = arguments.length;
93
					int argLength = arguments.length;
94
						TypeBinding[] augmentedArguments = new TypeBinding[argLength + 2]; // append offending substitute and typeVariable
94
					TypeBinding[] augmentedArguments = new TypeBinding[argLength + 2]; // append offending substitute and typeVariable
95
						System.arraycopy(arguments, 0, augmentedArguments, 0, argLength);
95
					System.arraycopy(arguments, 0, augmentedArguments, 0, argLength);
96
						augmentedArguments[argLength] = substitute;
96
					augmentedArguments[argLength] = substitute;
97
						augmentedArguments[argLength+1] = typeVariable;
97
					augmentedArguments[argLength+1] = typeVariable;
98
				        return new ProblemMethodBinding(methodSubstitute, originalMethod.selector, augmentedArguments, ProblemReasons.ParameterBoundMismatch);
98
			        return new ProblemMethodBinding(methodSubstitute, originalMethod.selector, augmentedArguments, ProblemReasons.ParameterBoundMismatch);
99
					case TypeConstants.UNCHECKED :
99
				case TypeConstants.UNCHECKED :
100
						// tolerate unchecked bounds
100
					// tolerate unchecked bounds
101
						methodSubstitute.isUnchecked = true;
101
					invocationSite.setUnchecked(true);
102
						break;
102
					break;
103
				}
104
			}
103
			}
105
		}
104
		}
105
		// check presence of unchecked argument conversion a posteriori (15.12.2.6)
106
		return methodSubstitute;
106
		return methodSubstitute;
107
	}
107
	}
108
108
Lines 110-116 Link Here
110
	 * Collect argument type mapping, handling varargs
110
	 * Collect argument type mapping, handling varargs
111
	 */
111
	 */
112
	private static ParameterizedGenericMethodBinding inferFromArgumentTypes(Scope scope, MethodBinding originalMethod, TypeBinding[] arguments, TypeBinding[] parameters, InferenceContext inferenceContext) {
112
	private static ParameterizedGenericMethodBinding inferFromArgumentTypes(Scope scope, MethodBinding originalMethod, TypeBinding[] arguments, TypeBinding[] parameters, InferenceContext inferenceContext) {
113
114
		if (originalMethod.isVarargs()) {
113
		if (originalMethod.isVarargs()) {
115
			int paramLength = parameters.length;
114
			int paramLength = parameters.length;
116
			int minArgLength = paramLength - 1;
115
			int minArgLength = paramLength - 1;
Lines 152-161 Link Here
152
				if (inferenceContext.status == InferenceContext.FAILED) return null; // impossible substitution
151
				if (inferenceContext.status == InferenceContext.FAILED) return null; // impossible substitution
153
			}
152
			}
154
		}
153
		}
155
		if (inferenceContext.status == InferenceContext.RAW_SUBSTITUTION) {
156
			// raw generic method inferred
157
			return scope.environment().createParameterizedGenericMethod(originalMethod, (RawTypeBinding)null);
158
		}
159
		TypeVariableBinding[] originalVariables = originalMethod.typeVariables;
154
		TypeVariableBinding[] originalVariables = originalMethod.typeVariables;
160
		if (!resolveSubstituteConstraints(scope, originalVariables , inferenceContext, false/*ignore Ti<:Uk*/))
155
		if (!resolveSubstituteConstraints(scope, originalVariables , inferenceContext, false/*ignore Ti<:Uk*/))
161
			return null; // impossible substitution
156
			return null; // impossible substitution
Lines 261-267 Link Here
261
	 * Only invoked for non-static generic methods of raw type
256
	 * Only invoked for non-static generic methods of raw type
262
	 */
257
	 */
263
	public ParameterizedGenericMethodBinding(MethodBinding originalMethod, RawTypeBinding rawType, LookupEnvironment environment) {
258
	public ParameterizedGenericMethodBinding(MethodBinding originalMethod, RawTypeBinding rawType, LookupEnvironment environment) {
264
265
		TypeVariableBinding[] originalVariables = originalMethod.typeVariables;
259
		TypeVariableBinding[] originalVariables = originalMethod.typeVariables;
266
		int length = originalVariables.length;
260
		int length = originalVariables.length;
267
		TypeBinding[] rawArguments = new TypeBinding[length];
261
		TypeBinding[] rawArguments = new TypeBinding[length];
Lines 296-302 Link Here
296
     * Create method of parameterized type, substituting original parameters with type arguments.
290
     * Create method of parameterized type, substituting original parameters with type arguments.
297
     */
291
     */
298
	public ParameterizedGenericMethodBinding(MethodBinding originalMethod, TypeBinding[] typeArguments, LookupEnvironment environment) {
292
	public ParameterizedGenericMethodBinding(MethodBinding originalMethod, TypeBinding[] typeArguments, LookupEnvironment environment) {
299
300
	    this.environment = environment;
293
	    this.environment = environment;
301
		this.modifiers = originalMethod.modifiers;
294
		this.modifiers = originalMethod.modifiers;
302
		this.selector = originalMethod.selector;
295
		this.selector = originalMethod.selector;
Lines 307-316 Link Here
307
	    this.tagBits = originalMethod.tagBits;
300
	    this.tagBits = originalMethod.tagBits;
308
	    this.originalMethod = originalMethod;
301
	    this.originalMethod = originalMethod;
309
	    this.parameters = Scope.substitute(this, originalMethod.parameters);
302
	    this.parameters = Scope.substitute(this, originalMethod.parameters);
310
	    this.thrownExceptions = Scope.substitute(this, originalMethod.thrownExceptions);
311
	    // error case where exception type variable would have been substituted by a non-reference type (207573)
303
	    // error case where exception type variable would have been substituted by a non-reference type (207573)
312
	    if (this.thrownExceptions == null) this.thrownExceptions = Binding.NO_EXCEPTIONS;
313
	    this.returnType = Scope.substitute(this, originalMethod.returnType);
304
	    this.returnType = Scope.substitute(this, originalMethod.returnType);
305
	    this.thrownExceptions = Scope.substitute(this, originalMethod.thrownExceptions);
306
	    if (this.thrownExceptions == null) this.thrownExceptions = Binding.NO_EXCEPTIONS;
314
		checkMissingType: {
307
		checkMissingType: {
315
			if ((this.tagBits & TagBits.HasMissingType) != 0)
308
			if ((this.tagBits & TagBits.HasMissingType) != 0)
316
				break checkMissingType;
309
				break checkMissingType;
Lines 389-455 Link Here
389
	private ParameterizedGenericMethodBinding inferFromExpectedType(Scope scope, InferenceContext inferenceContext) {
382
	private ParameterizedGenericMethodBinding inferFromExpectedType(Scope scope, InferenceContext inferenceContext) {
390
	    TypeVariableBinding[] originalVariables = this.originalMethod.typeVariables; // immediate parent (could be a parameterized method)
383
	    TypeVariableBinding[] originalVariables = this.originalMethod.typeVariables; // immediate parent (could be a parameterized method)
391
		int varLength = originalVariables.length;
384
		int varLength = originalVariables.length;
392
385
	    // infer from expected return type
393
		computeSubstitutes: {
386
		if (inferenceContext.expectedType != null) {
394
		    // infer from expected return type
387
		    this.returnType.collectSubstitutes(scope, inferenceContext.expectedType, inferenceContext, TypeConstants.CONSTRAINT_SUPER);
395
			if (inferenceContext.expectedType != null) {
388
		    if (inferenceContext.status == InferenceContext.FAILED) return null; // impossible substitution
396
			    this.returnType.collectSubstitutes(scope, inferenceContext.expectedType, inferenceContext, TypeConstants.CONSTRAINT_SUPER);
389
		}
397
			    if (inferenceContext.status == InferenceContext.FAILED) return null; // impossible substitution
390
	    // infer from bounds of type parameters
398
			}
391
		for (int i = 0; i < varLength; i++) {
399
		    // infer from bounds of type parameters
392
			TypeVariableBinding originalVariable = originalVariables[i];
400
			for (int i = 0; i < varLength; i++) {
393
			TypeBinding argument = this.typeArguments[i];
401
				TypeVariableBinding originalVariable = originalVariables[i];
394
			boolean argAlreadyInferred = argument != originalVariable;
402
				TypeBinding argument = this.typeArguments[i];
395
			if (originalVariable.firstBound == originalVariable.superclass) {
403
				boolean argAlreadyInferred = argument != originalVariable;
396
				TypeBinding substitutedBound = Scope.substitute(this, originalVariable.superclass);
404
				if (originalVariable.firstBound == originalVariable.superclass) {
397
				argument.collectSubstitutes(scope, substitutedBound, inferenceContext, TypeConstants.CONSTRAINT_SUPER);
405
					TypeBinding substitutedBound = Scope.substitute(this, originalVariable.superclass);
398
				if (inferenceContext.status == InferenceContext.FAILED) return null; // impossible substitution
406
					argument.collectSubstitutes(scope, substitutedBound, inferenceContext, TypeConstants.CONSTRAINT_SUPER);
399
				// JLS 15.12.2.8 claims reverse inference shouldn't occur, however it improves inference
400
				// e.g. given: <E extends Object, S extends Collection<E>> S test1(S param)
401
				//                   invocation: test1(new Vector<String>())    will infer: S=Vector<String>  and with code below: E=String
402
				if (argAlreadyInferred) {
403
					substitutedBound.collectSubstitutes(scope, argument, inferenceContext, TypeConstants.CONSTRAINT_EXTENDS);
407
					if (inferenceContext.status == InferenceContext.FAILED) return null; // impossible substitution
404
					if (inferenceContext.status == InferenceContext.FAILED) return null; // impossible substitution
408
					// JLS 15.12.2.8 claims reverse inference shouldn't occur, however it improves inference
409
					// e.g. given: <E extends Object, S extends Collection<E>> S test1(S param)
410
					//                   invocation: test1(new Vector<String>())    will infer: S=Vector<String>  and with code below: E=String
411
					if (argAlreadyInferred) {
412
						substitutedBound.collectSubstitutes(scope, argument, inferenceContext, TypeConstants.CONSTRAINT_EXTENDS);
413
						if (inferenceContext.status == InferenceContext.FAILED) return null; // impossible substitution
414
					}
415
				}
405
				}
416
				for (int j = 0, max = originalVariable.superInterfaces.length; j < max; j++) {
406
			}
417
					TypeBinding substitutedBound = Scope.substitute(this, originalVariable.superInterfaces[j]);
407
			for (int j = 0, max = originalVariable.superInterfaces.length; j < max; j++) {
418
					argument.collectSubstitutes(scope, substitutedBound, inferenceContext, TypeConstants.CONSTRAINT_SUPER);
408
				TypeBinding substitutedBound = Scope.substitute(this, originalVariable.superInterfaces[j]);
409
				argument.collectSubstitutes(scope, substitutedBound, inferenceContext, TypeConstants.CONSTRAINT_SUPER);
410
				if (inferenceContext.status == InferenceContext.FAILED) return null; // impossible substitution
411
				// JLS 15.12.2.8 claims reverse inference shouldn't occur, however it improves inference
412
				if (argAlreadyInferred) {
413
					substitutedBound.collectSubstitutes(scope, argument, inferenceContext, TypeConstants.CONSTRAINT_EXTENDS);
419
					if (inferenceContext.status == InferenceContext.FAILED) return null; // impossible substitution
414
					if (inferenceContext.status == InferenceContext.FAILED) return null; // impossible substitution
420
					// JLS 15.12.2.8 claims reverse inference shouldn't occur, however it improves inference
421
					if (argAlreadyInferred) {
422
						substitutedBound.collectSubstitutes(scope, argument, inferenceContext, TypeConstants.CONSTRAINT_EXTENDS);
423
						if (inferenceContext.status == InferenceContext.FAILED) return null; // impossible substitution
424
					}
425
				}
415
				}
426
			}
416
			}
427
			if (inferenceContext.status == InferenceContext.RAW_SUBSTITUTION) {
428
		    	// raw generic method inferred
429
		    	this.isRaw = true;
430
				this.isUnchecked = false;
431
		    	for (int i = 0; i < varLength; i++) {
432
		    		this.typeArguments[i] = originalVariables[i].upperBound();
433
		    	}
434
		    	break computeSubstitutes;
435
			}
436
			if (!resolveSubstituteConstraints(scope, originalVariables, inferenceContext, true/*consider Ti<:Uk*/))
437
				return null; // incompatible
438
			// this.typeArguments = substitutes; - no op since side effects got performed during #resolveSubstituteConstraints
439
	    	for (int i = 0; i < varLength; i++) {
440
	    		TypeBinding substitute = inferenceContext.substitutes[i];
441
	    		if (substitute != null) {
442
	    			this.typeArguments[i] = inferenceContext.substitutes[i];
443
	    		} else {
444
	    			// remaining unresolved variable are considered to be Object (or their bound actually)
445
		    		this.typeArguments[i] = originalVariables[i].upperBound();
446
		    	}
447
	    	}
448
		}
417
		}
418
		if (!resolveSubstituteConstraints(scope, originalVariables, inferenceContext, true/*consider Ti<:Uk*/))
419
			return null; // incompatible
420
		// this.typeArguments = substitutes; - no op since side effects got performed during #resolveSubstituteConstraints
421
    	for (int i = 0; i < varLength; i++) {
422
    		TypeBinding substitute = inferenceContext.substitutes[i];
423
    		if (substitute != null) {
424
    			this.typeArguments[i] = inferenceContext.substitutes[i];
425
    		} else {
426
    			// remaining unresolved variable are considered to be Object (or their bound actually)
427
	    		this.typeArguments[i] = originalVariables[i].upperBound();
428
	    	}
429
    	}
449
		// may still need an extra substitution at the end (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=121369)
430
		// may still need an extra substitution at the end (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=121369)
450
		// to properly substitute a remaining unresolved variable which also appear in a formal bound
431
		// to properly substitute a remaining unresolved variable which also appear in a formal bound
451
		this.typeArguments = Scope.substitute(this, this.typeArguments);
432
    	this.typeArguments = Scope.substitute(this, this.typeArguments);
452
		// adjust method types to reflect latest inference
433
434
    	// adjust method types to reflect latest inference
453
		TypeBinding oldReturnType = this.returnType;
435
		TypeBinding oldReturnType = this.returnType;
454
		this.returnType = Scope.substitute(this, this.returnType);
436
		this.returnType = Scope.substitute(this, this.returnType);
455
		this.inferredReturnType = inferenceContext.hasExplicitExpectedType && this.returnType != oldReturnType;
437
		this.inferredReturnType = inferenceContext.hasExplicitExpectedType && this.returnType != oldReturnType;
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/CaptureBinding.java (-2 / +2 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2009 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 25-31 Link Here
25
	public int position;
25
	public int position;
26
26
27
	public CaptureBinding(WildcardBinding wildcard, ReferenceBinding sourceType, int position, int captureID) {
27
	public CaptureBinding(WildcardBinding wildcard, ReferenceBinding sourceType, int position, int captureID) {
28
		super(TypeConstants.WILDCARD_CAPTURE_NAME_PREFIX, null, 0);
28
		super(TypeConstants.WILDCARD_CAPTURE_NAME_PREFIX, null, 0, wildcard.environment);
29
		this.wildcard = wildcard;
29
		this.wildcard = wildcard;
30
		this.modifiers = ClassFileConstants.AccPublic | ExtraCompilerModifiers.AccGenericSignature; // treat capture as public
30
		this.modifiers = ClassFileConstants.AccPublic | ExtraCompilerModifiers.AccGenericSignature; // treat capture as public
31
		this.fPackage = wildcard.fPackage;
31
		this.fPackage = wildcard.fPackage;
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java (-6 / +6 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2009 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 114-120 Link Here
114
			break;
114
			break;
115
115
116
		case Binding.TYPE_PARAMETER :
116
		case Binding.TYPE_PARAMETER :
117
			((TypeVariableBinding) type).resolve(environment);
117
			((TypeVariableBinding) type).resolve();
118
			break;
118
			break;
119
119
120
		case Binding.GENERIC_TYPE :
120
		case Binding.GENERIC_TYPE :
Lines 606-612 Link Here
606
						pendingVariable = false;
606
						pendingVariable = false;
607
						int colon = CharOperation.indexOf(':', typeSignature, i);
607
						int colon = CharOperation.indexOf(':', typeSignature, i);
608
						char[] variableName = CharOperation.subarray(typeSignature, i, colon);
608
						char[] variableName = CharOperation.subarray(typeSignature, i, colon);
609
						variables.add(new TypeVariableBinding(variableName, this, rank++));
609
						variables.add(new TypeVariableBinding(variableName, this, rank++, this.environment));
610
					}
610
					}
611
			}
611
			}
612
		}
612
		}
Lines 807-813 Link Here
807
// NOTE: member types of binary types are resolved when needed
807
// NOTE: member types of binary types are resolved when needed
808
public TypeVariableBinding getTypeVariable(char[] variableName) {
808
public TypeVariableBinding getTypeVariable(char[] variableName) {
809
	TypeVariableBinding variable = super.getTypeVariable(variableName);
809
	TypeVariableBinding variable = super.getTypeVariable(variableName);
810
	variable.resolve(this.environment);
810
	variable.resolve();
811
	return variable;
811
	return variable;
812
}
812
}
813
private void initializeTypeVariable(TypeVariableBinding variable, TypeVariableBinding[] existingVariables, SignatureWrapper wrapper, char[][][] missingTypeNames) {
813
private void initializeTypeVariable(TypeVariableBinding variable, TypeVariableBinding[] existingVariables, SignatureWrapper wrapper, char[][][] missingTypeNames) {
Lines 934-940 Link Here
934
		}
934
		}
935
	}
935
	}
936
	for (int i = method.typeVariables.length; --i >= 0;) {
936
	for (int i = method.typeVariables.length; --i >= 0;) {
937
		method.typeVariables[i].resolve(this.environment);
937
		method.typeVariables[i].resolve();
938
	}
938
	}
939
	method.modifiers &= ~ExtraCompilerModifiers.AccUnresolved;
939
	method.modifiers &= ~ExtraCompilerModifiers.AccUnresolved;
940
	return method;
940
	return method;
Lines 983-989 Link Here
983
		return this.typeVariables;
983
		return this.typeVariables;
984
984
985
 	for (int i = this.typeVariables.length; --i >= 0;)
985
 	for (int i = this.typeVariables.length; --i >= 0;)
986
		this.typeVariables[i].resolve(this.environment);
986
		this.typeVariables[i].resolve();
987
	this.tagBits &= ~TagBits.HasUnresolvedTypeVariables;
987
	this.tagBits &= ~TagBits.HasUnresolvedTypeVariables;
988
	return this.typeVariables;
988
	return this.typeVariables;
989
}
989
}
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java (-21 / +149 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2009 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 45-50 Link Here
45
	public int kind;
45
	public int kind;
46
	public Scope parent;
46
	public Scope parent;
47
47
48
	protected Scope(int kind, Scope parent) {
49
		this.kind = kind;
50
		this.parent = parent;
51
	}
52
48
	/* Answer an int describing the relationship between the given types.
53
	/* Answer an int describing the relationship between the given types.
49
	*
54
	*
50
	* 		NOT_RELATED
55
	* 		NOT_RELATED
Lines 59-65 Link Here
59
		return Scope.NOT_RELATED;
64
		return Scope.NOT_RELATED;
60
	}
65
	}
61
66
62
	public static TypeBinding getBaseType(char[] name) {
67
	/**
68
	 * Returns a type where either all variables or specific ones got discarded.
69
	 * e.g. List<E> (discarding <E extends Enum<E>) will return:  List<? extends Enum<?>>
70
	 */
71
	public static TypeBinding convertEliminatingTypeVariables(TypeBinding originalType, ReferenceBinding genericType, int rank, Set eliminatedVariables) {
72
		if ((originalType.tagBits & TagBits.HasTypeVariable) != 0) {
73
			switch (originalType.kind()) {
74
				case Binding.ARRAY_TYPE :
75
					ArrayBinding originalArrayType = (ArrayBinding) originalType;
76
					TypeBinding originalLeafComponentType = originalArrayType.leafComponentType;
77
					TypeBinding substitute = convertEliminatingTypeVariables(originalLeafComponentType, genericType, rank, eliminatedVariables); // substitute could itself be array type
78
					if (substitute != originalLeafComponentType) {
79
						return originalArrayType.environment.createArrayType(substitute.leafComponentType(), substitute.dimensions() + originalArrayType.dimensions());
80
					}
81
					break;
82
				case Binding.PARAMETERIZED_TYPE :
83
					ParameterizedTypeBinding paramType = (ParameterizedTypeBinding) originalType;
84
					ReferenceBinding originalEnclosing = paramType.enclosingType();
85
					ReferenceBinding substitutedEnclosing = originalEnclosing;
86
					if (originalEnclosing != null) {
87
						substitutedEnclosing = (ReferenceBinding) convertEliminatingTypeVariables(originalEnclosing, genericType, rank, eliminatedVariables);
88
					}
89
					TypeBinding[] originalArguments = paramType.arguments;
90
					TypeBinding[] substitutedArguments = originalArguments;
91
					for (int i = 0, length = originalArguments == null ? 0 : originalArguments.length; i < length; i++) {
92
						TypeBinding originalArgument = originalArguments[i];
93
						TypeBinding substitutedArgument = convertEliminatingTypeVariables(originalArgument, paramType.genericType(), i, eliminatedVariables);
94
						if (substitutedArgument != originalArgument) {
95
							if (substitutedArguments == originalArguments) {
96
								System.arraycopy(originalArguments, 0, substitutedArguments = new TypeBinding[length], 0, i);
97
							}
98
							substitutedArguments[i] = substitutedArgument;
99
						} else 	if (substitutedArguments != originalArguments) {
100
							substitutedArguments[i] = originalArgument;
101
						}
102
					}
103
					if (originalEnclosing != substitutedEnclosing || originalArguments != substitutedArguments) {
104
						return paramType.environment.createParameterizedType(paramType.genericType(), substitutedArguments, substitutedEnclosing);
105
					}
106
					break;
107
				case Binding.TYPE_PARAMETER :
108
					if (genericType == null) {
109
						break;
110
					}
111
					TypeVariableBinding originalVariable = (TypeVariableBinding) originalType;
112
					if (eliminatedVariables != null && eliminatedVariables.contains(originalType)) {
113
						return originalVariable.environment.createWildcard(genericType, rank, null, null, Wildcard.UNBOUND);
114
					}
115
					TypeBinding originalUpperBound = originalVariable.upperBound();
116
					if (eliminatedVariables == null) {
117
						eliminatedVariables = new HashSet(2);
118
					}
119
					eliminatedVariables.add(originalVariable);
120
					TypeBinding substitutedUpperBound = convertEliminatingTypeVariables(originalUpperBound, genericType, rank, eliminatedVariables);
121
					eliminatedVariables.remove(originalVariable);
122
					return originalVariable.environment.createWildcard(genericType, rank, substitutedUpperBound, null, Wildcard.EXTENDS);
123
				case Binding.RAW_TYPE :
124
					break;
125
				case Binding.GENERIC_TYPE :
126
					ReferenceBinding currentType = (ReferenceBinding) originalType;
127
					originalEnclosing = currentType.enclosingType();
128
					substitutedEnclosing = originalEnclosing;
129
					if (originalEnclosing != null) {
130
						substitutedEnclosing = (ReferenceBinding) convertEliminatingTypeVariables(originalEnclosing, genericType, rank, eliminatedVariables);
131
					}
132
					originalArguments = currentType.typeVariables();
133
					substitutedArguments = originalArguments;
134
					for (int i = 0, length = originalArguments == null ? 0 : originalArguments.length; i < length; i++) {
135
						TypeBinding originalArgument = originalArguments[i];
136
						TypeBinding substitutedArgument = convertEliminatingTypeVariables(originalArgument, currentType, i, eliminatedVariables);
137
						if (substitutedArgument != originalArgument) {
138
							if (substitutedArguments == originalArguments) {
139
								System.arraycopy(originalArguments, 0, substitutedArguments = new TypeBinding[length], 0, i);
140
							}
141
							substitutedArguments[i] = substitutedArgument;
142
						} else 	if (substitutedArguments != originalArguments) {
143
							substitutedArguments[i] = originalArgument;
144
						}
145
					}
146
					if (originalEnclosing != substitutedEnclosing || originalArguments != substitutedArguments) {
147
						return ((TypeVariableBinding)originalArguments[0]).environment.createParameterizedType(genericType, substitutedArguments, substitutedEnclosing);
148
					}
149
					break;
150
				case Binding.WILDCARD_TYPE :
151
					WildcardBinding wildcard = (WildcardBinding) originalType;
152
					TypeBinding originalBound = wildcard.bound;
153
					TypeBinding substitutedBound = originalBound;
154
					if (originalBound != null) {
155
						substitutedBound = convertEliminatingTypeVariables(originalBound, genericType, rank, eliminatedVariables);
156
						if (substitutedBound != originalBound) {
157
							return wildcard.environment.createWildcard(wildcard.genericType, wildcard.rank, substitutedBound, null, wildcard.boundKind);
158
						}
159
					}
160
					break;
161
				case Binding.INTERSECTION_TYPE :
162
					WildcardBinding intersection = (WildcardBinding) originalType;
163
					originalBound = intersection.bound;
164
					substitutedBound = originalBound;
165
					if (originalBound != null) {
166
						substitutedBound = convertEliminatingTypeVariables(originalBound, genericType, rank, eliminatedVariables);
167
					}
168
					TypeBinding[] originalOtherBounds = intersection.otherBounds;
169
					TypeBinding[] substitutedOtherBounds = originalOtherBounds;
170
					for (int i = 0, length = originalOtherBounds == null ? 0 : originalOtherBounds.length; i < length; i++) {
171
						TypeBinding originalOtherBound = originalOtherBounds[i];
172
						TypeBinding substitutedOtherBound = convertEliminatingTypeVariables(originalOtherBound, genericType, rank, eliminatedVariables);
173
						if (substitutedOtherBound != originalOtherBound) {
174
							if (substitutedOtherBounds == originalOtherBounds) {
175
								System.arraycopy(originalOtherBounds, 0, substitutedOtherBounds = new TypeBinding[length], 0, i);
176
							}
177
							substitutedOtherBounds[i] = substitutedOtherBound;
178
						} else 	if (substitutedOtherBounds != originalOtherBounds) {
179
							substitutedOtherBounds[i] = originalOtherBound;
180
						}
181
					}
182
					if (substitutedBound != originalBound || substitutedOtherBounds != originalOtherBounds) {
183
						return intersection.environment.createWildcard(intersection.genericType, intersection.rank, substitutedBound, substitutedOtherBounds, intersection.boundKind);
184
					}
185
					break;
186
				}
187
		}
188
		return originalType;
189
	}	
190
191
   public static TypeBinding getBaseType(char[] name) {
63
		// list should be optimized (with most often used first)
192
		// list should be optimized (with most often used first)
64
		int length = name.length;
193
		int length = name.length;
65
		if (length > 2 && length < 8) {
194
		if (length > 2 && length < 8) {
Lines 121-127 Link Here
121
		return null;
250
		return null;
122
	}
251
	}
123
252
124
   // 5.1.10
253
	// 5.1.10
125
	public static ReferenceBinding[] greaterLowerBound(ReferenceBinding[] types) {
254
	public static ReferenceBinding[] greaterLowerBound(ReferenceBinding[] types) {
126
		if (types == null) return null;
255
		if (types == null) return null;
127
		int length = types.length;
256
		int length = types.length;
Lines 335-345 Link Here
335
	    return substitutedTypes;
464
	    return substitutedTypes;
336
	}
465
	}
337
466
338
	protected Scope(int kind, Scope parent) {
339
		this.kind = kind;
340
		this.parent = parent;
341
	}
342
343
	/*
467
	/*
344
	 * Boxing primitive
468
	 * Boxing primitive
345
	 */
469
	 */
Lines 587-593 Link Here
587
		int count = 0;
711
		int count = 0;
588
		for (int i = 0; i < length; i++) {
712
		for (int i = 0; i < length; i++) {
589
			TypeParameter typeParameter = typeParameters[i];
713
			TypeParameter typeParameter = typeParameters[i];
590
			TypeVariableBinding parameterBinding = new TypeVariableBinding(typeParameter.name, declaringElement, i);
714
			TypeVariableBinding parameterBinding = new TypeVariableBinding(typeParameter.name, declaringElement, i, environment());
591
			parameterBinding.fPackage = unitPackage;
715
			parameterBinding.fPackage = unitPackage;
592
			typeParameter.binding = parameterBinding;
716
			typeParameter.binding = parameterBinding;
593
717
Lines 2665-2686 Link Here
2665
						// <T extends X<Object>> void foo(T t) {}
2789
						// <T extends X<Object>> void foo(T t) {}
2666
						// foo(T) will show up as foo(Y#RAW) and not foo(X#RAW)
2790
						// foo(T) will show up as foo(Y#RAW) and not foo(X#RAW)
2667
						// Y#RAW is not more specific than a rawified X<T>
2791
						// Y#RAW is not more specific than a rawified X<T>
2668
						if (oneParam == one.original().parameters[i]
2792
						TypeBinding originalOneParam = one.original().parameters[i].leafComponentType();
2669
								&&  twoParam.leafComponentType().erasure() != two.original().parameters[i].leafComponentType().erasure()) {
2793
						if ((originalOneParam.isTypeVariable() ? ((TypeVariableBinding) originalOneParam).upperBound()
2670
							return false;
2794
								: originalOneParam).isRawType())
2671
						}
2795
							if (twoParam.leafComponentType().erasure() != two.original().parameters[i]
2796
									.leafComponentType().erasure())
2797
								return false;
2672
					}
2798
					}
2673
				} else if (oneParam.isCompatibleWith(twoParam)) {
2799
				} else if (oneParam.isCompatibleWith(twoParam)) {
2674
					if (oneParam.leafComponentType().isRawType()) {
2800
					if (oneParam.leafComponentType().isRawType()) {
2675
						// A#RAW is not more specific than a rawified A<T>
2801
						if (oneParam.needsUncheckedConversion(twoParam))
2676
						if (oneParam.needsUncheckedConversion(two.declaringClass.isRawType() ? twoParam : two.original().parameters[i]))
2802
							if (oneParam.leafComponentType().erasure() != twoParam.leafComponentType().erasure())
2677
							return false;
2803
								return false;
2678
					}
2804
					}
2679
				} else {
2805
				} else {
2680
					if (i == oneParamsLength - 1 && one.isVarargs() && two.isVarargs()) {
2806
					if (i == oneParamsLength - 1 && one.isVarargs() && two.isVarargs()) {
2681
						TypeBinding eType = ((ArrayBinding) twoParam).elementsType();
2807
						TypeBinding eType = ((ArrayBinding) twoParam).elementsType();
2682
						if (oneParam == eType || oneParam.isCompatibleWith(eType))
2808
						if (oneParam == eType || oneParam.isCompatibleWith(eType))
2683
							return true; // special case to choose between 2 varargs methods when the last arg is Object[]
2809
							return true; // special case to choose between 2 varargs methods when the last arg is
2810
											// Object[]
2684
					}
2811
					}
2685
					return false;
2812
					return false;
2686
				}
2813
				}
Lines 2690-2696 Link Here
2690
2817
2691
		if (one.isVarargs() && two.isVarargs()) {
2818
		if (one.isVarargs() && two.isVarargs()) {
2692
			if (oneParamsLength > twoParamsLength) {
2819
			if (oneParamsLength > twoParamsLength) {
2693
				// special case when autoboxing makes (int, int...) better than (Object...) but not (int...) or (Integer, int...)
2820
				// special case when autoboxing makes (int, int...) better than (Object...) but not (int...) or
2821
				// (Integer, int...)
2694
				if (((ArrayBinding) twoParams[twoParamsLength - 1]).elementsType().id != TypeIds.T_JavaLangObject)
2822
				if (((ArrayBinding) twoParams[twoParamsLength - 1]).elementsType().id != TypeIds.T_JavaLangObject)
2695
					return false;
2823
					return false;
2696
			}
2824
			}
Lines 2699-2710 Link Here
2699
				if (oneParams[i] != twoParams[i] && !oneParams[i].isCompatibleWith(twoParams[i]))
2827
				if (oneParams[i] != twoParams[i] && !oneParams[i].isCompatibleWith(twoParams[i]))
2700
					return false;
2828
					return false;
2701
			if (parameterCompatibilityLevel(one, twoParams) == NOT_COMPATIBLE
2829
			if (parameterCompatibilityLevel(one, twoParams) == NOT_COMPATIBLE
2702
				&& parameterCompatibilityLevel(two, oneParams) == VARARGS_COMPATIBLE)
2830
					&& parameterCompatibilityLevel(two, oneParams) == VARARGS_COMPATIBLE)
2703
					return true;
2831
				return true;
2704
		}
2832
		}
2705
		return false;
2833
		return false;
2706
	}
2834
	}
2707
2835
	
2708
	public boolean isBoxingCompatibleWith(TypeBinding expressionType, TypeBinding targetType) {
2836
	public boolean isBoxingCompatibleWith(TypeBinding expressionType, TypeBinding targetType) {
2709
		LookupEnvironment environment = environment();
2837
		LookupEnvironment environment = environment();
2710
		if (environment.globalOptions.sourceLevel < ClassFileConstants.JDK1_5 || expressionType.isBaseType() == targetType.isBaseType())
2838
		if (environment.globalOptions.sourceLevel < ClassFileConstants.JDK1_5 || expressionType.isBaseType() == targetType.isBaseType())
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java (-22 / +22 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
2
 * Copyright (c) 2000, 2009 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 32-53 Link Here
32
	public ReferenceBinding superclass;
32
	public ReferenceBinding superclass;
33
	public ReferenceBinding[] superInterfaces;
33
	public ReferenceBinding[] superInterfaces;
34
	public char[] genericTypeSignature;
34
	public char[] genericTypeSignature;
35
35
	LookupEnvironment environment;
36
	public TypeVariableBinding(char[] sourceName, Binding declaringElement, int rank) {
36
	
37
	public TypeVariableBinding(char[] sourceName, Binding declaringElement, int rank, LookupEnvironment environment) {
37
		this.sourceName = sourceName;
38
		this.sourceName = sourceName;
38
		this.declaringElement = declaringElement;
39
		this.declaringElement = declaringElement;
39
		this.rank = rank;
40
		this.rank = rank;
40
		this.modifiers = ClassFileConstants.AccPublic | ExtraCompilerModifiers.AccGenericSignature; // treat type var as public
41
		this.modifiers = ClassFileConstants.AccPublic | ExtraCompilerModifiers.AccGenericSignature; // treat type var as public
41
		this.tagBits |= TagBits.HasTypeVariable;
42
		this.tagBits |= TagBits.HasTypeVariable;
43
		this.environment = environment;
42
	}
44
	}
43
45
44
	/**
46
	/**
45
	 * Returns true if the argument type satisfies all bounds of the type parameter
47
	 * Returns true if the argument type satisfies all bounds of the type parameter
46
	 */
48
	 */
47
	public int boundCheck(Substitution substitution, TypeBinding argumentType) {
49
	public int boundCheck(Substitution substitution, TypeBinding argumentType) {
48
50
		if (argumentType == TypeBinding.NULL || argumentType == this) {
49
		if (argumentType == TypeBinding.NULL || argumentType == this)
50
			return TypeConstants.OK;
51
			return TypeConstants.OK;
52
		}
51
		boolean hasSubstitution = substitution != null;
53
		boolean hasSubstitution = substitution != null;
52
		if (!(argumentType instanceof ReferenceBinding || argumentType.isArrayType()))
54
		if (!(argumentType instanceof ReferenceBinding || argumentType.isArrayType()))
53
			return TypeConstants.MISMATCH;
55
			return TypeConstants.MISMATCH;
Lines 63-89 Link Here
63
					TypeBinding wildcardBound = wildcard.bound;
65
					TypeBinding wildcardBound = wildcard.bound;
64
					if (wildcardBound == this)
66
					if (wildcardBound == this)
65
						return TypeConstants.OK;
67
						return TypeConstants.OK;
66
					ReferenceBinding superclassBound = hasSubstitution ? (ReferenceBinding)Scope.substitute(substitution, this.superclass) : this.superclass;
67
					boolean isArrayBound = wildcardBound.isArrayType();
68
					boolean isArrayBound = wildcardBound.isArrayType();
68
					if (!wildcardBound.isInterface()) {
69
					if (!wildcardBound.isInterface()) {
69
						if (superclassBound.id != TypeIds.T_JavaLangObject) {
70
						TypeBinding substitutedSuperType = hasSubstitution ? Scope.substitute(substitution, this.superclass) : this.superclass;
71
						if (substitutedSuperType.id != TypeIds.T_JavaLangObject) {
70
							if (isArrayBound) {
72
							if (isArrayBound) {
71
								if (!wildcardBound.isCompatibleWith(superclassBound))
73
								if (!wildcardBound.isCompatibleWith(substitutedSuperType))
72
									return TypeConstants.MISMATCH;
74
									return TypeConstants.MISMATCH;
73
							} else {
75
							} else {
74
								TypeBinding match = wildcardBound.findSuperTypeOriginatingFrom(superclassBound);
76
								TypeBinding match = wildcardBound.findSuperTypeOriginatingFrom(substitutedSuperType);
75
								if (match != null) {
77
								if (match != null) {
76
									if (superclassBound.isProvablyDistinct(match)) {
78
									if (substitutedSuperType.isProvablyDistinct(match)) {
77
										return TypeConstants.MISMATCH;
79
										return TypeConstants.MISMATCH;
78
									}
80
									}
79
								} else {
81
								} else {
80
									match =  superclassBound.findSuperTypeOriginatingFrom(wildcardBound);
82
									match =  substitutedSuperType.findSuperTypeOriginatingFrom(wildcardBound);
81
									if (match != null) {
83
									if (match != null) {
82
										if (match.isProvablyDistinct(wildcardBound)) {
84
										if (match.isProvablyDistinct(wildcardBound)) {
83
											return TypeConstants.MISMATCH;
85
											return TypeConstants.MISMATCH;
84
										}
86
										}
85
									} else {
87
									} else {
86
										if (!wildcardBound.isTypeVariable() && !superclassBound.isTypeVariable()) {
88
										if (!wildcardBound.isTypeVariable() && !substitutedSuperType.isTypeVariable()) {
87
											return TypeConstants.MISMATCH;
89
											return TypeConstants.MISMATCH;
88
										}
90
										}
89
									}
91
									}
Lines 91-108 Link Here
91
							}
93
							}
92
						}
94
						}
93
					}
95
					}
94
					ReferenceBinding[] superInterfaceBounds = hasSubstitution ? Scope.substitute(substitution, this.superInterfaces) : this.superInterfaces;
95
					int length = superInterfaceBounds.length;
96
					boolean mustImplement = isArrayBound || ((ReferenceBinding)wildcardBound).isFinal();
96
					boolean mustImplement = isArrayBound || ((ReferenceBinding)wildcardBound).isFinal();
97
					for (int i = 0; i < length; i++) {
97
					for (int i = 0, length = this.superInterfaces.length; i < length; i++) {
98
						TypeBinding superInterfaceBound = superInterfaceBounds[i];
98
						TypeBinding substitutedSuperType = hasSubstitution ? Scope.substitute(substitution, this.superInterfaces[i]) : this.superInterfaces[i];
99
						if (isArrayBound) {
99
						if (isArrayBound) {
100
							if (!wildcardBound.isCompatibleWith(superInterfaceBound))
100
							if (!wildcardBound.isCompatibleWith(substitutedSuperType))
101
									return TypeConstants.MISMATCH;
101
									return TypeConstants.MISMATCH;
102
						} else {
102
						} else {
103
							TypeBinding match = wildcardBound.findSuperTypeOriginatingFrom(superInterfaceBound);
103
							TypeBinding match = wildcardBound.findSuperTypeOriginatingFrom(substitutedSuperType);
104
							if (match != null) {
104
							if (match != null) {
105
								if (superInterfaceBound.isProvablyDistinct(match)) {
105
								if (substitutedSuperType.isProvablyDistinct(match)) {
106
									return TypeConstants.MISMATCH;
106
									return TypeConstants.MISMATCH;
107
								}
107
								}
108
							} else if (mustImplement) {
108
							} else if (mustImplement) {
Lines 380-398 Link Here
380
    public char[] readableName() {
380
    public char[] readableName() {
381
        return this.sourceName;
381
        return this.sourceName;
382
    }
382
    }
383
	ReferenceBinding resolve(LookupEnvironment environment) {
383
	ReferenceBinding resolve() {
384
		if ((this.modifiers & ExtraCompilerModifiers.AccUnresolved) == 0)
384
		if ((this.modifiers & ExtraCompilerModifiers.AccUnresolved) == 0)
385
			return this;
385
			return this;
386
386
387
		TypeBinding oldSuperclass = this.superclass, oldFirstInterface = null;
387
		TypeBinding oldSuperclass = this.superclass, oldFirstInterface = null;
388
		if (this.superclass != null)
388
		if (this.superclass != null)
389
			this.superclass = (ReferenceBinding) BinaryTypeBinding.resolveType(this.superclass, environment, true /* raw conversion */);
389
			this.superclass = (ReferenceBinding) BinaryTypeBinding.resolveType(this.superclass, this.environment, true /* raw conversion */);
390
		ReferenceBinding[] interfaces = this.superInterfaces;
390
		ReferenceBinding[] interfaces = this.superInterfaces;
391
		int length;
391
		int length;
392
		if ((length = interfaces.length) != 0) {
392
		if ((length = interfaces.length) != 0) {
393
			oldFirstInterface = interfaces[0];
393
			oldFirstInterface = interfaces[0];
394
			for (int i = length; --i >= 0;) {
394
			for (int i = length; --i >= 0;) {
395
				interfaces[i] = (ReferenceBinding) BinaryTypeBinding.resolveType(interfaces[i], environment, true /* raw conversion */);
395
				interfaces[i] = (ReferenceBinding) BinaryTypeBinding.resolveType(interfaces[i], this.environment, true /* raw conversion */);
396
			}
396
			}
397
		}
397
		}
398
		// refresh the firstBound in case it changed
398
		// refresh the firstBound in case it changed
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java (-123 / +25 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2009 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 11-19 Link Here
11
package org.eclipse.jdt.internal.compiler.lookup;
11
package org.eclipse.jdt.internal.compiler.lookup;
12
12
13
import java.util.HashMap;
13
import java.util.HashMap;
14
import java.util.HashSet;
15
import java.util.Map;
14
import java.util.Map;
16
import java.util.Set;
17
15
18
import org.eclipse.jdt.core.compiler.CharOperation;
16
import org.eclipse.jdt.core.compiler.CharOperation;
19
import org.eclipse.jdt.internal.compiler.ClassFilePool;
17
import org.eclipse.jdt.internal.compiler.ClassFilePool;
Lines 386-508 Link Here
386
	return packageBinding;
384
	return packageBinding;
387
}
385
}
388
386
389
public TypeBinding convertEliminatingTypeVariables(TypeBinding originalType, ReferenceBinding genericType, int rank, Set eliminatedVariables) {
390
	if ((originalType.tagBits & TagBits.HasTypeVariable) != 0) {
391
		switch (originalType.kind()) {
392
			case Binding.ARRAY_TYPE :
393
				ArrayBinding originalArrayType = (ArrayBinding) originalType;
394
				TypeBinding originalLeafComponentType = originalArrayType.leafComponentType;
395
				TypeBinding substitute = convertEliminatingTypeVariables(originalLeafComponentType, genericType, rank, eliminatedVariables); // substitute could itself be array type
396
				if (substitute != originalLeafComponentType) {
397
					return createArrayType(substitute.leafComponentType(), substitute.dimensions() + originalArrayType.dimensions());
398
				}
399
				break;
400
			case Binding.PARAMETERIZED_TYPE :
401
				ParameterizedTypeBinding paramType = (ParameterizedTypeBinding) originalType;
402
				ReferenceBinding originalEnclosing = paramType.enclosingType();
403
				ReferenceBinding substitutedEnclosing = originalEnclosing;
404
				if (originalEnclosing != null) {
405
					substitutedEnclosing = (ReferenceBinding) convertEliminatingTypeVariables(originalEnclosing, genericType, rank, eliminatedVariables);
406
				}
407
				TypeBinding[] originalArguments = paramType.arguments;
408
				TypeBinding[] substitutedArguments = originalArguments;
409
				for (int i = 0, length = originalArguments == null ? 0 : originalArguments.length; i < length; i++) {
410
					TypeBinding originalArgument = originalArguments[i];
411
					TypeBinding substitutedArgument = convertEliminatingTypeVariables(originalArgument, paramType.genericType(), i, eliminatedVariables);
412
					if (substitutedArgument != originalArgument) {
413
						if (substitutedArguments == originalArguments) {
414
							System.arraycopy(originalArguments, 0, substitutedArguments = new TypeBinding[length], 0, i);
415
						}
416
						substitutedArguments[i] = substitutedArgument;
417
					} else 	if (substitutedArguments != originalArguments) {
418
						substitutedArguments[i] = originalArgument;
419
					}
420
				}
421
				if (originalEnclosing != substitutedEnclosing || originalArguments != substitutedArguments) {
422
					return createParameterizedType(paramType.genericType(), substitutedArguments, substitutedEnclosing);
423
				}
424
				break;
425
			case Binding.TYPE_PARAMETER :
426
				if (eliminatedVariables != null && eliminatedVariables.contains(originalType)) {
427
					return createWildcard(genericType, rank, null, null, Wildcard.UNBOUND);
428
				}
429
				TypeVariableBinding variable = (TypeVariableBinding) originalType;
430
				TypeBinding originalUpperBound = variable.upperBound();
431
				if (eliminatedVariables == null) {
432
					eliminatedVariables = new HashSet(2);
433
				}
434
				eliminatedVariables.add(variable);
435
				TypeBinding substitutedUpperBound = convertEliminatingTypeVariables(originalUpperBound, genericType, rank, eliminatedVariables);
436
				eliminatedVariables.remove(variable);
437
				return createWildcard(genericType, rank, substitutedUpperBound, null, Wildcard.EXTENDS);
438
			case Binding.RAW_TYPE :
439
				break;
440
			case Binding.GENERIC_TYPE :
441
				ReferenceBinding currentType = (ReferenceBinding) originalType;
442
				originalEnclosing = currentType.enclosingType();
443
				substitutedEnclosing = originalEnclosing;
444
				if (originalEnclosing != null) {
445
					substitutedEnclosing = (ReferenceBinding) convertEliminatingTypeVariables(originalEnclosing, genericType, rank, eliminatedVariables);
446
				}
447
				originalArguments = currentType.typeVariables();
448
				substitutedArguments = originalArguments;
449
				for (int i = 0, length = originalArguments == null ? 0 : originalArguments.length; i < length; i++) {
450
					TypeBinding originalArgument = originalArguments[i];
451
					TypeBinding substitutedArgument = convertEliminatingTypeVariables(originalArgument, currentType, i, eliminatedVariables);
452
					if (substitutedArgument != originalArgument) {
453
						if (substitutedArguments == originalArguments) {
454
							System.arraycopy(originalArguments, 0, substitutedArguments = new TypeBinding[length], 0, i);
455
						}
456
						substitutedArguments[i] = substitutedArgument;
457
					} else 	if (substitutedArguments != originalArguments) {
458
						substitutedArguments[i] = originalArgument;
459
					}
460
				}
461
				if (originalEnclosing != substitutedEnclosing || originalArguments != substitutedArguments) {
462
					return createParameterizedType(genericType, substitutedArguments, substitutedEnclosing);
463
				}
464
				break;
465
			case Binding.WILDCARD_TYPE :
466
				WildcardBinding wildcard = (WildcardBinding) originalType;
467
				TypeBinding originalBound = wildcard.bound;
468
				TypeBinding substitutedBound = originalBound;
469
				if (originalBound != null) {
470
					substitutedBound = convertEliminatingTypeVariables(originalBound, genericType, rank, eliminatedVariables);
471
					if (substitutedBound != originalBound) {
472
						return createWildcard(wildcard.genericType, wildcard.rank, substitutedBound, null, wildcard.boundKind);
473
					}
474
				}
475
				break;
476
			case Binding.INTERSECTION_TYPE :
477
				WildcardBinding intersection = (WildcardBinding) originalType;
478
				originalBound = intersection.bound;
479
				substitutedBound = originalBound;
480
				if (originalBound != null) {
481
					substitutedBound = convertEliminatingTypeVariables(originalBound, genericType, rank, eliminatedVariables);
482
				}
483
				TypeBinding[] originalOtherBounds = intersection.otherBounds;
484
				TypeBinding[] substitutedOtherBounds = originalOtherBounds;
485
				for (int i = 0, length = originalOtherBounds == null ? 0 : originalOtherBounds.length; i < length; i++) {
486
					TypeBinding originalOtherBound = originalOtherBounds[i];
487
					TypeBinding substitutedOtherBound = convertEliminatingTypeVariables(originalOtherBound, genericType, rank, eliminatedVariables);
488
					if (substitutedOtherBound != originalOtherBound) {
489
						if (substitutedOtherBounds == originalOtherBounds) {
490
							System.arraycopy(originalOtherBounds, 0, substitutedOtherBounds = new TypeBinding[length], 0, i);
491
						}
492
						substitutedOtherBounds[i] = substitutedOtherBound;
493
					} else 	if (substitutedOtherBounds != originalOtherBounds) {
494
						substitutedOtherBounds[i] = originalOtherBound;
495
					}
496
				}
497
				if (substitutedBound != originalBound || substitutedOtherBounds != originalOtherBounds) {
498
					return createWildcard(intersection.genericType, intersection.rank, substitutedBound, substitutedOtherBounds, intersection.boundKind);
499
				}
500
				break;
501
			}
502
	}
503
	return originalType;
504
}
505
506
/**
387
/**
507
 * Convert a given source type into a parameterized form if generic.
388
 * Convert a given source type into a parameterized form if generic.
508
 * generic X<E> --> param X<E>
389
 * generic X<E> --> param X<E>
Lines 598-603 Link Here
598
	return type;
479
	return type;
599
}
480
}
600
481
482
/**
483
 * Convert an array of types in raw forms.
484
 * Only allocate an array if anything is different.
485
 */
486
public ReferenceBinding[] convertToRawTypes(ReferenceBinding[] originalTypes, boolean forceErasure, boolean forceRawEnclosingType) {
487
	if (originalTypes == null) return null;
488
    ReferenceBinding[] convertedTypes = originalTypes;
489
    for (int i = 0, length = originalTypes.length; i < length; i++) {
490
        ReferenceBinding originalType = originalTypes[i];
491
        ReferenceBinding convertedType = (ReferenceBinding) convertToRawType(forceErasure ? originalType.erasure() : originalType, forceRawEnclosingType);
492
        if (convertedType != originalType) {        
493
            if (convertedTypes == originalTypes) {
494
                System.arraycopy(originalTypes, 0, convertedTypes = new ReferenceBinding[length], 0, i);
495
            }
496
            convertedTypes[i] = convertedType;
497
        } else if (convertedTypes != originalTypes) {
498
            convertedTypes[i] = originalType;
499
        }
500
    }
501
    return convertedTypes;
502
}
601
503
602
// variation for unresolved types in binaries (consider generic type as raw)
504
// variation for unresolved types in binaries (consider generic type as raw)
603
public TypeBinding convertUnresolvedBinaryToRawType(TypeBinding type) {
505
public TypeBinding convertUnresolvedBinaryToRawType(TypeBinding type) {
Lines 657-663 Link Here
657
	}
559
	}
658
	return type;
560
	return type;
659
}
561
}
660
661
/*
562
/*
662
 *  Used to guarantee annotation identity.
563
 *  Used to guarantee annotation identity.
663
 */
564
 */
Lines 667-672 Link Here
667
	}
568
	}
668
	return new AnnotationBinding(annotationType, pairs);
569
	return new AnnotationBinding(annotationType, pairs);
669
}
570
}
571
670
/*
572
/*
671
 *  Used to guarantee array type identity.
573
 *  Used to guarantee array type identity.
672
 */
574
 */
Lines 708-717 Link Here
708
	this.uniqueArrayBindings[dimIndex] = arrayBindings;
610
	this.uniqueArrayBindings[dimIndex] = arrayBindings;
709
	return arrayBindings[length] = new ArrayBinding(leafComponentType, dimensionCount, this);
611
	return arrayBindings[length] = new ArrayBinding(leafComponentType, dimensionCount, this);
710
}
612
}
711
712
public BinaryTypeBinding createBinaryTypeFrom(IBinaryType binaryType, PackageBinding packageBinding, AccessRestriction accessRestriction) {
613
public BinaryTypeBinding createBinaryTypeFrom(IBinaryType binaryType, PackageBinding packageBinding, AccessRestriction accessRestriction) {
713
	return createBinaryTypeFrom(binaryType, packageBinding, true, accessRestriction);
614
	return createBinaryTypeFrom(binaryType, packageBinding, true, accessRestriction);
714
}
615
}
616
715
public BinaryTypeBinding createBinaryTypeFrom(IBinaryType binaryType, PackageBinding packageBinding, boolean needFieldsAndMethods, AccessRestriction accessRestriction) {
617
public BinaryTypeBinding createBinaryTypeFrom(IBinaryType binaryType, PackageBinding packageBinding, boolean needFieldsAndMethods, AccessRestriction accessRestriction) {
716
	BinaryTypeBinding binaryBinding = new BinaryTypeBinding(packageBinding, binaryType, this);
618
	BinaryTypeBinding binaryBinding = new BinaryTypeBinding(packageBinding, binaryType, this);
717
619
Lines 1342-1348 Link Here
1342
		return this.nameEnvironment.isPackage(null, name);
1244
		return this.nameEnvironment.isPackage(null, name);
1343
	return this.nameEnvironment.isPackage(compoundName, name);
1245
	return this.nameEnvironment.isPackage(compoundName, name);
1344
}
1246
}
1345
1346
// The method verifier is lazily initialized to guarantee the receiver, the compiler & the oracle are ready.
1247
// The method verifier is lazily initialized to guarantee the receiver, the compiler & the oracle are ready.
1347
public MethodVerifier methodVerifier() {
1248
public MethodVerifier methodVerifier() {
1348
	if (this.verifier == null)
1249
	if (this.verifier == null)
Lines 1351-1356 Link Here
1351
			: new MethodVerifier15(this); // covariance only if sourceLevel is >= 1.5
1252
			: new MethodVerifier15(this); // covariance only if sourceLevel is >= 1.5
1352
	return this.verifier;
1253
	return this.verifier;
1353
}
1254
}
1255
1354
public void releaseClassFiles(org.eclipse.jdt.internal.compiler.ClassFile[] classFiles) {
1256
public void releaseClassFiles(org.eclipse.jdt.internal.compiler.ClassFile[] classFiles) {
1355
	for (int i = 0, fileCount = classFiles.length; i < fileCount; i++)
1257
	for (int i = 0, fileCount = classFiles.length; i < fileCount; i++)
1356
		this.classFilePool.release(classFiles[i]);
1258
		this.classFilePool.release(classFiles[i]);
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/InferenceContext.java (-15 / +2 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
2
 * Copyright (c) 2000, 2009 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 21-29 Link Here
21
	int status;
21
	int status;
22
	TypeBinding expectedType;
22
	TypeBinding expectedType;
23
	boolean hasExplicitExpectedType; // indicates whether the expectedType (if set) was explicit in code, or set by default
23
	boolean hasExplicitExpectedType; // indicates whether the expectedType (if set) was explicit in code, or set by default
24
    public boolean isUnchecked;
24
	TypeBinding[] substitutes;
25
	TypeBinding[] substitutes;
25
	final static int FAILED = 1;
26
	final static int FAILED = 1;
26
	final static int RAW_SUBSTITUTION = 2;
27
27
28
public InferenceContext(MethodBinding genericMethod) {
28
public InferenceContext(MethodBinding genericMethod) {
29
	this.genericMethod = genericMethod;
29
	this.genericMethod = genericMethod;
Lines 33-48 Link Here
33
	this.substitutes = new TypeBinding[varLength];
33
	this.substitutes = new TypeBinding[varLength];
34
}
34
}
35
35
36
public boolean checkRawSubstitution() {
37
	// only at first level, during inference from arguments
38
	if (this.depth > 0) return false;
39
//	if (this.argumentIndex < 0 || this.depth != 0) {
40
//		return false;
41
//	}
42
	this.status = RAW_SUBSTITUTION;
43
	return true;
44
}
45
46
public TypeBinding[] getSubstitutes(TypeVariableBinding typeVariable, int constraint) {
36
public TypeBinding[] getSubstitutes(TypeVariableBinding typeVariable, int constraint) {
47
	return this.collectedSubstitutes[typeVariable.rank][constraint];
37
	return this.collectedSubstitutes[typeVariable.rank][constraint];
48
}
38
}
Lines 99-107 Link Here
99
		case FAILED :
89
		case FAILED :
100
			buffer.append("failed]");//$NON-NLS-1$
90
			buffer.append("failed]");//$NON-NLS-1$
101
			break;
91
			break;
102
		case RAW_SUBSTITUTION :
103
			buffer.append("raw-subst]");//$NON-NLS-1$
104
			break;
105
	}
92
	}
106
	if (this.expectedType == null) {
93
	if (this.expectedType == null) {
107
		buffer.append(" [expectedType=null]"); //$NON-NLS-1$
94
		buffer.append(" [expectedType=null]"); //$NON-NLS-1$
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/LocalVariableBinding.java (-2 / +1 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
2
 * Copyright (c) 2000, 2009 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 53-59 Link Here
53
	* Answer the receiver's binding type from Binding.BindingID.
53
	* Answer the receiver's binding type from Binding.BindingID.
54
	*/
54
	*/
55
	public final int kind() {
55
	public final int kind() {
56
57
		return LOCAL;
56
		return LOCAL;
58
	}
57
	}
59
58
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java (-3 / +3 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2009 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 724-730 Link Here
724
			}
724
			}
725
			if (variable.firstBound == null) // unbound variable
725
			if (variable.firstBound == null) // unbound variable
726
				return false;
726
				return false;
727
			TypeBinding eliminatedType = (paramType.environment.convertEliminatingTypeVariables(variable, paramType.genericType(), rank, null));
727
			TypeBinding eliminatedType = Scope.convertEliminatingTypeVariables(variable, paramType.genericType(), rank, null);
728
			switch (eliminatedType.kind()) {
728
			switch (eliminatedType.kind()) {
729
				case Binding.WILDCARD_TYPE :
729
				case Binding.WILDCARD_TYPE :
730
				case Binding.INTERSECTION_TYPE :
730
				case Binding.INTERSECTION_TYPE :
Lines 779-785 Link Here
779
			}
779
			}
780
			if (otherVariable.firstBound == null) // unbound variable
780
			if (otherVariable.firstBound == null) // unbound variable
781
				return false;
781
				return false;
782
			TypeBinding otherEliminatedType = (paramType.environment.convertEliminatingTypeVariables(otherVariable, paramType.genericType(), rank, null));
782
			TypeBinding otherEliminatedType = Scope.convertEliminatingTypeVariables(otherVariable, paramType.genericType(), rank, null);
783
			switch (otherEliminatedType.kind()) {
783
			switch (otherEliminatedType.kind()) {
784
				case Binding.WILDCARD_TYPE :
784
				case Binding.WILDCARD_TYPE :
785
				case Binding.INTERSECTION_TYPE :
785
				case Binding.INTERSECTION_TYPE :
(-)eval/org/eclipse/jdt/internal/eval/CodeSnippetReturnStatement.java (-1 / +4 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
2
 * Copyright (c) 2000, 2009 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 142-145 Link Here
142
	// ignored
142
	// ignored
143
}
143
}
144
144
145
public void setUnchecked(boolean isUnchecked) {
146
	// ignored
147
}
145
}
148
}
(-)eval/org/eclipse/jdt/internal/eval/CodeSnippetSuperReference.java (-1 / +5 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
2
 * Copyright (c) 2000, 2009 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 55-59 Link Here
55
	// ignored
55
	// ignored
56
}
56
}
57
57
58
public void setUnchecked(boolean isUnchecked) {
59
	// ignored
60
}
61
58
}
62
}
59
63
(-)eval/org/eclipse/jdt/internal/eval/CodeSnippetMessageSend.java (-3 / +10 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
2
 * Copyright (c) 2000, 2009 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 11-16 Link Here
11
package org.eclipse.jdt.internal.eval;
11
package org.eclipse.jdt.internal.eval;
12
12
13
import org.eclipse.jdt.core.compiler.CharOperation;
13
import org.eclipse.jdt.core.compiler.CharOperation;
14
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
14
import org.eclipse.jdt.internal.compiler.ast.CastExpression;
15
import org.eclipse.jdt.internal.compiler.ast.CastExpression;
15
import org.eclipse.jdt.internal.compiler.ast.Expression;
16
import org.eclipse.jdt.internal.compiler.ast.Expression;
16
import org.eclipse.jdt.internal.compiler.ast.MessageSend;
17
import org.eclipse.jdt.internal.compiler.ast.MessageSend;
Lines 311-317 Link Here
311
			}			
312
			}			
312
		}
313
		}
313
	}
314
	}
314
	checkInvocationArguments(scope, this.receiver, this.actualReceiverType, this.binding, this.arguments, argumentTypes, argsContainCast, this);
315
	checkInvocationArguments(scope, this.receiver, this.actualReceiverType, this.binding, this.arguments, argumentTypes, argsContainCast, this, (this.bits & ASTNode.Unchecked) != 0);
315
316
316
	//-------message send that are known to fail at compile time-----------
317
	//-------message send that are known to fail at compile time-----------
317
	if (this.binding.isAbstract()) {
318
	if (this.binding.isAbstract()) {
Lines 331-337 Link Here
331
		this.resolvedType = this.actualReceiverType;
332
		this.resolvedType = this.actualReceiverType;
332
	} else {
333
	} else {
333
		TypeBinding returnType = this.binding.returnType;
334
		TypeBinding returnType = this.binding.returnType;
334
		if (returnType != null) returnType = returnType.capture(scope, this.sourceEnd);
335
		
336
		if (returnType != null) {
337
			if ((this.bits & ASTNode.Unchecked) != 0) {
338
				returnType = scope.environment().convertToRawType(returnType.erasure(), true);
339
			}
340
			returnType = returnType.capture(scope, this.sourceEnd);			
341
		}
335
		this.resolvedType = returnType;
342
		this.resolvedType = returnType;
336
	}
343
	}
337
	return this.resolvedType;
344
	return this.resolvedType;
(-)eval/org/eclipse/jdt/internal/eval/CodeSnippetThisReference.java (-2 / +15 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
2
 * Copyright (c) 2000, 2009 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 41-46 Link Here
41
		this.evaluationContext = evaluationContext;
41
		this.evaluationContext = evaluationContext;
42
		this.isImplicit = isImplicit;
42
		this.isImplicit = isImplicit;
43
	}
43
	}
44
	
44
	public boolean checkAccess(MethodScope methodScope) {
45
	public boolean checkAccess(MethodScope methodScope) {
45
		// this/super cannot be used in constructor call
46
		// this/super cannot be used in constructor call
46
		if (this.evaluationContext.isConstructorCall) {
47
		if (this.evaluationContext.isConstructorCall) {
Lines 55-60 Link Here
55
		}
56
		}
56
		return true;
57
		return true;
57
	}
58
	}
59
	
58
	public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
60
	public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
59
		int pc = codeStream.position;
61
		int pc = codeStream.position;
60
		if (valueRequired) {
62
		if (valueRequired) {
Lines 63-80 Link Here
63
		}
65
		}
64
		codeStream.recordPositionsFrom(pc, this.sourceStart);
66
		codeStream.recordPositionsFrom(pc, this.sourceStart);
65
	}
67
	}
68
	
66
	/**
69
	/**
67
	 * @see org.eclipse.jdt.internal.compiler.lookup.InvocationSite#genericTypeArguments()
70
	 * @see org.eclipse.jdt.internal.compiler.lookup.InvocationSite#genericTypeArguments()
68
	 */
71
	 */
69
	public TypeBinding[] genericTypeArguments() {
72
	public TypeBinding[] genericTypeArguments() {
70
		return null;
73
		return null;
71
	}
74
	}
75
	
72
	public boolean isSuperAccess(){
76
	public boolean isSuperAccess(){
73
		return false;
77
		return false;
74
	}
78
	}
79
	
75
	public boolean isTypeAccess(){
80
	public boolean isTypeAccess(){
76
		return false;
81
		return false;
77
	}
82
	}
83
	
78
	public StringBuffer printExpression(int indent, StringBuffer output){
84
	public StringBuffer printExpression(int indent, StringBuffer output){
79
85
80
		char[] declaringType = this.evaluationContext.declaringTypeName;
86
		char[] declaringType = this.evaluationContext.declaringTypeName;
Lines 85-92 Link Here
85
			output.append(declaringType);
91
			output.append(declaringType);
86
		return output.append(")this"); //$NON-NLS-1$
92
		return output.append(")this"); //$NON-NLS-1$
87
	}
93
	}
94
	
88
	public TypeBinding resolveType(BlockScope scope) {
95
	public TypeBinding resolveType(BlockScope scope) {
89
90
		// implicit this
96
		// implicit this
91
		this.constant = Constant.NotAConstant;
97
		this.constant = Constant.NotAConstant;
92
		TypeBinding snippetType = null;
98
		TypeBinding snippetType = null;
Lines 105-117 Link Here
105
		}
111
		}
106
		return this.resolvedType = this.delegateThis.type;
112
		return this.resolvedType = this.delegateThis.type;
107
	}
113
	}
114
	
108
	public void setActualReceiverType(ReferenceBinding receiverType) {
115
	public void setActualReceiverType(ReferenceBinding receiverType) {
109
		// ignored
116
		// ignored
110
	}
117
	}
118
	
111
	public void setDepth(int depth){
119
	public void setDepth(int depth){
112
		// ignored
120
		// ignored
113
	}
121
	}
122
	
114
	public void setFieldIndex(int index){
123
	public void setFieldIndex(int index){
115
		// ignored
124
		// ignored
116
	}
125
	}
126
	
127
	public void setUnchecked(boolean isUnchecked) {
128
		// ignored
129
	}	
117
}
130
}
(-)compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java (-10 / +92 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2009 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 21-35 Link Here
21
import org.eclipse.jdt.core.compiler.CharOperation;
21
import org.eclipse.jdt.core.compiler.CharOperation;
22
import org.eclipse.jdt.core.compiler.IProblem;
22
import org.eclipse.jdt.core.compiler.IProblem;
23
import org.eclipse.jdt.core.compiler.InvalidInputException;
23
import org.eclipse.jdt.core.compiler.InvalidInputException;
24
import org.eclipse.jdt.internal.compiler.*;
24
import org.eclipse.jdt.internal.compiler.CompilationResult;
25
import org.eclipse.jdt.internal.compiler.ast.*;
25
import org.eclipse.jdt.internal.compiler.IErrorHandlingPolicy;
26
import org.eclipse.jdt.internal.compiler.IProblemFactory;
27
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
28
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
29
import org.eclipse.jdt.internal.compiler.ast.AbstractVariableDeclaration;
30
import org.eclipse.jdt.internal.compiler.ast.AllocationExpression;
31
import org.eclipse.jdt.internal.compiler.ast.Annotation;
32
import org.eclipse.jdt.internal.compiler.ast.AnnotationMethodDeclaration;
33
import org.eclipse.jdt.internal.compiler.ast.Argument;
34
import org.eclipse.jdt.internal.compiler.ast.ArrayAllocationExpression;
35
import org.eclipse.jdt.internal.compiler.ast.ArrayQualifiedTypeReference;
36
import org.eclipse.jdt.internal.compiler.ast.ArrayReference;
37
import org.eclipse.jdt.internal.compiler.ast.ArrayTypeReference;
38
import org.eclipse.jdt.internal.compiler.ast.Assignment;
39
import org.eclipse.jdt.internal.compiler.ast.BinaryExpression;
40
import org.eclipse.jdt.internal.compiler.ast.Block;
41
import org.eclipse.jdt.internal.compiler.ast.BranchStatement;
42
import org.eclipse.jdt.internal.compiler.ast.CaseStatement;
43
import org.eclipse.jdt.internal.compiler.ast.CastExpression;
44
import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
45
import org.eclipse.jdt.internal.compiler.ast.CompoundAssignment;
46
import org.eclipse.jdt.internal.compiler.ast.ConditionalExpression;
47
import org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration;
48
import org.eclipse.jdt.internal.compiler.ast.EqualExpression;
49
import org.eclipse.jdt.internal.compiler.ast.ExplicitConstructorCall;
50
import org.eclipse.jdt.internal.compiler.ast.Expression;
51
import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration;
52
import org.eclipse.jdt.internal.compiler.ast.FieldReference;
53
import org.eclipse.jdt.internal.compiler.ast.ImportReference;
54
import org.eclipse.jdt.internal.compiler.ast.Initializer;
55
import org.eclipse.jdt.internal.compiler.ast.InstanceOfExpression;
56
import org.eclipse.jdt.internal.compiler.ast.IntLiteral;
57
import org.eclipse.jdt.internal.compiler.ast.LabeledStatement;
58
import org.eclipse.jdt.internal.compiler.ast.Literal;
59
import org.eclipse.jdt.internal.compiler.ast.LocalDeclaration;
60
import org.eclipse.jdt.internal.compiler.ast.LongLiteral;
61
import org.eclipse.jdt.internal.compiler.ast.MemberValuePair;
62
import org.eclipse.jdt.internal.compiler.ast.MessageSend;
63
import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration;
64
import org.eclipse.jdt.internal.compiler.ast.NameReference;
65
import org.eclipse.jdt.internal.compiler.ast.NumberLiteral;
66
import org.eclipse.jdt.internal.compiler.ast.ParameterizedQualifiedTypeReference;
67
import org.eclipse.jdt.internal.compiler.ast.ParameterizedSingleTypeReference;
68
import org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression;
69
import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference;
70
import org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference;
71
import org.eclipse.jdt.internal.compiler.ast.Reference;
72
import org.eclipse.jdt.internal.compiler.ast.ReturnStatement;
73
import org.eclipse.jdt.internal.compiler.ast.SingleNameReference;
74
import org.eclipse.jdt.internal.compiler.ast.Statement;
75
import org.eclipse.jdt.internal.compiler.ast.SwitchStatement;
76
import org.eclipse.jdt.internal.compiler.ast.ThisReference;
77
import org.eclipse.jdt.internal.compiler.ast.TryStatement;
78
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
79
import org.eclipse.jdt.internal.compiler.ast.TypeParameter;
80
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
81
import org.eclipse.jdt.internal.compiler.ast.UnaryExpression;
82
import org.eclipse.jdt.internal.compiler.ast.Wildcard;
26
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
83
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
27
import org.eclipse.jdt.internal.compiler.env.AccessRestriction;
84
import org.eclipse.jdt.internal.compiler.env.AccessRestriction;
28
import org.eclipse.jdt.internal.compiler.env.ICompilationUnit;
85
import org.eclipse.jdt.internal.compiler.env.ICompilationUnit;
29
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
86
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
30
import org.eclipse.jdt.internal.compiler.impl.ReferenceContext;
87
import org.eclipse.jdt.internal.compiler.impl.ReferenceContext;
31
import org.eclipse.jdt.internal.compiler.lookup.*;
88
import org.eclipse.jdt.internal.compiler.lookup.ArrayBinding;
32
import org.eclipse.jdt.internal.compiler.parser.*;
89
import org.eclipse.jdt.internal.compiler.lookup.Binding;
90
import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers;
91
import org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
92
import org.eclipse.jdt.internal.compiler.lookup.InvocationSite;
93
import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding;
94
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
95
import org.eclipse.jdt.internal.compiler.lookup.ParameterizedGenericMethodBinding;
96
import org.eclipse.jdt.internal.compiler.lookup.ProblemMethodBinding;
97
import org.eclipse.jdt.internal.compiler.lookup.ProblemReasons;
98
import org.eclipse.jdt.internal.compiler.lookup.ProblemReferenceBinding;
99
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
100
import org.eclipse.jdt.internal.compiler.lookup.Scope;
101
import org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding;
102
import org.eclipse.jdt.internal.compiler.lookup.SyntheticArgumentBinding;
103
import org.eclipse.jdt.internal.compiler.lookup.TagBits;
104
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
105
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
106
import org.eclipse.jdt.internal.compiler.lookup.TypeIds;
107
import org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding;
108
import org.eclipse.jdt.internal.compiler.lookup.WildcardBinding;
109
import org.eclipse.jdt.internal.compiler.parser.JavadocTagConstants;
110
import org.eclipse.jdt.internal.compiler.parser.Parser;
111
import org.eclipse.jdt.internal.compiler.parser.RecoveryScanner;
112
import org.eclipse.jdt.internal.compiler.parser.Scanner;
113
import org.eclipse.jdt.internal.compiler.parser.ScannerHelper;
114
import org.eclipse.jdt.internal.compiler.parser.TerminalTokens;
33
import org.eclipse.jdt.internal.compiler.util.Messages;
115
import org.eclipse.jdt.internal.compiler.util.Messages;
34
116
35
public class ProblemReporter extends ProblemHandler {
117
public class ProblemReporter extends ProblemHandler {
Lines 6828-6834 Link Here
6828
		nodeSourceStart(field,location),
6910
		nodeSourceStart(field,location),
6829
		nodeSourceEnd(field, location));
6911
		nodeSourceEnd(field, location));
6830
}
6912
}
6831
public void unsafeRawGenericMethodInvocation(ASTNode location, MethodBinding rawMethod) {
6913
public void unsafeRawGenericMethodInvocation(ASTNode location, MethodBinding rawMethod, TypeBinding[] argumentTypes) {
6832
	boolean isConstructor = rawMethod.isConstructor();
6914
	boolean isConstructor = rawMethod.isConstructor();
6833
	int severity = computeSeverity(isConstructor ? IProblem.UnsafeRawGenericConstructorInvocation : IProblem.UnsafeRawGenericMethodInvocation);
6915
	int severity = computeSeverity(isConstructor ? IProblem.UnsafeRawGenericConstructorInvocation : IProblem.UnsafeRawGenericMethodInvocation);
6834
	if (severity == ProblemSeverities.Ignore) return;
6916
	if (severity == ProblemSeverities.Ignore) return;
Lines 6839-6851 Link Here
6839
				new String(rawMethod.declaringClass.sourceName()),
6921
				new String(rawMethod.declaringClass.sourceName()),
6840
				typesAsString(rawMethod.original().isVarargs(), rawMethod.original().parameters, false),
6922
				typesAsString(rawMethod.original().isVarargs(), rawMethod.original().parameters, false),
6841
				new String(rawMethod.declaringClass.readableName()),
6923
				new String(rawMethod.declaringClass.readableName()),
6842
				typesAsString(rawMethod.original().isVarargs(), rawMethod.parameters, false),
6924
				typesAsString(rawMethod.original().isVarargs(), argumentTypes, false),
6843
			 },
6925
			 },
6844
			new String[] {
6926
			new String[] {
6845
				new String(rawMethod.declaringClass.sourceName()),
6927
				new String(rawMethod.declaringClass.sourceName()),
6846
				typesAsString(rawMethod.original().isVarargs(), rawMethod.original().parameters, true),
6928
				typesAsString(rawMethod.original().isVarargs(), rawMethod.original().parameters, true),
6847
				new String(rawMethod.declaringClass.shortReadableName()),
6929
				new String(rawMethod.declaringClass.shortReadableName()),
6848
				typesAsString(rawMethod.original().isVarargs(), rawMethod.parameters, true),
6930
				typesAsString(false, argumentTypes, true),
6849
			 },
6931
			 },
6850
			severity,
6932
			severity,
6851
			location.sourceStart,
6933
			location.sourceStart,
Lines 6857-6869 Link Here
6857
				new String(rawMethod.selector),
6939
				new String(rawMethod.selector),
6858
				typesAsString(rawMethod.original().isVarargs(), rawMethod.original().parameters, false),
6940
				typesAsString(rawMethod.original().isVarargs(), rawMethod.original().parameters, false),
6859
				new String(rawMethod.declaringClass.readableName()),
6941
				new String(rawMethod.declaringClass.readableName()),
6860
				typesAsString(rawMethod.original().isVarargs(), rawMethod.parameters, false),
6942
				typesAsString(false, argumentTypes, false),
6861
			 },
6943
			 },
6862
			new String[] {
6944
			new String[] {
6863
				new String(rawMethod.selector),
6945
				new String(rawMethod.selector),
6864
				typesAsString(rawMethod.original().isVarargs(), rawMethod.original().parameters, true),
6946
				typesAsString(rawMethod.original().isVarargs(), rawMethod.original().parameters, true),
6865
				new String(rawMethod.declaringClass.shortReadableName()),
6947
				new String(rawMethod.declaringClass.shortReadableName()),
6866
				typesAsString(rawMethod.original().isVarargs(), rawMethod.parameters, true),
6948
				typesAsString(false, argumentTypes, true),
6867
			 },
6949
			 },
6868
			severity,
6950
			severity,
6869
			location.sourceStart,
6951
			location.sourceStart,
(-)codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java (-1 / +2 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2009 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 452-457 Link Here
452
		public void setActualReceiverType(ReferenceBinding receiverType) {/* empty */}
452
		public void setActualReceiverType(ReferenceBinding receiverType) {/* empty */}
453
		public void setDepth(int depth){/* empty */}
453
		public void setDepth(int depth){/* empty */}
454
		public void setFieldIndex(int depth){/* empty */}
454
		public void setFieldIndex(int depth){/* empty */}
455
		public void setUnchecked(boolean isUnchecked) {/* empty */}
455
		public int sourceEnd() { return 0; 	}
456
		public int sourceEnd() { return 0; 	}
456
		public int sourceStart() { return 0; 	}
457
		public int sourceStart() { return 0; 	}
457
	};
458
	};
(-)src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java (-750 / +1166 lines)
Lines 13989-14009 Link Here
13989
				"  }\n" +
13989
				"  }\n" +
13990
				"}\n"
13990
				"}\n"
13991
			},
13991
			},
13992
			"----------\n" +
13992
			"----------\n" + 
13993
			"1. ERROR in X.java (at line 3)\n" +
13993
			"1. ERROR in X.java (at line 3)\n" + 
13994
			"	Zork z;\n" +
13994
			"	Zork z;\n" + 
13995
			"	^^^^\n" +
13995
			"	^^^^\n" + 
13996
			"Zork cannot be resolved to a type\n" +
13996
			"Zork cannot be resolved to a type\n" + 
13997
			"----------\n" +
13997
			"----------\n" + 
13998
			"2. WARNING in X.java (at line 16)\n" +
13998
			"2. WARNING in X.java (at line 16)\n" + 
13999
			"	return m_manager.getById(getClass(), new Integer(1));\n" +
13999
			"	return m_manager.getById(getClass(), new Integer(1));\n" + 
14000
			"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
14000
			"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
14001
			"Type safety: Unchecked invocation getById(Class<capture#1-of ? extends Test>, Integer) of the generic method getById(Class<T>, Integer) of type Test.Manager<C>\n" +
14001
			"Type safety: Unchecked invocation getById(Class<capture#1-of ? extends Test>, Integer) of the generic method getById(Class<T>, Integer) of type Test.Manager<C>\n" + 
14002
			"----------\n" +
14002
			"----------\n" + 
14003
			"3. WARNING in X.java (at line 16)\n" +
14003
			"3. WARNING in X.java (at line 16)\n" + 
14004
			"	return m_manager.getById(getClass(), new Integer(1));\n" +
14004
			"	return m_manager.getById(getClass(), new Integer(1));\n" + 
14005
			"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
14005
			"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
14006
			"Type safety: The expression of type capture#1-of ? extends Test needs unchecked conversion to conform to ITest<C>\n" +
14006
			"Type safety: The expression of type ITest needs unchecked conversion to conform to ITest<C>\n" + 
14007
			"----------\n");
14007
			"----------\n");
14008
	}
14008
	}
14009
14009
Lines 15121-15141 Link Here
15121
				"	}\n" +
15121
				"	}\n" +
15122
				"}\n"
15122
				"}\n"
15123
			},
15123
			},
15124
			"----------\n" +
15124
			"----------\n" + 
15125
			"1. WARNING in X.java (at line 8)\n" +
15125
			"1. WARNING in X.java (at line 8)\n" + 
15126
			"	take(new A());\n" +
15126
			"	take(new A());\n" + 
15127
			"	     ^^^^^^^\n" +
15127
			"	^^^^^^^^^^^^^\n" + 
15128
			"Type safety: The expression of type Super.A needs unchecked conversion to conform to Super<Double>.A<Double>\n" +
15128
			"Type safety: Unchecked invocation take(Super.A) of the generic method take(Super<S>.A<S>) of type Super<Double>\n" + 
15129
			"----------\n" +
15129
			"----------\n" + 
15130
			"2. WARNING in X.java (at line 8)\n" +
15130
			"2. WARNING in X.java (at line 8)\n" + 
15131
			"	take(new A());\n" +
15131
			"	take(new A());\n" + 
15132
			"	         ^\n" +
15132
			"	     ^^^^^^^\n" + 
15133
			"Super.A is a raw type. References to generic type Super<S>.A<E> should be parameterized\n" +
15133
			"Type safety: The expression of type Super.A needs unchecked conversion to conform to Super<Double>.A<Double>\n" + 
15134
			"----------\n" +
15134
			"----------\n" + 
15135
			"3. ERROR in X.java (at line 14)\n" +
15135
			"3. WARNING in X.java (at line 8)\n" + 
15136
			"	Zork z;\n" +
15136
			"	take(new A());\n" + 
15137
			"	^^^^\n" +
15137
			"	         ^\n" + 
15138
			"Zork cannot be resolved to a type\n" +
15138
			"Super.A is a raw type. References to generic type Super<S>.A<E> should be parameterized\n" + 
15139
			"----------\n" + 
15140
			"4. ERROR in X.java (at line 14)\n" + 
15141
			"	Zork z;\n" + 
15142
			"	^^^^\n" + 
15143
			"Zork cannot be resolved to a type\n" + 
15139
			"----------\n");
15144
			"----------\n");
15140
	}
15145
	}
15141
15146
Lines 15734-15814 Link Here
15734
				" Zork z;\n" +
15739
				" Zork z;\n" +
15735
				"}\n"
15740
				"}\n"
15736
			},
15741
			},
15737
			"----------\n" +
15742
			"----------\n" + 
15738
			"1. WARNING in X.java (at line 6)\n" +
15743
			"1. WARNING in X.java (at line 6)\n" + 
15739
			"	public void test(List list,final Comparator comparator, X x) {\n" +
15744
			"	public void test(List list,final Comparator comparator, X x) {\n" + 
15740
			"	                 ^^^^\n" +
15745
			"	                 ^^^^\n" + 
15741
			"List is a raw type. References to generic type List<E> should be parameterized\n" +
15746
			"List is a raw type. References to generic type List<E> should be parameterized\n" + 
15742
			"----------\n" +
15747
			"----------\n" + 
15743
			"2. WARNING in X.java (at line 6)\n" +
15748
			"2. WARNING in X.java (at line 6)\n" + 
15744
			"	public void test(List list,final Comparator comparator, X x) {\n" +
15749
			"	public void test(List list,final Comparator comparator, X x) {\n" + 
15745
			"	                                 ^^^^^^^^^^\n" +
15750
			"	                                 ^^^^^^^^^^\n" + 
15746
			"Comparator is a raw type. References to generic type Comparator<T> should be parameterized\n" +
15751
			"Comparator is a raw type. References to generic type Comparator<T> should be parameterized\n" + 
15747
			"----------\n" +
15752
			"----------\n" + 
15748
			"3. WARNING in X.java (at line 6)\n" +
15753
			"3. WARNING in X.java (at line 6)\n" + 
15749
			"	public void test(List list,final Comparator comparator, X x) {\n" +
15754
			"	public void test(List list,final Comparator comparator, X x) {\n" + 
15750
			"	                                                        ^\n" +
15755
			"	                                                        ^\n" + 
15751
			"X is a raw type. References to generic type X<E> should be parameterized\n" +
15756
			"X is a raw type. References to generic type X<E> should be parameterized\n" + 
15752
			"----------\n" +
15757
			"----------\n" + 
15753
			"4. WARNING in X.java (at line 7)\n" +
15758
			"4. WARNING in X.java (at line 7)\n" + 
15754
			"	foo(list, comparator);\n" +
15759
			"	foo(list, comparator);\n" + 
15755
			"	^^^^^^^^^^^^^^^^^^^^^\n" +
15760
			"	^^^^^^^^^^^^^^^^^^^^^\n" + 
15756
			"Type safety: Unchecked invocation foo(List, Comparator) of the generic method foo(List<T>, Comparator<? super T>) of type X<E>\n" +
15761
			"Type safety: Unchecked invocation foo(List, Comparator) of the generic method foo(List<T>, Comparator<? super T>) of type X<E>\n" + 
15757
			"----------\n" +
15762
			"----------\n" + 
15758
			"5. WARNING in X.java (at line 7)\n" +
15763
			"5. WARNING in X.java (at line 7)\n" + 
15759
			"	foo(list, comparator);\n" +
15764
			"	foo(list, comparator);\n" + 
15760
			"	    ^^^^\n" +
15765
			"	    ^^^^\n" + 
15761
			"Type safety: The expression of type List needs unchecked conversion to conform to List<T>\n" +
15766
			"Type safety: The expression of type List needs unchecked conversion to conform to List<Object>\n" + 
15762
			"----------\n" +
15767
			"----------\n" + 
15763
			"6. WARNING in X.java (at line 7)\n" +
15768
			"6. WARNING in X.java (at line 7)\n" + 
15764
			"	foo(list, comparator);\n" +
15769
			"	foo(list, comparator);\n" + 
15765
			"	          ^^^^^^^^^^\n" +
15770
			"	          ^^^^^^^^^^\n" + 
15766
			"Type safety: The expression of type Comparator needs unchecked conversion to conform to Comparator<? super T>\n" +
15771
			"Type safety: The expression of type Comparator needs unchecked conversion to conform to Comparator<? super Object>\n" + 
15767
			"----------\n" +
15772
			"----------\n" + 
15768
			"7. WARNING in X.java (at line 8)\n" +
15773
			"7. WARNING in X.java (at line 8)\n" + 
15769
			"	bar(list, comparator);\n" +
15774
			"	bar(list, comparator);\n" + 
15770
			"	^^^^^^^^^^^^^^^^^^^^^\n" +
15775
			"	^^^^^^^^^^^^^^^^^^^^^\n" + 
15771
			"Type safety: Unchecked invocation bar(List, Comparator) of the generic method bar(List<T>, Comparator<? super T>) of type X<E>\n" +
15776
			"Type safety: Unchecked invocation bar(List, Comparator) of the generic method bar(List<T>, Comparator<? super T>) of type X<E>\n" + 
15772
			"----------\n" +
15777
			"----------\n" + 
15773
			"8. WARNING in X.java (at line 8)\n" +
15778
			"8. WARNING in X.java (at line 8)\n" + 
15774
			"	bar(list, comparator);\n" +
15779
			"	bar(list, comparator);\n" + 
15775
			"	    ^^^^\n" +
15780
			"	    ^^^^\n" + 
15776
			"Type safety: The expression of type List needs unchecked conversion to conform to List<T>\n" +
15781
			"Type safety: The expression of type List needs unchecked conversion to conform to List<Object>\n" + 
15777
			"----------\n" +
15782
			"----------\n" + 
15778
			"9. WARNING in X.java (at line 8)\n" +
15783
			"9. WARNING in X.java (at line 8)\n" + 
15779
			"	bar(list, comparator);\n" +
15784
			"	bar(list, comparator);\n" + 
15780
			"	          ^^^^^^^^^^\n" +
15785
			"	          ^^^^^^^^^^\n" + 
15781
			"Type safety: The expression of type Comparator needs unchecked conversion to conform to Comparator<? super T>\n" +
15786
			"Type safety: The expression of type Comparator needs unchecked conversion to conform to Comparator<? super Object>\n" + 
15782
			"----------\n" +
15787
			"----------\n" + 
15783
			"10. WARNING in X.java (at line 10)\n" +
15788
			"10. WARNING in X.java (at line 10)\n" + 
15784
			"	x.foo(list, comparator);\n" +
15789
			"	x.foo(list, comparator);\n" + 
15785
			"	^^^^^^^^^^^^^^^^^^^^^^^\n" +
15790
			"	^^^^^^^^^^^^^^^^^^^^^^^\n" + 
15786
			"Type safety: The method foo(List, Comparator) belongs to the raw type X. References to generic type X<E> should be parameterized\n" +
15791
			"Type safety: The method foo(List, Comparator) belongs to the raw type X. References to generic type X<E> should be parameterized\n" + 
15787
			"----------\n" +
15792
			"----------\n" + 
15788
			"11. WARNING in X.java (at line 11)\n" +
15793
			"11. WARNING in X.java (at line 11)\n" + 
15789
			"	x.bar(list, comparator);\n" +
15794
			"	x.bar(list, comparator);\n" + 
15790
			"	^^^^^^^^^^^^^^^^^^^^^^^\n" +
15795
			"	^^^^^^^^^^^^^^^^^^^^^^^\n" + 
15791
			"The static method bar(List, Comparator) from the type X should be accessed in a static way\n" +
15796
			"The static method bar(List<Object>, Comparator<? super Object>) from the type X should be accessed in a static way\n" + 
15792
			"----------\n" +
15797
			"----------\n" + 
15793
			"12. WARNING in X.java (at line 11)\n" +
15798
			"12. WARNING in X.java (at line 11)\n" + 
15794
			"	x.bar(list, comparator);\n" +
15799
			"	x.bar(list, comparator);\n" + 
15795
			"	^^^^^^^^^^^^^^^^^^^^^^^\n" +
15800
			"	^^^^^^^^^^^^^^^^^^^^^^^\n" + 
15796
			"Type safety: Unchecked invocation bar(List, Comparator) of the generic method bar(List<T>, Comparator<? super T>) of type X\n" +
15801
			"Type safety: Unchecked invocation bar(List, Comparator) of the generic method bar(List<T>, Comparator<? super T>) of type X\n" + 
15797
			"----------\n" +
15802
			"----------\n" + 
15798
			"13. WARNING in X.java (at line 11)\n" +
15803
			"13. WARNING in X.java (at line 11)\n" + 
15799
			"	x.bar(list, comparator);\n" +
15804
			"	x.bar(list, comparator);\n" + 
15800
			"	      ^^^^\n" +
15805
			"	      ^^^^\n" + 
15801
			"Type safety: The expression of type List needs unchecked conversion to conform to List<T>\n" +
15806
			"Type safety: The expression of type List needs unchecked conversion to conform to List<Object>\n" + 
15802
			"----------\n" +
15807
			"----------\n" + 
15803
			"14. WARNING in X.java (at line 11)\n" +
15808
			"14. WARNING in X.java (at line 11)\n" + 
15804
			"	x.bar(list, comparator);\n" +
15809
			"	x.bar(list, comparator);\n" + 
15805
			"	            ^^^^^^^^^^\n" +
15810
			"	            ^^^^^^^^^^\n" + 
15806
			"Type safety: The expression of type Comparator needs unchecked conversion to conform to Comparator<? super T>\n" +
15811
			"Type safety: The expression of type Comparator needs unchecked conversion to conform to Comparator<? super Object>\n" + 
15807
			"----------\n" +
15812
			"----------\n" + 
15808
			"15. ERROR in X.java (at line 18)\n" +
15813
			"15. ERROR in X.java (at line 18)\n" + 
15809
			"	Zork z;\n" +
15814
			"	Zork z;\n" + 
15810
			"	^^^^\n" +
15815
			"	^^^^\n" + 
15811
			"Zork cannot be resolved to a type\n" +
15816
			"Zork cannot be resolved to a type\n" + 
15812
			"----------\n");
15817
			"----------\n");
15813
	}
15818
	}
15814
	// array bound for wildcard
15819
	// array bound for wildcard
Lines 16653-16688 Link Here
16653
				"	}\n" +
16658
				"	}\n" +
16654
				"}\n",
16659
				"}\n",
16655
			},
16660
			},
16656
			"----------\n" +
16661
			"----------\n" + 
16657
			"1. WARNING in X.java (at line 9)\n" +
16662
			"1. WARNING in X.java (at line 9)\n" + 
16658
			"	Class c = Foo.class;\n" +
16663
			"	Class c = Foo.class;\n" + 
16659
			"	^^^^^\n" +
16664
			"	^^^^^\n" + 
16660
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" +
16665
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
16661
			"----------\n" +
16666
			"----------\n" + 
16662
			"2. WARNING in X.java (at line 10)\n" +
16667
			"2. WARNING in X.java (at line 10)\n" + 
16663
			"	EnumSet<Enum> eSet = EnumSet.allOf(c);\n" +
16668
			"	EnumSet<Enum> eSet = EnumSet.allOf(c);\n" + 
16664
			"	        ^^^^\n" +
16669
			"	        ^^^^\n" + 
16665
			"Enum is a raw type. References to generic type Enum<E> should be parameterized\n" +
16670
			"Enum is a raw type. References to generic type Enum<E> should be parameterized\n" + 
16666
			"----------\n" +
16671
			"----------\n" + 
16667
			"3. ERROR in X.java (at line 10)\n" +
16672
			"3. ERROR in X.java (at line 10)\n" + 
16668
			"	EnumSet<Enum> eSet = EnumSet.allOf(c);\n" +
16673
			"	EnumSet<Enum> eSet = EnumSet.allOf(c);\n" + 
16669
			"	        ^^^^\n" +
16674
			"	        ^^^^\n" + 
16670
			"Bound mismatch: The type Enum is not a valid substitute for the bounded parameter <E extends Enum<E>> of the type EnumSet<E>\n" +
16675
			"Bound mismatch: The type Enum is not a valid substitute for the bounded parameter <E extends Enum<E>> of the type EnumSet<E>\n" + 
16671
			"----------\n" +
16676
			"----------\n" + 
16672
			"4. WARNING in X.java (at line 10)\n" +
16677
			"4. WARNING in X.java (at line 10)\n" + 
16673
			"	EnumSet<Enum> eSet = EnumSet.allOf(c);\n" +
16678
			"	EnumSet<Enum> eSet = EnumSet.allOf(c);\n" + 
16674
			"	                     ^^^^^^^^^^^^^^^^\n" +
16679
			"	                     ^^^^^^^^^^^^^^^^\n" + 
16675
			"Type safety: Unchecked invocation allOf(Class) of the generic method allOf(Class<E>) of type EnumSet\n" +
16680
			"Type safety: Unchecked invocation allOf(Class) of the generic method allOf(Class<E>) of type EnumSet\n" + 
16676
			"----------\n" +
16681
			"----------\n" + 
16677
			"5. WARNING in X.java (at line 10)\n" +
16682
			"5. WARNING in X.java (at line 10)\n" + 
16678
			"	EnumSet<Enum> eSet = EnumSet.allOf(c);\n" +
16683
			"	EnumSet<Enum> eSet = EnumSet.allOf(c);\n" + 
16679
			"	                     ^^^^^^^^^^^^^^^^\n" +
16684
			"	                     ^^^^^^^^^^^^^^^^\n" + 
16680
			"Type safety: The expression of type EnumSet needs unchecked conversion to conform to EnumSet<Enum>\n" +
16685
			"Type safety: The expression of type EnumSet needs unchecked conversion to conform to EnumSet<Enum>\n" + 
16681
			"----------\n" +
16686
			"----------\n" + 
16682
			"6. WARNING in X.java (at line 10)\n" +
16687
			"6. WARNING in X.java (at line 10)\n" + 
16683
			"	EnumSet<Enum> eSet = EnumSet.allOf(c);\n" +
16688
			"	EnumSet<Enum> eSet = EnumSet.allOf(c);\n" + 
16684
			"	                                   ^\n" +
16689
			"	                                   ^\n" + 
16685
			"Type safety: The expression of type Class needs unchecked conversion to conform to Class<E>\n" +
16690
			"Type safety: The expression of type Class needs unchecked conversion to conform to Class<Enum>\n" + 
16686
			"----------\n");
16691
			"----------\n");
16687
	}
16692
	}
16688
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=86838 - variation
16693
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=86838 - variation
Lines 16729-16735 Link Here
16729
	}
16734
	}
16730
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=86838 - variation
16735
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=86838 - variation
16731
	public void test0536() {
16736
	public void test0536() {
16732
		this.runConformTest(
16737
		this.runNegativeTest(
16733
			new String[] {
16738
			new String[] {
16734
				"X.java",
16739
				"X.java",
16735
				"import java.util.EnumSet;\n" +
16740
				"import java.util.EnumSet;\n" +
Lines 16741-16751 Link Here
16741
				"public class X {\n" +
16746
				"public class X {\n" +
16742
				"	public static void main(String[] args) {\n" +
16747
				"	public static void main(String[] args) {\n" +
16743
				"		Class c = Foo.class;\n" +
16748
				"		Class c = Foo.class;\n" +
16744
				"		EnumSet<?> eSet = EnumSet.allOf(c);\n" +
16749
				"		EnumSet<?> eSet = (EnumSet<?>) EnumSet.allOf(c);\n" +
16745
				"	}\n" +
16750
				"	}\n" +
16751
				"  Zork z;\n" +
16746
				"}\n",
16752
				"}\n",
16747
			},
16753
			},
16748
			""
16754
			"----------\n" + 
16755
			"1. WARNING in X.java (at line 9)\n" + 
16756
			"	Class c = Foo.class;\n" + 
16757
			"	^^^^^\n" + 
16758
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
16759
			"----------\n" + 
16760
			"2. WARNING in X.java (at line 10)\n" + 
16761
			"	EnumSet<?> eSet = (EnumSet<?>) EnumSet.allOf(c);\n" + 
16762
			"	                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
16763
			"Unnecessary cast from EnumSet to EnumSet<?>\n" + 
16764
			"----------\n" + 
16765
			"3. WARNING in X.java (at line 10)\n" + 
16766
			"	EnumSet<?> eSet = (EnumSet<?>) EnumSet.allOf(c);\n" + 
16767
			"	                               ^^^^^^^^^^^^^^^^\n" + 
16768
			"Type safety: Unchecked invocation allOf(Class) of the generic method allOf(Class<E>) of type EnumSet\n" + 
16769
			"----------\n" + 
16770
			"4. WARNING in X.java (at line 10)\n" + 
16771
			"	EnumSet<?> eSet = (EnumSet<?>) EnumSet.allOf(c);\n" + 
16772
			"	                                             ^\n" + 
16773
			"Type safety: The expression of type Class needs unchecked conversion to conform to Class<Enum<Enum<E>>>\n" + 
16774
			"----------\n" + 
16775
			"5. ERROR in X.java (at line 12)\n" + 
16776
			"	Zork z;\n" + 
16777
			"	^^^^\n" + 
16778
			"Zork cannot be resolved to a type\n" + 
16779
			"----------\n"
16749
		);
16780
		);
16750
	}
16781
	}
16751
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=86838 - variation
16782
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=86838 - variation
Lines 16767-16792 Link Here
16767
				"  Zork z;\n" +
16798
				"  Zork z;\n" +
16768
				"}\n",
16799
				"}\n",
16769
			},
16800
			},
16770
			"----------\n" +
16801
			"----------\n" + 
16771
			"1. WARNING in X.java (at line 9)\n" +
16802
			"1. WARNING in X.java (at line 9)\n" + 
16772
			"	Class c = Foo.class;\n" +
16803
			"	Class c = Foo.class;\n" + 
16773
			"	^^^^^\n" +
16804
			"	^^^^^\n" + 
16774
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" +
16805
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
16775
			"----------\n" +
16806
			"----------\n" + 
16776
			"2. WARNING in X.java (at line 10)\n" +
16807
			"2. WARNING in X.java (at line 10)\n" + 
16777
			"	EnumSet<?> eSet = EnumSet.allOf(c);\n" +
16808
			"	EnumSet<?> eSet = EnumSet.allOf(c);\n" + 
16778
			"	                  ^^^^^^^^^^^^^^^^\n" +
16809
			"	                  ^^^^^^^^^^^^^^^^\n" + 
16779
			"Type safety: Unchecked invocation allOf(Class) of the generic method allOf(Class<E>) of type EnumSet\n" +
16810
			"Type safety: Unchecked invocation allOf(Class) of the generic method allOf(Class<E>) of type EnumSet\n" + 
16780
			"----------\n" +
16811
			"----------\n" + 
16781
			"3. WARNING in X.java (at line 10)\n" +
16812
			"3. WARNING in X.java (at line 10)\n" + 
16782
			"	EnumSet<?> eSet = EnumSet.allOf(c);\n" +
16813
			"	EnumSet<?> eSet = EnumSet.allOf(c);\n" + 
16783
			"	                                ^\n" +
16814
			"	                                ^\n" + 
16784
			"Type safety: The expression of type Class needs unchecked conversion to conform to Class<E>\n" +
16815
			"Type safety: The expression of type Class needs unchecked conversion to conform to Class<Enum<Enum<E>>>\n" + 
16785
			"----------\n" +
16816
			"----------\n" + 
16786
			"4. ERROR in X.java (at line 12)\n" +
16817
			"4. ERROR in X.java (at line 12)\n" + 
16787
			"	Zork z;\n" +
16818
			"	Zork z;\n" + 
16788
			"	^^^^\n" +
16819
			"	^^^^\n" + 
16789
			"Zork cannot be resolved to a type\n" +
16820
			"Zork cannot be resolved to a type\n" + 
16790
			"----------\n");
16821
			"----------\n");
16791
	}
16822
	}
16792
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=86838 - variation
16823
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=86838 - variation
Lines 16807-16837 Link Here
16807
				"	}\n" +
16838
				"	}\n" +
16808
				"}\n",
16839
				"}\n",
16809
			},
16840
			},
16810
			"----------\n" +
16841
			"----------\n" + 
16811
			"1. WARNING in X.java (at line 9)\n" +
16842
			"1. WARNING in X.java (at line 9)\n" + 
16812
			"	Class c = Foo.class;\n" +
16843
			"	Class c = Foo.class;\n" + 
16813
			"	^^^^^\n" +
16844
			"	^^^^^\n" + 
16814
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" +
16845
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
16815
			"----------\n" +
16846
			"----------\n" + 
16816
			"2. ERROR in X.java (at line 10)\n" +
16847
			"2. ERROR in X.java (at line 10)\n" + 
16817
			"	EnumSet<Enum<?>> eSet = EnumSet.allOf(c);\n" +
16848
			"	EnumSet<Enum<?>> eSet = EnumSet.allOf(c);\n" + 
16818
			"	        ^^^^\n" +
16849
			"	        ^^^^\n" + 
16819
			"Bound mismatch: The type Enum<?> is not a valid substitute for the bounded parameter <E extends Enum<E>> of the type EnumSet<E>\n" +
16850
			"Bound mismatch: The type Enum<?> is not a valid substitute for the bounded parameter <E extends Enum<E>> of the type EnumSet<E>\n" + 
16820
			"----------\n" +
16851
			"----------\n" + 
16821
			"3. WARNING in X.java (at line 10)\n" +
16852
			"3. WARNING in X.java (at line 10)\n" + 
16822
			"	EnumSet<Enum<?>> eSet = EnumSet.allOf(c);\n" +
16853
			"	EnumSet<Enum<?>> eSet = EnumSet.allOf(c);\n" + 
16823
			"	                        ^^^^^^^^^^^^^^^^\n" +
16854
			"	                        ^^^^^^^^^^^^^^^^\n" + 
16824
			"Type safety: Unchecked invocation allOf(Class) of the generic method allOf(Class<E>) of type EnumSet\n" +
16855
			"Type safety: Unchecked invocation allOf(Class) of the generic method allOf(Class<E>) of type EnumSet\n" + 
16825
			"----------\n" +
16856
			"----------\n" + 
16826
			"4. WARNING in X.java (at line 10)\n" +
16857
			"4. WARNING in X.java (at line 10)\n" + 
16827
			"	EnumSet<Enum<?>> eSet = EnumSet.allOf(c);\n" +
16858
			"	EnumSet<Enum<?>> eSet = EnumSet.allOf(c);\n" + 
16828
			"	                        ^^^^^^^^^^^^^^^^\n" +
16859
			"	                        ^^^^^^^^^^^^^^^^\n" + 
16829
			"Type safety: The expression of type EnumSet needs unchecked conversion to conform to EnumSet<Enum<?>>\n" +
16860
			"Type safety: The expression of type EnumSet needs unchecked conversion to conform to EnumSet<Enum<?>>\n" + 
16830
			"----------\n" +
16861
			"----------\n" + 
16831
			"5. WARNING in X.java (at line 10)\n" +
16862
			"5. WARNING in X.java (at line 10)\n" + 
16832
			"	EnumSet<Enum<?>> eSet = EnumSet.allOf(c);\n" +
16863
			"	EnumSet<Enum<?>> eSet = EnumSet.allOf(c);\n" + 
16833
			"	                                      ^\n" +
16864
			"	                                      ^\n" + 
16834
			"Type safety: The expression of type Class needs unchecked conversion to conform to Class<E>\n" +
16865
			"Type safety: The expression of type Class needs unchecked conversion to conform to Class<Enum<?>>\n" + 
16835
			"----------\n");
16866
			"----------\n");
16836
	}
16867
	}
16837
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=86838 - variation
16868
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=86838 - variation
Lines 18874-18894 Link Here
18874
				"	Zork z;\n" +
18905
				"	Zork z;\n" +
18875
				"}\n",
18906
				"}\n",
18876
            },
18907
            },
18877
            "----------\n" +
18908
    		"----------\n" + 
18878
    		"1. WARNING in Ball.java (at line 2)\n" +
18909
    		"1. WARNING in Ball.java (at line 2)\n" + 
18879
    		"	class Ball implements Comparable {\n" +
18910
    		"	class Ball implements Comparable {\n" + 
18880
    		"	                      ^^^^^^^^^^\n" +
18911
    		"	                      ^^^^^^^^^^\n" + 
18881
    		"Comparable is a raw type. References to generic type Comparable<T> should be parameterized\n" +
18912
    		"Comparable is a raw type. References to generic type Comparable<T> should be parameterized\n" + 
18882
    		"----------\n" +
18913
    		"----------\n" + 
18883
    		"2. WARNING in Ball.java (at line 10)\n" +
18914
    		"2. WARNING in Ball.java (at line 10)\n" + 
18884
    		"	Collections.sort(foo);\n" +
18915
    		"	Collections.sort(foo);\n" + 
18885
    		"	^^^^^^^^^^^^^^^^^^^^^\n" +
18916
    		"	^^^^^^^^^^^^^^^^^^^^^\n" + 
18886
    		"Type safety: Unchecked invocation sort(List<Ball>) of the generic method sort(List<T>) of type Collections\n" +
18917
    		"Type safety: Unchecked invocation sort(LinkedList<Ball>) of the generic method sort(List<T>) of type Collections\n" + 
18887
    		"----------\n" +
18918
    		"----------\n" + 
18888
    		"3. ERROR in Ball.java (at line 12)\n" +
18919
    		"3. ERROR in Ball.java (at line 12)\n" + 
18889
    		"	Zork z;\n" +
18920
    		"	Zork z;\n" + 
18890
    		"	^^^^\n" +
18921
    		"	^^^^\n" + 
18891
    		"Zork cannot be resolved to a type\n" +
18922
    		"Zork cannot be resolved to a type\n" + 
18892
    		"----------\n");
18923
    		"----------\n");
18893
	}
18924
	}
18894
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=81831
18925
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=81831
Lines 22751-22786 Link Here
22751
			"   Zork z;\n" +
22782
			"   Zork z;\n" +
22752
			"}\n",
22783
			"}\n",
22753
		},
22784
		},
22754
		"----------\n" +
22785
		"----------\n" + 
22755
		"1. WARNING in X.java (at line 13)\n" +
22786
		"1. WARNING in X.java (at line 13)\n" + 
22756
		"	public class ActionImpl<T extends Base> extends Action<T> implements Comparable<ActionImpl> {\n" +
22787
		"	public class ActionImpl<T extends Base> extends Action<T> implements Comparable<ActionImpl> {\n" + 
22757
		"	                                                                                ^^^^^^^^^^\n" +
22788
		"	                                                                                ^^^^^^^^^^\n" + 
22758
		"X.ActionImpl is a raw type. References to generic type X.ActionImpl<T> should be parameterized\n" +
22789
		"X.ActionImpl is a raw type. References to generic type X.ActionImpl<T> should be parameterized\n" + 
22759
		"----------\n" +
22790
		"----------\n" + 
22760
		"2. WARNING in X.java (at line 14)\n" +
22791
		"2. WARNING in X.java (at line 14)\n" + 
22761
		"	public int compareTo(ActionImpl o) {\n" +
22792
		"	public int compareTo(ActionImpl o) {\n" + 
22762
		"	                     ^^^^^^^^^^\n" +
22793
		"	                     ^^^^^^^^^^\n" + 
22763
		"X.ActionImpl is a raw type. References to generic type X.ActionImpl<T> should be parameterized\n" +
22794
		"X.ActionImpl is a raw type. References to generic type X.ActionImpl<T> should be parameterized\n" + 
22764
		"----------\n" +
22795
		"----------\n" + 
22765
		"3. WARNING in X.java (at line 20)\n" +
22796
		"3. WARNING in X.java (at line 20)\n" + 
22766
		"	Set<ActionImpl> set = new TreeSet<ActionImpl>();\n" +
22797
		"	Set<ActionImpl> set = new TreeSet<ActionImpl>();\n" + 
22767
		"	    ^^^^^^^^^^\n" +
22798
		"	    ^^^^^^^^^^\n" + 
22768
		"X.ActionImpl is a raw type. References to generic type X.ActionImpl<T> should be parameterized\n" +
22799
		"X.ActionImpl is a raw type. References to generic type X.ActionImpl<T> should be parameterized\n" + 
22769
		"----------\n" +
22800
		"----------\n" + 
22770
		"4. WARNING in X.java (at line 20)\n" +
22801
		"4. WARNING in X.java (at line 20)\n" + 
22771
		"	Set<ActionImpl> set = new TreeSet<ActionImpl>();\n" +
22802
		"	Set<ActionImpl> set = new TreeSet<ActionImpl>();\n" + 
22772
		"	                                  ^^^^^^^^^^\n" +
22803
		"	                                  ^^^^^^^^^^\n" + 
22773
		"X.ActionImpl is a raw type. References to generic type X.ActionImpl<T> should be parameterized\n" +
22804
		"X.ActionImpl is a raw type. References to generic type X.ActionImpl<T> should be parameterized\n" + 
22774
		"----------\n" +
22805
		"----------\n" + 
22775
		"5. WARNING in X.java (at line 21)\n" +
22806
		"5. WARNING in X.java (at line 21)\n" + 
22776
		"	Collections.max(set);\n" +
22807
		"	Collections.max(set);\n" + 
22777
		"	^^^^^^^^^^^^^^^^^^^^\n" +
22808
		"	^^^^^^^^^^^^^^^^^^^^\n" + 
22778
		"Type safety: Unchecked invocation max(Collection<? extends X.ActionImpl>) of the generic method max(Collection<? extends T>) of type Collections\n" +
22809
		"Type safety: Unchecked invocation max(Set<X.ActionImpl>) of the generic method max(Collection<? extends T>) of type Collections\n" + 
22779
		"----------\n" +
22810
		"----------\n" + 
22780
		"6. ERROR in X.java (at line 23)\n" +
22811
		"6. ERROR in X.java (at line 23)\n" + 
22781
		"	Zork z;\n" +
22812
		"	Zork z;\n" + 
22782
		"	^^^^\n" +
22813
		"	^^^^\n" + 
22783
		"Zork cannot be resolved to a type\n" +
22814
		"Zork cannot be resolved to a type\n" + 
22784
		"----------\n");
22815
		"----------\n");
22785
}
22816
}
22786
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=98364
22817
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=98364
Lines 27607-27642 Link Here
27607
			"\n" +
27638
			"\n" +
27608
			"}\n",
27639
			"}\n",
27609
		},
27640
		},
27610
		"----------\n" +
27641
		"----------\n" + 
27611
		"1. WARNING in X.java (at line 20)\n" +
27642
		"1. WARNING in X.java (at line 20)\n" + 
27612
		"	List<List> o = Foo.foo1();\n" +
27643
		"	List<List> o = Foo.foo1();\n" + 
27613
		"	     ^^^^\n" +
27644
		"	     ^^^^\n" + 
27614
		"List is a raw type. References to generic type List<E> should be parameterized\n" +
27645
		"List is a raw type. References to generic type List<E> should be parameterized\n" + 
27615
		"----------\n" +
27646
		"----------\n" + 
27616
		"2. ERROR in X.java (at line 20)\n" +
27647
		"2. ERROR in X.java (at line 20)\n" + 
27617
		"	List<List> o = Foo.foo1();\n" +
27648
		"	List<List> o = Foo.foo1();\n" + 
27618
		"	                   ^^^^\n" +
27649
		"	                   ^^^^\n" + 
27619
		"The method foo1() in the type Foo is not applicable for the arguments ()\n" +
27650
		"The method foo1() in the type Foo is not applicable for the arguments ()\n" + 
27620
		"----------\n" +
27651
		"----------\n" + 
27621
		"3. ERROR in X.java (at line 21)\n" +
27652
		"3. ERROR in X.java (at line 21)\n" + 
27622
		"	Foo.bar1(o);\n" +
27653
		"	Foo.bar1(o);\n" + 
27623
		"	    ^^^^\n" +
27654
		"	    ^^^^\n" + 
27624
		"The method bar1(List<List<T>>) in the type Foo is not applicable for the arguments (List<List>)\n" +
27655
		"The method bar1(List<List<T>>) in the type Foo is not applicable for the arguments (List<List>)\n" + 
27625
		"----------\n" +
27656
		"----------\n" + 
27626
		"4. WARNING in X.java (at line 24)\n" +
27657
		"4. WARNING in X.java (at line 24)\n" + 
27627
		"	List o = Foo.foo2();\n" +
27658
		"	List o = Foo.foo2();\n" + 
27628
		"	^^^^\n" +
27659
		"	^^^^\n" + 
27629
		"List is a raw type. References to generic type List<E> should be parameterized\n" +
27660
		"List is a raw type. References to generic type List<E> should be parameterized\n" + 
27630
		"----------\n" +
27661
		"----------\n" + 
27631
		"5. WARNING in X.java (at line 25)\n" +
27662
		"5. WARNING in X.java (at line 25)\n" + 
27632
		"	Foo.bar2(o);\n" +
27663
		"	Foo.bar2(o);\n" + 
27633
		"	^^^^^^^^^^^\n" +
27664
		"	^^^^^^^^^^^\n" + 
27634
		"Type safety: Unchecked invocation bar2(List) of the generic method bar2(List<T>) of type Foo\n" +
27665
		"Type safety: Unchecked invocation bar2(List) of the generic method bar2(List<T>) of type Foo\n" + 
27635
		"----------\n" +
27666
		"----------\n" + 
27636
		"6. WARNING in X.java (at line 25)\n" +
27667
		"6. WARNING in X.java (at line 25)\n" + 
27637
		"	Foo.bar2(o);\n" +
27668
		"	Foo.bar2(o);\n" + 
27638
		"	         ^\n" +
27669
		"	         ^\n" + 
27639
		"Type safety: The expression of type List needs unchecked conversion to conform to List<T>\n" +
27670
		"Type safety: The expression of type List needs unchecked conversion to conform to List<Runnable>\n" + 
27640
		"----------\n");
27671
		"----------\n");
27641
}
27672
}
27642
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=114365
27673
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=114365
Lines 28272-28292 Link Here
28272
			"	}\n" +
28303
			"	}\n" +
28273
			"}\n" ,
28304
			"}\n" ,
28274
		},
28305
		},
28275
		"----------\n" +
28306
		"----------\n" + 
28276
		"1. ERROR in X.java (at line 7)\n" +
28307
		"1. ERROR in X.java (at line 7)\n" + 
28277
		"	String s = getClass();\n" +
28308
		"	String s = getClass();\n" + 
28278
		"	           ^^^^^^^^^^\n" +
28309
		"	           ^^^^^^^^^^\n" + 
28279
		"Type mismatch: cannot convert from Class<capture#1-of ? extends X> to String\n" +
28310
		"Type mismatch: cannot convert from Class<capture#1-of ? extends X> to String\n" + 
28280
		"----------\n" +
28311
		"----------\n" + 
28281
		"2. ERROR in X.java (at line 8)\n" +
28312
		"2. ERROR in X.java (at line 8)\n" + 
28282
		"	return (String) getDefault(getClass());\n" +
28313
		"	return (String) getDefault(getClass());\n" + 
28283
		"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
28314
		"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
28284
		"Cannot cast from capture#2-of ? extends X to String\n" +
28315
		"Cannot cast from X to String\n" + 
28285
		"----------\n" +
28316
		"----------\n" + 
28286
		"3. WARNING in X.java (at line 8)\n" +
28317
		"3. WARNING in X.java (at line 8)\n" + 
28287
		"	return (String) getDefault(getClass());\n" +
28318
		"	return (String) getDefault(getClass());\n" + 
28288
		"	                ^^^^^^^^^^^^^^^^^^^^^^\n" +
28319
		"	                ^^^^^^^^^^^^^^^^^^^^^^\n" + 
28289
		"Type safety: Unchecked invocation getDefault(Class<capture#2-of ? extends X>) of the generic method getDefault(Class<T>) of type X<C>\n" +
28320
		"Type safety: Unchecked invocation getDefault(Class<capture#2-of ? extends X>) of the generic method getDefault(Class<T>) of type X<C>\n" + 
28290
		"----------\n");
28321
		"----------\n");
28291
}
28322
}
28292
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=125445
28323
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=125445
Lines 30043-30073 Link Here
30043
		"  }\n" +
30074
		"  }\n" +
30044
		"}\n",
30075
		"}\n",
30045
		},
30076
		},
30046
		"----------\n" +
30077
		"----------\n" + 
30047
		"1. WARNING in X.java (at line 6)\n" +
30078
		"1. WARNING in X.java (at line 6)\n" + 
30048
		"	Class<? extends Enum> enumType = null;\n" +
30079
		"	Class<? extends Enum> enumType = null;\n" + 
30049
		"	                ^^^^\n" +
30080
		"	                ^^^^\n" + 
30050
		"Enum is a raw type. References to generic type Enum<E> should be parameterized\n" +
30081
		"Enum is a raw type. References to generic type Enum<E> should be parameterized\n" + 
30051
		"----------\n" +
30082
		"----------\n" + 
30052
		"2. WARNING in X.java (at line 7)\n" +
30083
		"2. WARNING in X.java (at line 7)\n" + 
30053
		"	final Collection<E> test = allOf(enumType);\n" +
30084
		"	final Collection<E> test = allOf(enumType);\n" + 
30054
		"	                           ^^^^^^^^^^^^^^^\n" +
30085
		"	                           ^^^^^^^^^^^^^^^\n" + 
30055
		"Type safety: Unchecked invocation allOf(Class<capture#1-of ? extends Enum>) of the generic method allOf(Class<E>) of type X\n" +
30086
		"Type safety: Unchecked invocation allOf(Class<capture#1-of ? extends Enum>) of the generic method allOf(Class<E>) of type X\n" + 
30056
		"----------\n" +
30087
		"----------\n" + 
30057
		"3. ERROR in X.java (at line 7)\n" +
30088
		"3. WARNING in X.java (at line 7)\n" + 
30058
		"	final Collection<E> test = allOf(enumType);\n" +
30089
		"	final Collection<E> test = allOf(enumType);\n" + 
30059
		"	                           ^^^^^^^^^^^^^^^\n" +
30090
		"	                           ^^^^^^^^^^^^^^^\n" + 
30060
		"Type mismatch: cannot convert from Collection<capture#1-of ? extends Enum> to Collection<E>\n" +
30091
		"Type safety: The expression of type Collection needs unchecked conversion to conform to Collection<E>\n" + 
30061
		"----------\n" +
30092
		"----------\n" + 
30062
		"4. WARNING in X.java (at line 9)\n" +
30093
		"4. WARNING in X.java (at line 9)\n" + 
30063
		"	Collection<? extends Enum> colType = null;\n" +
30094
		"	Collection<? extends Enum> colType = null;\n" + 
30064
		"	                     ^^^^\n" +
30095
		"	                     ^^^^\n" + 
30065
		"Enum is a raw type. References to generic type Enum<E> should be parameterized\n" +
30096
		"Enum is a raw type. References to generic type Enum<E> should be parameterized\n" + 
30066
		"----------\n" +
30097
		"----------\n" + 
30067
		"5. ERROR in X.java (at line 10)\n" +
30098
		"5. ERROR in X.java (at line 10)\n" + 
30068
		"	final Collection<E> test2 = colType;\n" +
30099
		"	final Collection<E> test2 = colType;\n" + 
30069
		"	                            ^^^^^^^\n" +
30100
		"	                            ^^^^^^^\n" + 
30070
		"Type mismatch: cannot convert from Collection<capture#2-of ? extends Enum> to Collection<E>\n" +
30101
		"Type mismatch: cannot convert from Collection<capture#2-of ? extends Enum> to Collection<E>\n" + 
30071
		"----------\n");
30102
		"----------\n");
30072
}
30103
}
30073
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=119238
30104
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=119238
Lines 31106-31126 Link Here
31106
			"    Zork z;\n" +
31137
			"    Zork z;\n" +
31107
			"}\n"
31138
			"}\n"
31108
		},
31139
		},
31109
		"----------\n" +
31140
		"----------\n" + 
31110
		"1. WARNING in X.java (at line 7)\n" +
31141
		"1. WARNING in X.java (at line 7)\n" + 
31111
		"	X x = newInstance();\n" +
31142
		"	X x = newInstance();\n" + 
31112
		"	^\n" +
31143
		"	^\n" + 
31113
		"X is a raw type. References to generic type X<A> should be parameterized\n" +
31144
		"X is a raw type. References to generic type X<A> should be parameterized\n" + 
31114
		"----------\n" +
31145
		"----------\n" + 
31115
		"2. WARNING in X.java (at line 8)\n" +
31146
		"2. ERROR in X.java (at line 7)\n" + 
31116
		"	return new X[] { x };\n" +
31147
		"	X x = newInstance();\n" + 
31117
		"	       ^^^^^^^^^^^^^\n" +
31148
		"	      ^^^^^^^^^^^\n" + 
31118
		"Type safety: The expression of type X[] needs unchecked conversion to conform to X<String>[]\n" +
31149
		"Bound mismatch: The generic method newInstance() of type X<A> is not applicable for the arguments (). The inferred type Comparable<Comparable<B>> is not a valid substitute for the bounded parameter <B extends Comparable<B>>\n" + 
31119
		"----------\n" +
31150
		"----------\n" + 
31120
		"3. ERROR in X.java (at line 10)\n" +
31151
		"3. WARNING in X.java (at line 8)\n" + 
31121
		"	Zork z;\n" +
31152
		"	return new X[] { x };\n" + 
31122
		"	^^^^\n" +
31153
		"	       ^^^^^^^^^^^^^\n" + 
31123
		"Zork cannot be resolved to a type\n" +
31154
		"Type safety: The expression of type X[] needs unchecked conversion to conform to X<String>[]\n" + 
31155
		"----------\n" + 
31156
		"4. ERROR in X.java (at line 10)\n" + 
31157
		"	Zork z;\n" + 
31158
		"	^^^^\n" + 
31159
		"Zork cannot be resolved to a type\n" + 
31124
		"----------\n");
31160
		"----------\n");
31125
}
31161
}
31126
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=118273 - variation
31162
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=118273 - variation
Lines 31163-31169 Link Here
31163
		"5. WARNING in X.java (at line 7)\n" +
31199
		"5. WARNING in X.java (at line 7)\n" +
31164
		"	Comparable c = newInstance2(x);\n" +
31200
		"	Comparable c = newInstance2(x);\n" +
31165
		"	                            ^\n" +
31201
		"	                            ^\n" +
31166
		"Type safety: The expression of type X needs unchecked conversion to conform to X<B>\n" +
31202
		"Type safety: The expression of type X needs unchecked conversion to conform to X<Comparable>\n" +
31167
		"----------\n" +
31203
		"----------\n" +
31168
		"6. ERROR in X.java (at line 9)\n" +
31204
		"6. ERROR in X.java (at line 9)\n" +
31169
		"	Zork z;\n" +
31205
		"	Zork z;\n" +
Lines 32482-32507 Link Here
32482
			"	}\n" +
32518
			"	}\n" +
32483
			"}", // =================
32519
			"}", // =================
32484
		},
32520
		},
32485
		"----------\n" +
32521
		"----------\n" + 
32486
		"1. WARNING in X.java (at line 9)\n" +
32522
		"1. WARNING in X.java (at line 9)\n" + 
32487
		"	Iterator<Number> it1 = X.chain(new Iterator[] { l1.iterator(), l2.iterator() });\n" +
32523
		"	Iterator<Number> it1 = X.chain(new Iterator[] { l1.iterator(), l2.iterator() });\n" + 
32488
		"	                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
32524
		"	                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
32489
		"Type safety: Unchecked invocation chain(Iterator...) of the generic method chain(Iterator<E>...) of type X\n" +
32525
		"Type safety: Unchecked invocation chain(Iterator[]) of the generic method chain(Iterator<E>...) of type X\n" + 
32490
		"----------\n" +
32526
		"----------\n" + 
32491
		"2. WARNING in X.java (at line 9)\n" +
32527
		"2. WARNING in X.java (at line 9)\n" + 
32492
		"	Iterator<Number> it1 = X.chain(new Iterator[] { l1.iterator(), l2.iterator() });\n" +
32528
		"	Iterator<Number> it1 = X.chain(new Iterator[] { l1.iterator(), l2.iterator() });\n" + 
32493
		"	                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
32529
		"	                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
32494
		"Type safety: The expression of type Iterator needs unchecked conversion to conform to Iterator<Number>\n" +
32530
		"Type safety: The expression of type Iterator needs unchecked conversion to conform to Iterator<Number>\n" + 
32495
		"----------\n" +
32531
		"----------\n" + 
32496
		"3. ERROR in X.java (at line 14)\n" +
32532
		"3. WARNING in X.java (at line 9)\n" + 
32497
		"	Iterator<Number> it2 = X.chain(l1.iterator(), l2.iterator());\n" +
32533
		"	Iterator<Number> it1 = X.chain(new Iterator[] { l1.iterator(), l2.iterator() });\n" + 
32498
		"	                         ^^^^^\n" +
32534
		"	                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
32499
		"The method chain(Iterator<E>...) in the type X is not applicable for the arguments (Iterator<Integer>, Iterator<Float>)\n" +
32535
		"Type safety: The expression of type Iterator[] needs unchecked conversion to conform to Iterator<Number>[]\n" + 
32500
		"----------\n" +
32536
		"----------\n" + 
32501
		"4. WARNING in X.java (at line 18)\n" +
32537
		"4. ERROR in X.java (at line 14)\n" + 
32502
		"	Iterator<Number> it2 = X.chain(l1.iterator(), l1.iterator());\n" +
32538
		"	Iterator<Number> it2 = X.chain(l1.iterator(), l2.iterator());\n" + 
32503
		"	                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
32539
		"	                         ^^^^^\n" + 
32504
		"Type safety : A generic array of Iterator<Integer> is created for a varargs parameter\n" +
32540
		"The method chain(Iterator<E>...) in the type X is not applicable for the arguments (Iterator<Integer>, Iterator<Float>)\n" + 
32541
		"----------\n" + 
32542
		"5. WARNING in X.java (at line 18)\n" + 
32543
		"	Iterator<Number> it2 = X.chain(l1.iterator(), l1.iterator());\n" + 
32544
		"	                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
32545
		"Type safety : A generic array of Iterator<Integer> is created for a varargs parameter\n" + 
32505
		"----------\n");
32546
		"----------\n");
32506
}
32547
}
32507
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=144879
32548
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=144879
Lines 32530-32565 Link Here
32530
			"	}\n" +
32571
			"	}\n" +
32531
			"}", // =================
32572
			"}", // =================
32532
		},
32573
		},
32533
		"----------\n" +
32574
		"----------\n" + 
32534
		"1. WARNING in X.java (at line 9)\n" +
32575
		"1. WARNING in X.java (at line 9)\n" + 
32535
		"	Iterator<Number> it1 = X.chain(new Iterator[] { l1.iterator(), l2.iterator() });\n" +
32576
		"	Iterator<Number> it1 = X.chain(new Iterator[] { l1.iterator(), l2.iterator() });\n" + 
32536
		"	                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
32577
		"	                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
32537
		"Type safety: Unchecked invocation chain(Iterator...) of the generic method chain(Iterator<? extends T>...) of type X\n" +
32578
		"Type safety: Unchecked invocation chain(Iterator[]) of the generic method chain(Iterator<? extends T>...) of type X\n" + 
32538
		"----------\n" +
32579
		"----------\n" + 
32539
		"2. WARNING in X.java (at line 9)\n" +
32580
		"2. WARNING in X.java (at line 9)\n" + 
32540
		"	Iterator<Number> it1 = X.chain(new Iterator[] { l1.iterator(), l2.iterator() });\n" +
32581
		"	Iterator<Number> it1 = X.chain(new Iterator[] { l1.iterator(), l2.iterator() });\n" + 
32541
		"	                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
32582
		"	                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
32542
		"Type safety: The expression of type Iterator needs unchecked conversion to conform to Iterator<Number>\n" +
32583
		"Type safety: The expression of type Iterator needs unchecked conversion to conform to Iterator<Number>\n" + 
32543
		"----------\n" +
32584
		"----------\n" + 
32544
		"3. WARNING in X.java (at line 14)\n" +
32585
		"3. WARNING in X.java (at line 9)\n" + 
32545
		"	Iterator<Number> it2 = X.chain(l1.iterator(), l2.iterator());\n" +
32586
		"	Iterator<Number> it1 = X.chain(new Iterator[] { l1.iterator(), l2.iterator() });\n" + 
32546
		"	                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
32587
		"	                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
32547
		"Type safety : A generic array of Iterator<? extends Number&Comparable<?>> is created for a varargs parameter\n" +
32588
		"Type safety: The expression of type Iterator[] needs unchecked conversion to conform to Iterator<? extends Number>[]\n" + 
32548
		"----------\n" +
32589
		"----------\n" + 
32549
		"4. ERROR in X.java (at line 14)\n" +
32590
		"4. WARNING in X.java (at line 14)\n" + 
32550
		"	Iterator<Number> it2 = X.chain(l1.iterator(), l2.iterator());\n" +
32591
		"	Iterator<Number> it2 = X.chain(l1.iterator(), l2.iterator());\n" + 
32551
		"	                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
32592
		"	                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
32552
		"Type mismatch: cannot convert from Iterator<Number&Comparable<?>> to Iterator<Number>\n" +
32593
		"Type safety : A generic array of Iterator<? extends Number&Comparable<?>> is created for a varargs parameter\n" + 
32553
		"----------\n" +
32594
		"----------\n" + 
32554
		"5. WARNING in X.java (at line 18)\n" +
32595
		"5. ERROR in X.java (at line 14)\n" + 
32555
		"	Iterator<Number> it2 = X.chain(l1.iterator(), l1.iterator());\n" +
32596
		"	Iterator<Number> it2 = X.chain(l1.iterator(), l2.iterator());\n" + 
32556
		"	                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
32597
		"	                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
32557
		"Type safety : A generic array of Iterator<? extends Integer> is created for a varargs parameter\n" +
32598
		"Type mismatch: cannot convert from Iterator<Number&Comparable<?>> to Iterator<Number>\n" + 
32558
		"----------\n" +
32599
		"----------\n" + 
32559
		"6. ERROR in X.java (at line 18)\n" +
32600
		"6. WARNING in X.java (at line 18)\n" + 
32560
		"	Iterator<Number> it2 = X.chain(l1.iterator(), l1.iterator());\n" +
32601
		"	Iterator<Number> it2 = X.chain(l1.iterator(), l1.iterator());\n" + 
32561
		"	                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
32602
		"	                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
32562
		"Type mismatch: cannot convert from Iterator<Integer> to Iterator<Number>\n" +
32603
		"Type safety : A generic array of Iterator<? extends Integer> is created for a varargs parameter\n" + 
32604
		"----------\n" + 
32605
		"7. ERROR in X.java (at line 18)\n" + 
32606
		"	Iterator<Number> it2 = X.chain(l1.iterator(), l1.iterator());\n" + 
32607
		"	                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
32608
		"Type mismatch: cannot convert from Iterator<Integer> to Iterator<Number>\n" + 
32563
		"----------\n");
32609
		"----------\n");
32564
}
32610
}
32565
public void test1001() {
32611
public void test1001() {
Lines 32770-32776 Link Here
32770
			"		X x = bar(l, c);\n" +
32816
			"		X x = bar(l, c);\n" +
32771
			"	}\n" +
32817
			"	}\n" +
32772
			"	<T> T bar(L<T> l, C<? extends T> c) { \n" +
32818
			"	<T> T bar(L<T> l, C<? extends T> c) { \n" +
32773
			"		return null;\n" +
32819
			"		return zork;\n" +
32774
			"	}	\n" +
32820
			"	}	\n" +
32775
			"}\n" +
32821
			"}\n" +
32776
			"class C<E> {}\n" +
32822
			"class C<E> {}\n" +
Lines 32778-32803 Link Here
32778
			"\n" +
32824
			"\n" +
32779
			"\n", // =================
32825
			"\n", // =================
32780
		},
32826
		},
32781
		"----------\n" +
32827
		"----------\n" + 
32782
		"1. WARNING in X.java (at line 2)\r\n" +
32828
		"1. WARNING in X.java (at line 2)\n" + 
32783
		"	void foo(L l, C<? extends X> c) {\r\n" +
32829
		"	void foo(L l, C<? extends X> c) {\n" + 
32784
		"	         ^\n" +
32830
		"	         ^\n" + 
32785
		"L is a raw type. References to generic type L<E> should be parameterized\n" +
32831
		"L is a raw type. References to generic type L<E> should be parameterized\n" + 
32786
		"----------\n" +
32832
		"----------\n" + 
32787
		"2. WARNING in X.java (at line 3)\r\n" +
32833
		"2. WARNING in X.java (at line 3)\n" + 
32788
		"	X x = bar(l, c);\r\n" +
32834
		"	X x = bar(l, c);\n" + 
32789
		"	      ^^^^^^^^^\n" +
32835
		"	      ^^^^^^^^^\n" + 
32790
		"Type safety: Unchecked invocation bar(L, C) of the generic method bar(L<T>, C<? extends T>) of type X\n" +
32836
		"Type safety: Unchecked invocation bar(L, C<capture#1-of ? extends X>) of the generic method bar(L<T>, C<? extends T>) of type X\n" + 
32791
		"----------\n" +
32837
		"----------\n" + 
32792
		"3. ERROR in X.java (at line 3)\r\n" +
32838
		"3. ERROR in X.java (at line 3)\n" + 
32793
		"	X x = bar(l, c);\r\n" +
32839
		"	X x = bar(l, c);\n" + 
32794
		"	      ^^^^^^^^^\n" +
32840
		"	      ^^^^^^^^^\n" + 
32795
		"Type mismatch: cannot convert from Object to X\n" +
32841
		"Type mismatch: cannot convert from Object to X\n" + 
32796
		"----------\n" +
32842
		"----------\n" + 
32797
		"4. WARNING in X.java (at line 3)\r\n" +
32843
		"4. WARNING in X.java (at line 3)\n" + 
32798
		"	X x = bar(l, c);\r\n" +
32844
		"	X x = bar(l, c);\n" + 
32799
		"	          ^\n" +
32845
		"	          ^\n" + 
32800
		"Type safety: The expression of type L needs unchecked conversion to conform to L<T>\n" +
32846
		"Type safety: The expression of type L needs unchecked conversion to conform to L<X>\n" + 
32847
		"----------\n" + 
32848
		"5. ERROR in X.java (at line 6)\n" + 
32849
		"	return zork;\n" + 
32850
		"	       ^^^^\n" + 
32851
		"zork cannot be resolved\n" + 
32801
		"----------\n",
32852
		"----------\n",
32802
		JavacTestOptions.EclipseJustification.EclipseBug148061);
32853
		JavacTestOptions.EclipseJustification.EclipseBug148061);
32803
}
32854
}
Lines 32873-32903 Link Here
32873
			"	<U> void bar3(Map<String,String> map, U s, Map<U,U> map2) {}\n" +
32924
			"	<U> void bar3(Map<String,String> map, U s, Map<U,U> map2) {}\n" +
32874
			"}\n", // =================
32925
			"}\n", // =================
32875
		},
32926
		},
32876
		"----------\n" +
32927
		"----------\n" + 
32877
		"1. WARNING in X.java (at line 3)\n" +
32928
		"1. WARNING in X.java (at line 3)\n" + 
32878
		"	void foo(HashMap map, String s, Map<String,String> map2) {\n" +
32929
		"	void foo(HashMap map, String s, Map<String,String> map2) {\n" + 
32879
		"	         ^^^^^^^\n" +
32930
		"	         ^^^^^^^\n" + 
32880
		"HashMap is a raw type. References to generic type HashMap<K,V> should be parameterized\n" +
32931
		"HashMap is a raw type. References to generic type HashMap<K,V> should be parameterized\n" + 
32881
		"----------\n" +
32932
		"----------\n" + 
32882
		"2. WARNING in X.java (at line 4)\n" +
32933
		"2. WARNING in X.java (at line 4)\n" + 
32883
		"	bar(map, s, map2); //1\n" +
32934
		"	bar(map, s, map2); //1\n" + 
32884
		"	^^^^^^^^^^^^^^^^^\n" +
32935
		"	^^^^^^^^^^^^^^^^^\n" + 
32885
		"Type safety: Unchecked invocation bar(Map, Object, Map) of the generic method bar(Map<U,U>, U, Map<U,U>) of type X\n" +
32936
		"Type safety: Unchecked invocation bar(HashMap, String, Map<String,String>) of the generic method bar(Map<U,U>, U, Map<U,U>) of type X\n" + 
32886
		"----------\n" +
32937
		"----------\n" + 
32887
		"3. WARNING in X.java (at line 4)\n" +
32938
		"3. WARNING in X.java (at line 4)\n" + 
32888
		"	bar(map, s, map2); //1\n" +
32939
		"	bar(map, s, map2); //1\n" + 
32889
		"	    ^^^\n" +
32940
		"	    ^^^\n" + 
32890
		"Type safety: The expression of type HashMap needs unchecked conversion to conform to Map<U,U>\n" +
32941
		"Type safety: The expression of type HashMap needs unchecked conversion to conform to Map<String,String>\n" + 
32891
		"----------\n" +
32942
		"----------\n" + 
32892
		"4. WARNING in X.java (at line 6)\n" +
32943
		"4. WARNING in X.java (at line 6)\n" + 
32893
		"	bar2(map, s, map2); //3\n" +
32944
		"	bar2(map, s, map2); //3\n" + 
32894
		"	     ^^^\n" +
32945
		"	     ^^^\n" + 
32895
		"Type safety: The expression of type HashMap needs unchecked conversion to conform to Map<String,String>\n" +
32946
		"Type safety: The expression of type HashMap needs unchecked conversion to conform to Map<String,String>\n" + 
32896
		"----------\n" +
32947
		"----------\n" + 
32897
		"5. WARNING in X.java (at line 7)\n" +
32948
		"5. WARNING in X.java (at line 7)\n" + 
32898
		"	bar3(map, s, map2); //4\n" +
32949
		"	bar3(map, s, map2); //4\n" + 
32899
		"	     ^^^\n" +
32950
		"	^^^^^^^^^^^^^^^^^^\n" + 
32900
		"Type safety: The expression of type HashMap needs unchecked conversion to conform to Map<String,String>\n" +
32951
		"Type safety: Unchecked invocation bar3(HashMap, String, Map<String,String>) of the generic method bar3(Map<String,String>, U, Map<U,U>) of type X\n" + 
32952
		"----------\n" + 
32953
		"6. WARNING in X.java (at line 7)\n" + 
32954
		"	bar3(map, s, map2); //4\n" + 
32955
		"	     ^^^\n" + 
32956
		"Type safety: The expression of type HashMap needs unchecked conversion to conform to Map<String,String>\n" + 
32901
		"----------\n");
32957
		"----------\n");
32902
}
32958
}
32903
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=148061 - variation
32959
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=148061 - variation
Lines 32918-32980 Link Here
32918
			"		return null;\n" +
32974
			"		return null;\n" +
32919
			"	}\n" +
32975
			"	}\n" +
32920
			"	<T> C<T> bar3(L<T> l, C<T> c) {\n" +
32976
			"	<T> C<T> bar3(L<T> l, C<T> c) {\n" +
32921
			"		return null;\n" +
32977
			"		return zork;\n" +
32922
			"	}\n" +
32978
			"	}\n" +
32923
			"}\n" +
32979
			"}\n" +
32924
			"\n" +
32980
			"\n" +
32925
			"class C<E> {}\n" +
32981
			"class C<E> {}\n" +
32926
			"class L<E> {}\n", // =================
32982
			"class L<E> {}\n", // =================
32927
		},
32983
		},
32928
		"----------\n" +
32984
		"----------\n" + 
32929
		"1. WARNING in X.java (at line 2)\r\n" +
32985
		"1. WARNING in X.java (at line 2)\n" + 
32930
		"	void foo(L l, C<X> c) {\r\n" +
32986
		"	void foo(L l, C<X> c) {\n" + 
32931
		"	         ^\n" +
32987
		"	         ^\n" + 
32932
		"L is a raw type. References to generic type L<E> should be parameterized\n" +
32988
		"L is a raw type. References to generic type L<E> should be parameterized\n" + 
32933
		"----------\n" +
32989
		"----------\n" + 
32934
		"2. WARNING in X.java (at line 3)\r\n" +
32990
		"2. WARNING in X.java (at line 3)\n" + 
32935
		"	X x = bar1(l, c);\r\n" +
32991
		"	X x = bar1(l, c);\n" + 
32936
		"	      ^^^^^^^^^^\n" +
32992
		"	      ^^^^^^^^^^\n" + 
32937
		"Type safety: Unchecked invocation bar1(L, C) of the generic method bar1(L<T>, C<T>) of type X\n" +
32993
		"Type safety: Unchecked invocation bar1(L, C<X>) of the generic method bar1(L<T>, C<T>) of type X\n" + 
32938
		"----------\n" +
32994
		"----------\n" + 
32939
		"3. ERROR in X.java (at line 3)\r\n" +
32995
		"3. ERROR in X.java (at line 3)\n" + 
32940
		"	X x = bar1(l, c);\r\n" +
32996
		"	X x = bar1(l, c);\n" + 
32941
		"	      ^^^^^^^^^^\n" +
32997
		"	      ^^^^^^^^^^\n" + 
32942
		"Type mismatch: cannot convert from Object to X\n" +
32998
		"Type mismatch: cannot convert from Object to X\n" + 
32943
		"----------\n" +
32999
		"----------\n" + 
32944
		"4. WARNING in X.java (at line 3)\r\n" +
33000
		"4. WARNING in X.java (at line 3)\n" + 
32945
		"	X x = bar1(l, c);\r\n" +
33001
		"	X x = bar1(l, c);\n" + 
32946
		"	           ^\n" +
33002
		"	           ^\n" + 
32947
		"Type safety: The expression of type L needs unchecked conversion to conform to L<T>\n" +
33003
		"Type safety: The expression of type L needs unchecked conversion to conform to L<X>\n" + 
32948
		"----------\n" +
33004
		"----------\n" + 
32949
		"5. WARNING in X.java (at line 4)\r\n" +
33005
		"5. WARNING in X.java (at line 4)\n" + 
32950
		"	L<X> lx = bar2(l, c);\r\n" +
33006
		"	L<X> lx = bar2(l, c);\n" + 
32951
		"	          ^^^^^^^^^^\n" +
33007
		"	          ^^^^^^^^^^\n" + 
32952
		"Type safety: Unchecked invocation bar2(L, C) of the generic method bar2(L<T>, C<T>) of type X\n" +
33008
		"Type safety: Unchecked invocation bar2(L, C<X>) of the generic method bar2(L<T>, C<T>) of type X\n" + 
32953
		"----------\n" +
33009
		"----------\n" + 
32954
		"6. WARNING in X.java (at line 4)\r\n" +
33010
		"6. WARNING in X.java (at line 4)\n" + 
32955
		"	L<X> lx = bar2(l, c);\r\n" +
33011
		"	L<X> lx = bar2(l, c);\n" + 
32956
		"	          ^^^^^^^^^^\n" +
33012
		"	          ^^^^^^^^^^\n" + 
32957
		"Type safety: The expression of type L needs unchecked conversion to conform to L<X>\n" +
33013
		"Type safety: The expression of type L needs unchecked conversion to conform to L<X>\n" + 
32958
		"----------\n" +
33014
		"----------\n" + 
32959
		"7. WARNING in X.java (at line 4)\r\n" +
33015
		"7. WARNING in X.java (at line 4)\n" + 
32960
		"	L<X> lx = bar2(l, c);\r\n" +
33016
		"	L<X> lx = bar2(l, c);\n" + 
32961
		"	               ^\n" +
33017
		"	               ^\n" + 
32962
		"Type safety: The expression of type L needs unchecked conversion to conform to L<T>\n" +
33018
		"Type safety: The expression of type L needs unchecked conversion to conform to L<X>\n" + 
32963
		"----------\n" +
33019
		"----------\n" + 
32964
		"8. WARNING in X.java (at line 5)\r\n" +
33020
		"8. WARNING in X.java (at line 5)\n" + 
32965
		"	C<X> cx = bar3(l, c);\r\n" +
33021
		"	C<X> cx = bar3(l, c);\n" + 
32966
		"	          ^^^^^^^^^^\n" +
33022
		"	          ^^^^^^^^^^\n" + 
32967
		"Type safety: Unchecked invocation bar3(L, C) of the generic method bar3(L<T>, C<T>) of type X\n" +
33023
		"Type safety: Unchecked invocation bar3(L, C<X>) of the generic method bar3(L<T>, C<T>) of type X\n" + 
32968
		"----------\n" +
33024
		"----------\n" + 
32969
		"9. WARNING in X.java (at line 5)\r\n" +
33025
		"9. WARNING in X.java (at line 5)\n" + 
32970
		"	C<X> cx = bar3(l, c);\r\n" +
33026
		"	C<X> cx = bar3(l, c);\n" + 
32971
		"	          ^^^^^^^^^^\n" +
33027
		"	          ^^^^^^^^^^\n" + 
32972
		"Type safety: The expression of type C needs unchecked conversion to conform to C<X>\n" +
33028
		"Type safety: The expression of type C needs unchecked conversion to conform to C<X>\n" + 
32973
		"----------\n" +
33029
		"----------\n" + 
32974
		"10. WARNING in X.java (at line 5)\r\n" +
33030
		"10. WARNING in X.java (at line 5)\n" + 
32975
		"	C<X> cx = bar3(l, c);\r\n" +
33031
		"	C<X> cx = bar3(l, c);\n" + 
32976
		"	               ^\n" +
33032
		"	               ^\n" + 
32977
		"Type safety: The expression of type L needs unchecked conversion to conform to L<T>\n" +
33033
		"Type safety: The expression of type L needs unchecked conversion to conform to L<X>\n" + 
33034
		"----------\n" + 
33035
		"11. ERROR in X.java (at line 14)\n" + 
33036
		"	return zork;\n" + 
33037
		"	       ^^^^\n" + 
33038
		"zork cannot be resolved\n" + 
32978
		"----------\n",
33039
		"----------\n",
32979
		JavacTestOptions.EclipseJustification.EclipseBug148061);
33040
		JavacTestOptions.EclipseJustification.EclipseBug148061);
32980
}
33041
}
Lines 33010-33050 Link Here
33010
			"	}\n" +
33071
			"	}\n" +
33011
			"}\n", // =================
33072
			"}\n", // =================
33012
		},
33073
		},
33013
		"----------\n" +
33074
		"----------\n" + 
33014
		"1. WARNING in X.java (at line 14)\r\n" +
33075
		"1. WARNING in X.java (at line 14)\n" + 
33015
		"	void foo(List l1, List<X> l2) {\r\n" +
33076
		"	void foo(List l1, List<X> l2) {\n" + 
33016
		"	         ^^^^\n" +
33077
		"	         ^^^^\n" + 
33017
		"List is a raw type. References to generic type List<E> should be parameterized\n" +
33078
		"List is a raw type. References to generic type List<E> should be parameterized\n" + 
33018
		"----------\n" +
33079
		"----------\n" + 
33019
		"2. WARNING in X.java (at line 15)\r\n" +
33080
		"2. WARNING in X.java (at line 15)\n" + 
33020
		"	X x = bar1(l1, l2);\r\n" +
33081
		"	X x = bar1(l1, l2);\n" + 
33021
		"	      ^^^^^^^^^^^^\n" +
33082
		"	      ^^^^^^^^^^^^\n" + 
33022
		"Type safety: Unchecked invocation bar1(List, List) of the generic method bar1(List<T>, List<T>) of type X\n" +
33083
		"Type safety: Unchecked invocation bar1(List, List<X>) of the generic method bar1(List<T>, List<T>) of type X\n" + 
33023
		"----------\n" +
33084
		"----------\n" + 
33024
		"3. ERROR in X.java (at line 15)\r\n" +
33085
		"3. ERROR in X.java (at line 15)\n" + 
33025
		"	X x = bar1(l1, l2);\r\n" +
33086
		"	X x = bar1(l1, l2);\n" + 
33026
		"	      ^^^^^^^^^^^^\n" +
33087
		"	      ^^^^^^^^^^^^\n" + 
33027
		"Type mismatch: cannot convert from Object to X\n" +
33088
		"Type mismatch: cannot convert from Object to X\n" + 
33028
		"----------\n" +
33089
		"----------\n" + 
33029
		"4. WARNING in X.java (at line 15)\r\n" +
33090
		"4. WARNING in X.java (at line 15)\n" + 
33030
		"	X x = bar1(l1, l2);\r\n" +
33091
		"	X x = bar1(l1, l2);\n" + 
33031
		"	           ^^\n" +
33092
		"	           ^^\n" + 
33032
		"Type safety: The expression of type List needs unchecked conversion to conform to List<T>\n" +
33093
		"Type safety: The expression of type List needs unchecked conversion to conform to List<X>\n" + 
33033
		"----------\n" +
33094
		"----------\n" + 
33034
		"5. WARNING in X.java (at line 17)\r\n" +
33095
		"5. WARNING in X.java (at line 17)\n" + 
33035
		"	List<X> lx = bar2(l1, l2);\r\n" +
33096
		"	List<X> lx = bar2(l1, l2);\n" + 
33036
		"	             ^^^^^^^^^^^^\n" +
33097
		"	             ^^^^^^^^^^^^\n" + 
33037
		"Type safety: Unchecked invocation bar2(List, List) of the generic method bar2(List<T>, List<T>) of type X\n" +
33098
		"Type safety: Unchecked invocation bar2(List, List<X>) of the generic method bar2(List<T>, List<T>) of type X\n" + 
33038
		"----------\n" +
33099
		"----------\n" + 
33039
		"6. WARNING in X.java (at line 17)\r\n" +
33100
		"6. WARNING in X.java (at line 17)\n" + 
33040
		"	List<X> lx = bar2(l1, l2);\r\n" +
33101
		"	List<X> lx = bar2(l1, l2);\n" + 
33041
		"	             ^^^^^^^^^^^^\n" +
33102
		"	             ^^^^^^^^^^^^\n" + 
33042
		"Type safety: The expression of type List needs unchecked conversion to conform to List<X>\n" +
33103
		"Type safety: The expression of type List needs unchecked conversion to conform to List<X>\n" + 
33043
		"----------\n" +
33104
		"----------\n" + 
33044
		"7. WARNING in X.java (at line 17)\r\n" +
33105
		"7. WARNING in X.java (at line 17)\n" + 
33045
		"	List<X> lx = bar2(l1, l2);\r\n" +
33106
		"	List<X> lx = bar2(l1, l2);\n" + 
33046
		"	                  ^^\n" +
33107
		"	                  ^^\n" + 
33047
		"Type safety: The expression of type List needs unchecked conversion to conform to List<T>\n" +
33108
		"Type safety: The expression of type List needs unchecked conversion to conform to List<X>\n" + 
33048
		"----------\n",
33109
		"----------\n",
33049
		JavacTestOptions.EclipseJustification.EclipseBug148061);
33110
		JavacTestOptions.EclipseJustification.EclipseBug148061);
33050
}
33111
}
Lines 33063-33103 Link Here
33063
			"	<U,V> Map<U,V> bar(List<U> lu, List<V> lv) { return null; }\n" +
33124
			"	<U,V> Map<U,V> bar(List<U> lu, List<V> lv) { return null; }\n" +
33064
			"}\n", // =================
33125
			"}\n", // =================
33065
		},
33126
		},
33066
		"----------\n" +
33127
		"----------\n" + 
33067
		"1. WARNING in X.java (at line 4)\n" +
33128
		"1. WARNING in X.java (at line 4)\n" + 
33068
		"	void foo1(List l, List<String> ls) {\n" +
33129
		"	void foo1(List l, List<String> ls) {\n" + 
33069
		"	          ^^^^\n" +
33130
		"	          ^^^^\n" + 
33070
		"List is a raw type. References to generic type List<E> should be parameterized\n" +
33131
		"List is a raw type. References to generic type List<E> should be parameterized\n" + 
33071
		"----------\n" +
33132
		"----------\n" + 
33072
		"2. WARNING in X.java (at line 5)\n" +
33133
		"2. WARNING in X.java (at line 5)\n" + 
33073
		"	Set<Map.Entry<String,String>> mss1 = bar(l, ls).entrySet();\n" +
33134
		"	Set<Map.Entry<String,String>> mss1 = bar(l, ls).entrySet();\n" + 
33074
		"	                                     ^^^^^^^^^^\n" +
33135
		"	                                     ^^^^^^^^^^\n" + 
33075
		"Type safety: Unchecked invocation bar(List, List) of the generic method bar(List<U>, List<V>) of type X\n" +
33136
		"Type safety: Unchecked invocation bar(List, List<String>) of the generic method bar(List<U>, List<V>) of type X\n" + 
33076
		"----------\n" +
33137
		"----------\n" + 
33077
		"3. WARNING in X.java (at line 5)\n" +
33138
		"3. WARNING in X.java (at line 5)\n" + 
33078
		"	Set<Map.Entry<String,String>> mss1 = bar(l, ls).entrySet();\n" +
33139
		"	Set<Map.Entry<String,String>> mss1 = bar(l, ls).entrySet();\n" + 
33079
		"	                                     ^^^^^^^^^^^^^^^^^^^^^\n" +
33140
		"	                                     ^^^^^^^^^^^^^^^^^^^^^\n" + 
33080
		"Type safety: The expression of type Set needs unchecked conversion to conform to Set<Map.Entry<String,String>>\n" +
33141
		"Type safety: The expression of type Set needs unchecked conversion to conform to Set<Map.Entry<String,String>>\n" + 
33081
		"----------\n" +
33142
		"----------\n" + 
33082
		"4. WARNING in X.java (at line 5)\n" +
33143
		"4. WARNING in X.java (at line 5)\n" + 
33083
		"	Set<Map.Entry<String,String>> mss1 = bar(l, ls).entrySet();\n" +
33144
		"	Set<Map.Entry<String,String>> mss1 = bar(l, ls).entrySet();\n" + 
33084
		"	                                         ^\n" +
33145
		"	                                         ^\n" + 
33085
		"Type safety: The expression of type List needs unchecked conversion to conform to List<U>\n" +
33146
		"Type safety: The expression of type List needs unchecked conversion to conform to List<Object>\n" + 
33086
		"----------\n" +
33147
		"----------\n" + 
33087
		"5. WARNING in X.java (at line 6)\n" +
33148
		"5. WARNING in X.java (at line 6)\n" + 
33088
		"	String s = bar(l, ls).entrySet();\n" +
33149
		"	String s = bar(l, ls).entrySet();\n" + 
33089
		"	           ^^^^^^^^^^\n" +
33150
		"	           ^^^^^^^^^^\n" + 
33090
		"Type safety: Unchecked invocation bar(List, List) of the generic method bar(List<U>, List<V>) of type X\n" +
33151
		"Type safety: Unchecked invocation bar(List, List<String>) of the generic method bar(List<U>, List<V>) of type X\n" + 
33091
		"----------\n" +
33152
		"----------\n" + 
33092
		"6. ERROR in X.java (at line 6)\n" +
33153
		"6. ERROR in X.java (at line 6)\n" + 
33093
		"	String s = bar(l, ls).entrySet();\n" +
33154
		"	String s = bar(l, ls).entrySet();\n" + 
33094
		"	           ^^^^^^^^^^^^^^^^^^^^^\n" +
33155
		"	           ^^^^^^^^^^^^^^^^^^^^^\n" + 
33095
		"Type mismatch: cannot convert from Set to String\n" +
33156
		"Type mismatch: cannot convert from Set to String\n" + 
33096
		"----------\n" +
33157
		"----------\n" + 
33097
		"7. WARNING in X.java (at line 6)\n" +
33158
		"7. WARNING in X.java (at line 6)\n" + 
33098
		"	String s = bar(l, ls).entrySet();\n" +
33159
		"	String s = bar(l, ls).entrySet();\n" + 
33099
		"	               ^\n" +
33160
		"	               ^\n" + 
33100
		"Type safety: The expression of type List needs unchecked conversion to conform to List<U>\n" +
33161
		"Type safety: The expression of type List needs unchecked conversion to conform to List<Object>\n" + 
33101
		"----------\n");
33162
		"----------\n");
33102
}
33163
}
33103
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=148061 - variation
33164
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=148061 - variation
Lines 33114-33154 Link Here
33114
			"	<U,V> List<V> bar(List<U> lu, List<V> lv) { return null; }\n" +
33175
			"	<U,V> List<V> bar(List<U> lu, List<V> lv) { return null; }\n" +
33115
			"}\n", // =================
33176
			"}\n", // =================
33116
		},
33177
		},
33117
		"----------\n" +
33178
		"----------\n" + 
33118
		"1. WARNING in X.java (at line 3)\n" +
33179
		"1. WARNING in X.java (at line 3)\n" + 
33119
		"	void foo1(List l, List<String> ls) {\n" +
33180
		"	void foo1(List l, List<String> ls) {\n" + 
33120
		"	          ^^^^\n" +
33181
		"	          ^^^^\n" + 
33121
		"List is a raw type. References to generic type List<E> should be parameterized\n" +
33182
		"List is a raw type. References to generic type List<E> should be parameterized\n" + 
33122
		"----------\n" +
33183
		"----------\n" + 
33123
		"2. WARNING in X.java (at line 4)\n" +
33184
		"2. WARNING in X.java (at line 4)\n" + 
33124
		"	List<String> ls1 = bar(l, ls);\n" +
33185
		"	List<String> ls1 = bar(l, ls);\n" + 
33125
		"	                   ^^^^^^^^^^\n" +
33186
		"	                   ^^^^^^^^^^\n" + 
33126
		"Type safety: Unchecked invocation bar(List, List) of the generic method bar(List<U>, List<V>) of type X\n" +
33187
		"Type safety: Unchecked invocation bar(List, List<String>) of the generic method bar(List<U>, List<V>) of type X\n" + 
33127
		"----------\n" +
33188
		"----------\n" + 
33128
		"3. WARNING in X.java (at line 4)\n" +
33189
		"3. WARNING in X.java (at line 4)\n" + 
33129
		"	List<String> ls1 = bar(l, ls);\n" +
33190
		"	List<String> ls1 = bar(l, ls);\n" + 
33130
		"	                   ^^^^^^^^^^\n" +
33191
		"	                   ^^^^^^^^^^\n" + 
33131
		"Type safety: The expression of type List needs unchecked conversion to conform to List<String>\n" +
33192
		"Type safety: The expression of type List needs unchecked conversion to conform to List<String>\n" + 
33132
		"----------\n" +
33193
		"----------\n" + 
33133
		"4. WARNING in X.java (at line 4)\n" +
33194
		"4. WARNING in X.java (at line 4)\n" + 
33134
		"	List<String> ls1 = bar(l, ls);\n" +
33195
		"	List<String> ls1 = bar(l, ls);\n" + 
33135
		"	                       ^\n" +
33196
		"	                       ^\n" + 
33136
		"Type safety: The expression of type List needs unchecked conversion to conform to List<U>\n" +
33197
		"Type safety: The expression of type List needs unchecked conversion to conform to List<Object>\n" + 
33137
		"----------\n" +
33198
		"----------\n" + 
33138
		"5. WARNING in X.java (at line 5)\n" +
33199
		"5. WARNING in X.java (at line 5)\n" + 
33139
		"	String s = bar(l, ls);\n" +
33200
		"	String s = bar(l, ls);\n" + 
33140
		"	           ^^^^^^^^^^\n" +
33201
		"	           ^^^^^^^^^^\n" + 
33141
		"Type safety: Unchecked invocation bar(List, List) of the generic method bar(List<U>, List<V>) of type X\n" +
33202
		"Type safety: Unchecked invocation bar(List, List<String>) of the generic method bar(List<U>, List<V>) of type X\n" + 
33142
		"----------\n" +
33203
		"----------\n" + 
33143
		"6. ERROR in X.java (at line 5)\n" +
33204
		"6. ERROR in X.java (at line 5)\n" + 
33144
		"	String s = bar(l, ls);\n" +
33205
		"	String s = bar(l, ls);\n" + 
33145
		"	           ^^^^^^^^^^\n" +
33206
		"	           ^^^^^^^^^^\n" + 
33146
		"Type mismatch: cannot convert from List to String\n" +
33207
		"Type mismatch: cannot convert from List to String\n" + 
33147
		"----------\n" +
33208
		"----------\n" + 
33148
		"7. WARNING in X.java (at line 5)\n" +
33209
		"7. WARNING in X.java (at line 5)\n" + 
33149
		"	String s = bar(l, ls);\n" +
33210
		"	String s = bar(l, ls);\n" + 
33150
		"	               ^\n" +
33211
		"	               ^\n" + 
33151
		"Type safety: The expression of type List needs unchecked conversion to conform to List<U>\n" +
33212
		"Type safety: The expression of type List needs unchecked conversion to conform to List<Object>\n" + 
33152
		"----------\n");
33213
		"----------\n");
33153
}
33214
}
33154
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=148061 - variation
33215
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=148061 - variation
Lines 33926-33941 Link Here
33926
			"}", // =================
33987
			"}", // =================
33927
33988
33928
		},
33989
		},
33929
		"----------\n" +
33990
		"----------\n" + 
33930
		"1. WARNING in ComparableComparator.java (at line 14)\n" +
33991
		"1. WARNING in ComparableComparator.java (at line 14)\n" + 
33931
		"	static <M extends String> Comparator<M> baz() {\n" +
33992
		"	static <M extends String> Comparator<M> baz() {\n" + 
33932
		"	                  ^^^^^^\n" +
33993
		"	                  ^^^^^^\n" + 
33933
		"The type parameter M should not be bounded by the final type String. Final types cannot be further extended\n" +
33994
		"The type parameter M should not be bounded by the final type String. Final types cannot be further extended\n" + 
33934
		"----------\n" +
33995
		"----------\n" + 
33935
		"2. ERROR in ComparableComparator.java (at line 27)\n" +
33996
		"2. ERROR in ComparableComparator.java (at line 25)\n" + 
33936
		"	static Object BAR2 = ComparableComparator.bar();//1a\n" +
33997
		"	static Comparator BAR = ComparableComparator.bar();//0\n" + 
33937
		"	                                          ^^^\n" +
33998
		"	                                             ^^^\n" + 
33938
		"Bound mismatch: The generic method bar() of type ComparableComparator<T> is not applicable for the arguments (). The inferred type Comparable<Comparable<M>> is not a valid substitute for the bounded parameter <M extends Comparable<M>>\n" +
33999
		"Bound mismatch: The generic method bar() of type ComparableComparator<T> is not applicable for the arguments (). The inferred type Comparable<Comparable<M>> is not a valid substitute for the bounded parameter <M extends Comparable<M>>\n" + 
34000
		"----------\n" + 
34001
		"3. ERROR in ComparableComparator.java (at line 27)\n" + 
34002
		"	static Object BAR2 = ComparableComparator.bar();//1a\n" + 
34003
		"	                                          ^^^\n" + 
34004
		"Bound mismatch: The generic method bar() of type ComparableComparator<T> is not applicable for the arguments (). The inferred type Comparable<Comparable<M>> is not a valid substitute for the bounded parameter <M extends Comparable<M>>\n" + 
33939
		"----------\n");
34005
		"----------\n");
33940
}
34006
}
33941
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158548
34007
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158548
Lines 44592-44598 Link Here
44592
			"----------\n");
44658
			"----------\n");
44593
}
44659
}
44594
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=231094
44660
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=231094
44595
public void _test1322() {
44661
public void test1322() {
44596
	this.runNegativeTest(
44662
	this.runNegativeTest(
44597
			new String[] {
44663
			new String[] {
44598
					"X.java", // =================
44664
					"X.java", // =================
Lines 44620-44654 Link Here
44620
					"class Bob2 extends Bob {}\n" +
44686
					"class Bob2 extends Bob {}\n" +
44621
					"class Thingy<T extends Bob> {}\n", // =================
44687
					"class Thingy<T extends Bob> {}\n", // =================
44622
			},
44688
			},
44623
			"----------\n" +
44689
			"----------\n" + 
44624
			"1. WARNING in X.java (at line 6)\n" +
44690
			"1. WARNING in X.java (at line 6)\n" + 
44625
			"	x.doStuff(Bob.class, new Thingy());\n" +
44691
			"	x.doStuff(Bob.class, new Thingy());\n" + 
44626
			"	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
44692
			"	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
44627
			"Type safety: Unchecked invocation doStuff(Class, Thingy) of the generic method doStuff(Class<T>, Thingy<T>) of type X\n" +
44693
			"Type safety: Unchecked invocation doStuff(Class<Bob>, Thingy) of the generic method doStuff(Class<T>, Thingy<T>) of type X\n" + 
44628
			"----------\n" +
44694
			"----------\n" + 
44629
			"2. WARNING in X.java (at line 6)\n" +
44695
			"2. WARNING in X.java (at line 6)\n" + 
44630
			"	x.doStuff(Bob.class, new Thingy());\n" +
44696
			"	x.doStuff(Bob.class, new Thingy());\n" + 
44631
			"	                     ^^^^^^^^^^^^\n" +
44697
			"	                     ^^^^^^^^^^^^\n" + 
44632
			"Type safety: The expression of type Thingy needs unchecked conversion to conform to Thingy<T>\n" +
44698
			"Type safety: The expression of type Thingy needs unchecked conversion to conform to Thingy<Bob>\n" + 
44633
			"----------\n" +
44699
			"----------\n" + 
44634
			"3. WARNING in X.java (at line 6)\n" +
44700
			"3. WARNING in X.java (at line 6)\n" + 
44635
			"	x.doStuff(Bob.class, new Thingy());\n" +
44701
			"	x.doStuff(Bob.class, new Thingy());\n" + 
44636
			"	                         ^^^^^^\n" +
44702
			"	                         ^^^^^^\n" + 
44637
			"Thingy is a raw type. References to generic type Thingy<T> should be parameterized\n" +
44703
			"Thingy is a raw type. References to generic type Thingy<T> should be parameterized\n" + 
44638
			"----------\n" +
44704
			"----------\n" + 
44639
			"4. ERROR in X.java (at line 15)\n" +
44705
			"4. ERROR in X.java (at line 15)\n" + 
44640
			"	x.doStuff(Jim.class, new Thingy());\n" +
44706
			"	x.doStuff(Jim.class, new Thingy());\n" + 
44641
			"	  ^^^^^^^\n" +
44707
			"	  ^^^^^^^\n" + 
44642
			"Bound mismatch: The generic method doStuff(Class<T>, Thingy<T>) of type X is not applicable for the arguments (Class<Jim>, Thingy). The inferred type Jim is not a valid substitute for the bounded parameter <T extends Bob>\n" +
44708
			"Bound mismatch: The generic method doStuff(Class<T>, Thingy<T>) of type X is not applicable for the arguments (Class<Jim>, Thingy). The inferred type Jim is not a valid substitute for the bounded parameter <T extends Bob>\n" + 
44643
			"----------\n" +
44709
			"----------\n" + 
44644
			"5. WARNING in X.java (at line 15)\n" +
44710
			"5. WARNING in X.java (at line 15)\n" + 
44645
			"	x.doStuff(Jim.class, new Thingy());\n" +
44711
			"	x.doStuff(Jim.class, new Thingy());\n" + 
44646
			"	                         ^^^^^^\n" +
44712
			"	                         ^^^^^^\n" + 
44647
			"Thingy is a raw type. References to generic type Thingy<T> should be parameterized\n" +
44713
			"Thingy is a raw type. References to generic type Thingy<T> should be parameterized\n" + 
44648
			"----------\n");
44714
			"----------\n");
44649
}
44715
}
44650
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=231094 - variation
44716
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=231094 - variation
44651
public void _test1323() {
44717
public void test1323() {
44652
	this.runNegativeTest(
44718
	this.runNegativeTest(
44653
			new String[] {
44719
			new String[] {
44654
					"X.java", // =================
44720
					"X.java", // =================
Lines 44665-44704 Link Here
44665
					"class Bob2 extends Bob {}\n" +
44731
					"class Bob2 extends Bob {}\n" +
44666
					"class Thingy<T extends Bob> {}\n", // =================
44732
					"class Thingy<T extends Bob> {}\n", // =================
44667
			},
44733
			},
44668
			"----------\n" +
44734
			"----------\n" + 
44669
			"1. ERROR in X.java (at line 4)\n" +
44735
			"1. ERROR in X.java (at line 4)\n" + 
44670
			"	x.doStuff2(Jim.class, new Thingy());\n" +
44736
			"	x.doStuff2(Jim.class, new Thingy());\n" + 
44671
			"	  ^^^^^^^^\n" +
44737
			"	  ^^^^^^^^\n" + 
44672
			"Bound mismatch: The generic method doStuff2(Class<T>, Thingy<U>) of type X is not applicable for the arguments (Class<Jim>, Thingy). The inferred type Jim is not a valid substitute for the bounded parameter <T extends Bob>\n" +
44738
			"Bound mismatch: The generic method doStuff2(Class<T>, Thingy<U>) of type X is not applicable for the arguments (Class<Jim>, Thingy). The inferred type Jim is not a valid substitute for the bounded parameter <T extends Bob>\n" + 
44673
			"----------\n" +
44739
			"----------\n" + 
44674
			"2. WARNING in X.java (at line 4)\n" +
44740
			"2. WARNING in X.java (at line 4)\n" + 
44675
			"	x.doStuff2(Jim.class, new Thingy());\n" +
44741
			"	x.doStuff2(Jim.class, new Thingy());\n" + 
44676
			"	                          ^^^^^^\n" +
44742
			"	                          ^^^^^^\n" + 
44677
			"Thingy is a raw type. References to generic type Thingy<T> should be parameterized\n" +
44743
			"Thingy is a raw type. References to generic type Thingy<T> should be parameterized\n" + 
44678
			"----------\n" +
44744
			"----------\n" + 
44679
			"3. WARNING in X.java (at line 5)\n" +
44745
			"3. WARNING in X.java (at line 5)\n" + 
44680
			"	String s = x.doStuff2(Bob2.class, new Thingy());\n" +
44746
			"	String s = x.doStuff2(Bob2.class, new Thingy());\n" + 
44681
			"	           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
44747
			"	           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
44682
			"Type safety: Unchecked invocation doStuff2(Class<Bob2>, Thingy<Bob>) of the generic method doStuff2(Class<T>, Thingy<U>) of type X\n" +
44748
			"Type safety: Unchecked invocation doStuff2(Class<Bob2>, Thingy) of the generic method doStuff2(Class<T>, Thingy<U>) of type X\n" + 
44683
			"----------\n" +
44749
			"----------\n" + 
44684
			"4. ERROR in X.java (at line 5)\n" +
44750
			"4. ERROR in X.java (at line 5)\n" + 
44685
			"	String s = x.doStuff2(Bob2.class, new Thingy());\n" +
44751
			"	String s = x.doStuff2(Bob2.class, new Thingy());\n" + 
44686
			"	           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
44752
			"	           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
44687
			"Type mismatch: cannot convert from Bob2 to String\n" +
44753
			"Type mismatch: cannot convert from Bob to String\n" + 
44688
			"----------\n" +
44754
			"----------\n" + 
44689
			"5. WARNING in X.java (at line 5)\n" +
44755
			"5. WARNING in X.java (at line 5)\n" + 
44690
			"	String s = x.doStuff2(Bob2.class, new Thingy());\n" +
44756
			"	String s = x.doStuff2(Bob2.class, new Thingy());\n" + 
44691
			"	                                  ^^^^^^^^^^^^\n" +
44757
			"	                                  ^^^^^^^^^^^^\n" + 
44692
			"Type safety: The expression of type Thingy needs unchecked conversion to conform to Thingy<U>\n" +
44758
			"Type safety: The expression of type Thingy needs unchecked conversion to conform to Thingy<Bob>\n" + 
44693
			"----------\n" +
44759
			"----------\n" + 
44694
			"6. WARNING in X.java (at line 5)\n" +
44760
			"6. WARNING in X.java (at line 5)\n" + 
44695
			"	String s = x.doStuff2(Bob2.class, new Thingy());\n" +
44761
			"	String s = x.doStuff2(Bob2.class, new Thingy());\n" + 
44696
			"	                                      ^^^^^^\n" +
44762
			"	                                      ^^^^^^\n" + 
44697
			"Thingy is a raw type. References to generic type Thingy<T> should be parameterized\n" +
44763
			"Thingy is a raw type. References to generic type Thingy<T> should be parameterized\n" + 
44698
			"----------\n");
44764
			"----------\n");
44699
}
44765
}
44700
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=231094 - variation
44766
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=231094 - variation
44701
public void _test1324() {
44767
public void test1324() {
44702
	this.runNegativeTest(
44768
	this.runNegativeTest(
44703
			new String[] {
44769
			new String[] {
44704
					"X.java", // =================
44770
					"X.java", // =================
Lines 44717-44742 Link Here
44717
					"class Bob {}\n" +
44783
					"class Bob {}\n" +
44718
					"class Thingy<T extends Bob> {}\n", // =================
44784
					"class Thingy<T extends Bob> {}\n", // =================
44719
			},
44785
			},
44720
			"----------\n" +
44786
			"----------\n" + 
44721
			"1. WARNING in X.java (at line 6)\n" +
44787
			"1. WARNING in X.java (at line 6)\n" + 
44722
			"	x.doStuff(Bob.class, new Thingy());\n" +
44788
			"	x.doStuff(Bob.class, new Thingy());\n" + 
44723
			"	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
44789
			"	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
44724
			"Type safety: Unchecked invocation doStuff(Class<Bob>, Thingy<Bob>) of the generic method doStuff(Class<T>, Thingy<T>) of type X\n" +
44790
			"Type safety: Unchecked invocation doStuff(Class<Bob>, Thingy) of the generic method doStuff(Class<T>, Thingy<T>) of type X\n" + 
44725
			"----------\n" +
44791
			"----------\n" + 
44726
			"2. WARNING in X.java (at line 6)\n" +
44792
			"2. WARNING in X.java (at line 6)\n" + 
44727
			"	x.doStuff(Bob.class, new Thingy());\n" +
44793
			"	x.doStuff(Bob.class, new Thingy());\n" + 
44728
			"	                     ^^^^^^^^^^^^\n" +
44794
			"	                     ^^^^^^^^^^^^\n" + 
44729
			"Type safety: The expression of type Thingy needs unchecked conversion to conform to Thingy<T>\n" +
44795
			"Type safety: The expression of type Thingy needs unchecked conversion to conform to Thingy<Bob>\n" + 
44730
			"----------\n" +
44796
			"----------\n" + 
44731
			"3. WARNING in X.java (at line 6)\n" +
44797
			"3. WARNING in X.java (at line 6)\n" + 
44732
			"	x.doStuff(Bob.class, new Thingy());\n" +
44798
			"	x.doStuff(Bob.class, new Thingy());\n" + 
44733
			"	                         ^^^^^^\n" +
44799
			"	                         ^^^^^^\n" + 
44734
			"Thingy is a raw type. References to generic type Thingy<T> should be parameterized\n" +
44800
			"Thingy is a raw type. References to generic type Thingy<T> should be parameterized\n" + 
44735
			"----------\n" +
44801
			"----------\n" + 
44736
			"4. ERROR in X.java (at line 8)\n" +
44802
			"4. ERROR in X.java (at line 8)\n" + 
44737
			"	Zork z;\n" +
44803
			"	Zork z;\n" + 
44738
			"	^^^^\n" +
44804
			"	^^^^\n" + 
44739
			"Zork cannot be resolved to a type\n" +
44805
			"Zork cannot be resolved to a type\n" + 
44740
			"----------\n");
44806
			"----------\n");
44741
}
44807
}
44742
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=231094 - variation
44808
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=231094 - variation
Lines 44753-44782 Link Here
44753
					"	}\n" +
44819
					"	}\n" +
44754
					"}\n", // =================
44820
					"}\n", // =================
44755
			},
44821
			},
44756
			"----------\n" +
44822
			"----------\n" + 
44757
			"1. WARNING in X.java (at line 5)\n" +
44823
			"1. WARNING in X.java (at line 5)\n" + 
44758
			"	void bar(X x) {\n" +
44824
			"	void bar(X x) {\n" + 
44759
			"	         ^\n" +
44825
			"	         ^\n" + 
44760
			"X is a raw type. References to generic type X<E> should be parameterized\n" +
44826
			"X is a raw type. References to generic type X<E> should be parameterized\n" + 
44761
			"----------\n" +
44827
			"----------\n" + 
44762
			"2. WARNING in X.java (at line 6)\n" +
44828
			"2. WARNING in X.java (at line 6)\n" + 
44763
			"	X<String> xs2 = foo(x);\n" +
44829
			"	X<String> xs2 = foo(x);\n" + 
44764
			"	                ^^^^^^\n" +
44830
			"	                ^^^^^^\n" + 
44765
			"Type safety: Unchecked invocation foo(X) of the generic method foo(X<T>) of type X<E>\n" +
44831
			"Type safety: Unchecked invocation foo(X) of the generic method foo(X<T>) of type X<E>\n" + 
44766
			"----------\n" +
44832
			"----------\n" + 
44767
			"3. ERROR in X.java (at line 6)\n" +
44833
			"3. ERROR in X.java (at line 6)\n" + 
44768
			"	X<String> xs2 = foo(x);\n" +
44834
			"	X<String> xs2 = foo(x);\n" + 
44769
			"	                ^^^^^^\n" +
44835
			"	                ^^^^^^\n" + 
44770
			"Type mismatch: cannot convert from Object to X<String>\n" +
44836
			"Type mismatch: cannot convert from Object to X<String>\n" + 
44771
			"----------\n" +
44837
			"----------\n" + 
44772
			"4. WARNING in X.java (at line 6)\n" +
44838
			"4. WARNING in X.java (at line 6)\n" + 
44773
			"	X<String> xs2 = foo(x);\n" +
44839
			"	X<String> xs2 = foo(x);\n" + 
44774
			"	                    ^\n" +
44840
			"	                    ^\n" + 
44775
			"Type safety: The expression of type X needs unchecked conversion to conform to X<T>\n" +
44841
			"Type safety: The expression of type X needs unchecked conversion to conform to X<Object>\n" + 
44776
			"----------\n");
44842
			"----------\n");
44777
}
44843
}
44778
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=231094 - variation
44844
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=231094 - variation
44779
public void _test1326() {
44845
public void test1326() {
44780
	this.runNegativeTest(
44846
	this.runNegativeTest(
44781
			new String[] {
44847
			new String[] {
44782
					"X.java", // =================
44848
					"X.java", // =================
Lines 44830-44836 Link Here
44830
			"2. WARNING in X.java (at line 9)\n" +
44896
			"2. WARNING in X.java (at line 9)\n" +
44831
			"	X<String> xs2 = foo(x, xs).identity();\n" +
44897
			"	X<String> xs2 = foo(x, xs).identity();\n" +
44832
			"	                ^^^^^^^^^^\n" +
44898
			"	                ^^^^^^^^^^\n" +
44833
			"Type safety: Unchecked invocation foo(X, X) of the generic method foo(X<T>, X<U>) of type X<E>\n" +
44899
			"Type safety: Unchecked invocation foo(X, X<String>) of the generic method foo(X<T>, X<U>) of type X<E>\n" +
44834
			"----------\n" +
44900
			"----------\n" +
44835
			"3. WARNING in X.java (at line 9)\n" +
44901
			"3. WARNING in X.java (at line 9)\n" +
44836
			"	X<String> xs2 = foo(x, xs).identity();\n" +
44902
			"	X<String> xs2 = foo(x, xs).identity();\n" +
Lines 44840-44846 Link Here
44840
			"4. WARNING in X.java (at line 9)\n" +
44906
			"4. WARNING in X.java (at line 9)\n" +
44841
			"	X<String> xs2 = foo(x, xs).identity();\n" +
44907
			"	X<String> xs2 = foo(x, xs).identity();\n" +
44842
			"	                    ^\n" +
44908
			"	                    ^\n" +
44843
			"Type safety: The expression of type X needs unchecked conversion to conform to X<T>\n" +
44909
			"Type safety: The expression of type X needs unchecked conversion to conform to X<Object>\n" +
44844
			"----------\n");
44910
			"----------\n");
44845
}
44911
}
44846
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=231094 - variation
44912
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=231094 - variation
Lines 45617-45647 Link Here
45617
				"class Y<S> {}\n" +
45683
				"class Y<S> {}\n" +
45618
				"class Z { Zork z; }\n", // =================
45684
				"class Z { Zork z; }\n", // =================
45619
			},
45685
			},
45620
			"----------\n" +
45686
			"----------\n" + 
45621
			"1. WARNING in Scratch.java (at line 2)\n" +
45687
			"1. WARNING in Scratch.java (at line 2)\n" + 
45622
			"	private Y rawObject = new Y();\n" +
45688
			"	private Y rawObject = new Y();\n" + 
45623
			"	        ^\n" +
45689
			"	        ^\n" + 
45624
			"Y is a raw type. References to generic type Y<S> should be parameterized\n" +
45690
			"Y is a raw type. References to generic type Y<S> should be parameterized\n" + 
45625
			"----------\n" +
45691
			"----------\n" + 
45626
			"2. WARNING in Scratch.java (at line 2)\n" +
45692
			"2. WARNING in Scratch.java (at line 2)\n" + 
45627
			"	private Y rawObject = new Y();\n" +
45693
			"	private Y rawObject = new Y();\n" + 
45628
			"	                          ^\n" +
45694
			"	                          ^\n" + 
45629
			"Y is a raw type. References to generic type Y<S> should be parameterized\n" +
45695
			"Y is a raw type. References to generic type Y<S> should be parameterized\n" + 
45630
			"----------\n" +
45696
			"----------\n" + 
45631
			"3. WARNING in Scratch.java (at line 4)\n" +
45697
			"3. WARNING in Scratch.java (at line 4)\n" + 
45632
			"	method(new X<Y<Z>>(), rawObject); // compile error in javac, unchecked conversion in Eclipse\n" +
45698
			"	method(new X<Y<Z>>(), rawObject); // compile error in javac, unchecked conversion in Eclipse\n" + 
45633
			"	                      ^^^^^^^^^\n" +
45699
			"	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
45634
			"Type safety: The expression of type Y needs unchecked conversion to conform to Y<Z>\n" +
45700
			"Type safety: Unchecked invocation method(X<Y<Z>>, Y) of the generic method method(X<T>, T) of type Scratch\n" + 
45635
			"----------\n" +
45701
			"----------\n" + 
45636
			"4. WARNING in Scratch.java (at line 5)\n" +
45702
			"4. WARNING in Scratch.java (at line 4)\n" + 
45637
			"	this.<Y<Z>>method(new X<Y<Z>>(), rawObject); // unchecked warning in both\n" +
45703
			"	method(new X<Y<Z>>(), rawObject); // compile error in javac, unchecked conversion in Eclipse\n" + 
45638
			"	                                 ^^^^^^^^^\n" +
45704
			"	                      ^^^^^^^^^\n" + 
45639
			"Type safety: The expression of type Y needs unchecked conversion to conform to Y<Z>\n" +
45705
			"Type safety: The expression of type Y needs unchecked conversion to conform to Y<Z>\n" + 
45640
			"----------\n" +
45706
			"----------\n" + 
45641
			"5. ERROR in Scratch.java (at line 11)\n" +
45707
			"5. WARNING in Scratch.java (at line 5)\n" + 
45642
			"	class Z { Zork z; }\n" +
45708
			"	this.<Y<Z>>method(new X<Y<Z>>(), rawObject); // unchecked warning in both\n" + 
45643
			"	          ^^^^\n" +
45709
			"	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
45644
			"Zork cannot be resolved to a type\n" +
45710
			"Type safety: Unchecked invocation method(X<Y<Z>>, Y) of the generic method method(X<T>, T) of type Scratch\n" + 
45711
			"----------\n" + 
45712
			"6. WARNING in Scratch.java (at line 5)\n" + 
45713
			"	this.<Y<Z>>method(new X<Y<Z>>(), rawObject); // unchecked warning in both\n" + 
45714
			"	                                 ^^^^^^^^^\n" + 
45715
			"Type safety: The expression of type Y needs unchecked conversion to conform to Y<Z>\n" + 
45716
			"----------\n" + 
45717
			"7. ERROR in Scratch.java (at line 11)\n" + 
45718
			"	class Z { Zork z; }\n" + 
45719
			"	          ^^^^\n" + 
45720
			"Zork cannot be resolved to a type\n" + 
45645
			"----------\n");
45721
			"----------\n");
45646
}
45722
}
45647
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=238484
45723
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=238484
Lines 47636-47642 Link Here
47636
		"----------\n");
47712
		"----------\n");
47637
}
47713
}
47638
public void test1406() {
47714
public void test1406() {
47639
	this.runConformTest(
47715
	this.runNegativeTest(
47640
			new String[] {
47716
			new String[] {
47641
				"GenericTest.java", //-----------------------------------------------------------------------
47717
				"GenericTest.java", //-----------------------------------------------------------------------
47642
				"import java.util.*;\n" + 
47718
				"import java.util.*;\n" + 
Lines 47651-47657 Link Here
47651
				"    }\n" + 
47727
				"    }\n" + 
47652
				"}\n",//-----------------------------------------------------------------------
47728
				"}\n",//-----------------------------------------------------------------------
47653
			},
47729
			},
47654
			"");
47730
			"----------\n" + 
47731
			"1. WARNING in GenericTest.java (at line 5)\n" + 
47732
			"	Set testList = GenericTest.method1(new Class[] { ArrayList.class });\n" + 
47733
			"	^^^\n" + 
47734
			"Set is a raw type. References to generic type Set<E> should be parameterized\n" + 
47735
			"----------\n" + 
47736
			"2. WARNING in GenericTest.java (at line 5)\n" + 
47737
			"	Set testList = GenericTest.method1(new Class[] { ArrayList.class });\n" + 
47738
			"	               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
47739
			"Type safety: Unchecked invocation method1(Class[]) of the generic method method1(Class<List>[]) of type GenericTest\n" + 
47740
			"----------\n" + 
47741
			"3. ERROR in GenericTest.java (at line 5)\n" + 
47742
			"	Set testList = GenericTest.method1(new Class[] { ArrayList.class });\n" + 
47743
			"	               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
47744
			"Type mismatch: cannot convert from Object to Set\n" + 
47745
			"----------\n" + 
47746
			"4. WARNING in GenericTest.java (at line 5)\n" + 
47747
			"	Set testList = GenericTest.method1(new Class[] { ArrayList.class });\n" + 
47748
			"	                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
47749
			"Type safety: The expression of type Class[] needs unchecked conversion to conform to Class<List>[]\n" + 
47750
			"----------\n" + 
47751
			"5. WARNING in GenericTest.java (at line 8)\n" + 
47752
			"	public static <I> I method1(Class<List>[] params) {\n" + 
47753
			"	                                  ^^^^\n" + 
47754
			"List is a raw type. References to generic type List<E> should be parameterized\n" + 
47755
			"----------\n");
47655
}
47756
}
47656
public void test1407() {
47757
public void test1407() {
47657
	this.runNegativeTest(
47758
	this.runNegativeTest(
Lines 47659-47699 Link Here
47659
				"Foo.java", //-----------------------------------------------------------------------
47760
				"Foo.java", //-----------------------------------------------------------------------
47660
				"public class Foo {\n" + 
47761
				"public class Foo {\n" + 
47661
				"	public static <I> I m1(Class<Foo> c) { return null; }\n" + 
47762
				"	public static <I> I m1(Class<Foo> c) { return null; }\n" + 
47662
				"	public static <I> I m2(Class<I> c) { return null; }	\n" + 
47663
				"	void bar() {\n" + 
47763
				"	void bar() {\n" + 
47664
				"		Foo l1 = m1((Class)Foo.class); //ok - unchecked conversion from Class to Class<Foo> - I inferred to be Foo\n" + 
47764
				"		Foo l1 = m1((Class)Foo.class);\n" + 
47665
				"		Foo l2 = m2((Class)Foo.class); //unchecked call, erased return type and error because Object != Foo		\n" + 
47666
				"	}\n" + 
47765
				"	}\n" + 
47667
				"}\n",//-----------------------------------------------------------------------
47766
				"}\n",//-----------------------------------------------------------------------
47668
			},
47767
			},
47669
			"----------\n" + 
47768
			"----------\n" + 
47670
			"1. WARNING in Foo.java (at line 5)\n" + 
47769
			"1. WARNING in Foo.java (at line 4)\n" + 
47671
			"	Foo l1 = m1((Class)Foo.class); //ok - unchecked conversion from Class to Class<Foo> - I inferred to be Foo\n" + 
47770
			"	Foo l1 = m1((Class)Foo.class);\n" + 
47672
			"	            ^^^^^^^^^^^^^^^^\n" + 
47673
			"Type safety: The expression of type Class needs unchecked conversion to conform to Class<Foo>\n" + 
47674
			"----------\n" + 
47675
			"2. WARNING in Foo.java (at line 5)\n" + 
47676
			"	Foo l1 = m1((Class)Foo.class); //ok - unchecked conversion from Class to Class<Foo> - I inferred to be Foo\n" + 
47677
			"	             ^^^^^\n" + 
47678
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
47679
			"----------\n" + 
47680
			"3. WARNING in Foo.java (at line 6)\n" + 
47681
			"	Foo l2 = m2((Class)Foo.class); //unchecked call, erased return type and error because Object != Foo		\n" + 
47682
			"	         ^^^^^^^^^^^^^^^^^^^^\n" + 
47771
			"	         ^^^^^^^^^^^^^^^^^^^^\n" + 
47683
			"Type safety: Unchecked invocation m2(Class) of the generic method m2(Class<I>) of type Foo\n" + 
47772
			"Type safety: Unchecked invocation m1(Class) of the generic method m1(Class<Foo>) of type Foo\n" + 
47684
			"----------\n" + 
47773
			"----------\n" + 
47685
			"4. ERROR in Foo.java (at line 6)\n" + 
47774
			"2. ERROR in Foo.java (at line 4)\n" + 
47686
			"	Foo l2 = m2((Class)Foo.class); //unchecked call, erased return type and error because Object != Foo		\n" + 
47775
			"	Foo l1 = m1((Class)Foo.class);\n" + 
47687
			"	         ^^^^^^^^^^^^^^^^^^^^\n" + 
47776
			"	         ^^^^^^^^^^^^^^^^^^^^\n" + 
47688
			"Type mismatch: cannot convert from Object to Foo\n" + 
47777
			"Type mismatch: cannot convert from Object to Foo\n" + 
47689
			"----------\n" + 
47778
			"----------\n" + 
47690
			"5. WARNING in Foo.java (at line 6)\n" + 
47779
			"3. WARNING in Foo.java (at line 4)\n" + 
47691
			"	Foo l2 = m2((Class)Foo.class); //unchecked call, erased return type and error because Object != Foo		\n" + 
47780
			"	Foo l1 = m1((Class)Foo.class);\n" + 
47692
			"	            ^^^^^^^^^^^^^^^^\n" + 
47781
			"	            ^^^^^^^^^^^^^^^^\n" + 
47693
			"Type safety: The expression of type Class needs unchecked conversion to conform to Class<I>\n" + 
47782
			"Type safety: The expression of type Class needs unchecked conversion to conform to Class<Foo>\n" + 
47694
			"----------\n" + 
47783
			"----------\n" + 
47695
			"6. WARNING in Foo.java (at line 6)\n" + 
47784
			"4. WARNING in Foo.java (at line 4)\n" + 
47696
			"	Foo l2 = m2((Class)Foo.class); //unchecked call, erased return type and error because Object != Foo		\n" + 
47785
			"	Foo l1 = m1((Class)Foo.class);\n" + 
47697
			"	             ^^^^^\n" + 
47786
			"	             ^^^^^\n" + 
47698
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
47787
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
47699
			"----------\n");
47788
			"----------\n");
Lines 48344-48401 Link Here
48344
			},
48433
			},
48345
			"");
48434
			"");
48346
}
48435
}
48436
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=258798
48347
public void test1429() {
48437
public void test1429() {
48348
	this.runNegativeTest(
48438
	this.runNegativeTest(
48349
			new String[] {
48439
			new String[] {
48350
				"X.java", //-----------------------------------------------------------------------
48440
				"X.java", //-----------------------------------------------------------------------
48351
				"class Foo<T> {}\n" + 
48441
				"class Foo<T> {}\n" + 
48352
				"public class X {\n" + 
48442
				"public class X {\n" + 
48353
				"        public void test() {\n" + 
48443
				"	public void test() {\n" + 
48354
				"                m(new Foo<Foo<Integer>>(), new Foo());\n" + 
48444
				"		Integer i = m(new Foo<Foo<Integer>>(), new Foo());\n" + 
48355
				"        }\n" + 
48445
				"	}\n" + 
48356
				"        public <T> void m(Foo<T> x, T t) {}\n" + 
48446
				"	public <T> T m(Foo<T> x, T t) {\n" + 
48447
				"		return t;\n" + 
48448
				"	}\n" + 
48357
				"}\n",//-----------------------------------------------------------------------
48449
				"}\n",//-----------------------------------------------------------------------
48358
			},
48450
			},
48359
			"----------\n" + 
48451
			"----------\n" + 
48360
			"1. WARNING in X.java (at line 4)\n" + 
48452
			"1. WARNING in X.java (at line 4)\n" + 
48361
			"	m(new Foo<Foo<Integer>>(), new Foo());\n" + 
48453
			"	Integer i = m(new Foo<Foo<Integer>>(), new Foo());\n" + 
48362
			"	                           ^^^^^^^^^\n" + 
48454
			"	            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
48455
			"Type safety: Unchecked invocation m(Foo<Foo<Integer>>, Foo) of the generic method m(Foo<T>, T) of type X\n" + 
48456
			"----------\n" + 
48457
			"2. ERROR in X.java (at line 4)\n" + 
48458
			"	Integer i = m(new Foo<Foo<Integer>>(), new Foo());\n" + 
48459
			"	            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
48460
			"Type mismatch: cannot convert from Object to Integer\n" + 
48461
			"----------\n" + 
48462
			"3. WARNING in X.java (at line 4)\n" + 
48463
			"	Integer i = m(new Foo<Foo<Integer>>(), new Foo());\n" + 
48464
			"	                                       ^^^^^^^^^\n" + 
48363
			"Type safety: The expression of type Foo needs unchecked conversion to conform to Foo<Integer>\n" + 
48465
			"Type safety: The expression of type Foo needs unchecked conversion to conform to Foo<Integer>\n" + 
48364
			"----------\n" + 
48466
			"----------\n" + 
48365
			"2. WARNING in X.java (at line 4)\n" + 
48467
			"4. WARNING in X.java (at line 4)\n" + 
48366
			"	m(new Foo<Foo<Integer>>(), new Foo());\n" + 
48468
			"	Integer i = m(new Foo<Foo<Integer>>(), new Foo());\n" + 
48367
			"	                               ^^^\n" + 
48469
			"	                                           ^^^\n" + 
48368
			"Foo is a raw type. References to generic type Foo<T> should be parameterized\n" + 
48470
			"Foo is a raw type. References to generic type Foo<T> should be parameterized\n" + 
48369
			"----------\n");
48471
			"----------\n");
48370
}
48472
}
48473
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=258798 - variation
48371
public void test1430() {
48474
public void test1430() {
48372
	this.runNegativeTest(
48475
	this.runNegativeTest(
48373
			new String[] {
48476
			new String[] {
48374
				"X.java", //-----------------------------------------------------------------------
48477
				"X.java", //-----------------------------------------------------------------------
48375
				"class Foo<T> {}\n" + 
48478
				"class Foo<T> {}\n" + 
48376
				"public class X {\n" + 
48479
				"public class X {\n" + 
48377
				"	public void test() {\n" + 
48480
				"        public void test() {\n" + 
48378
				"		Integer i = m(new Foo<Foo<Integer>>(), new Foo());\n" + 
48481
				"                m(new Foo<Foo<Integer>>(), new Foo());\n" + 
48379
				"	}\n" + 
48482
				"        }\n" + 
48380
				"	public <T> T m(Foo<T> x, T t) {\n" + 
48483
				"        public <T> void m(Foo<T> x, T t) {}\n" + 
48381
				"		return t;\n" + 
48382
				"	}\n" + 
48383
				"}\n",//-----------------------------------------------------------------------
48484
				"}\n",//-----------------------------------------------------------------------
48384
			},
48485
			},
48385
			"----------\n" + 
48486
			"----------\n" + 
48386
			"1. ERROR in X.java (at line 4)\n" + 
48487
			"1. WARNING in X.java (at line 4)\n" + 
48387
			"	Integer i = m(new Foo<Foo<Integer>>(), new Foo());\n" + 
48488
			"	m(new Foo<Foo<Integer>>(), new Foo());\n" + 
48388
			"	            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
48489
			"	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
48389
			"Type mismatch: cannot convert from Foo<Integer> to Integer\n" + 
48490
			"Type safety: Unchecked invocation m(Foo<Foo<Integer>>, Foo) of the generic method m(Foo<T>, T) of type X\n" + 
48390
			"----------\n" + 
48491
			"----------\n" + 
48391
			"2. WARNING in X.java (at line 4)\n" + 
48492
			"2. WARNING in X.java (at line 4)\n" + 
48392
			"	Integer i = m(new Foo<Foo<Integer>>(), new Foo());\n" + 
48493
			"	m(new Foo<Foo<Integer>>(), new Foo());\n" + 
48393
			"	                                       ^^^^^^^^^\n" + 
48494
			"	                           ^^^^^^^^^\n" + 
48394
			"Type safety: The expression of type Foo needs unchecked conversion to conform to Foo<Integer>\n" + 
48495
			"Type safety: The expression of type Foo needs unchecked conversion to conform to Foo<Integer>\n" + 
48395
			"----------\n" + 
48496
			"----------\n" + 
48396
			"3. WARNING in X.java (at line 4)\n" + 
48497
			"3. WARNING in X.java (at line 4)\n" + 
48397
			"	Integer i = m(new Foo<Foo<Integer>>(), new Foo());\n" + 
48498
			"	m(new Foo<Foo<Integer>>(), new Foo());\n" + 
48398
			"	                                           ^^^\n" + 
48499
			"	                               ^^^\n" + 
48399
			"Foo is a raw type. References to generic type Foo<T> should be parameterized\n" + 
48500
			"Foo is a raw type. References to generic type Foo<T> should be parameterized\n" + 
48400
			"----------\n");
48501
			"----------\n");
48401
}
48502
}
Lines 48439-48442 Link Here
48439
		"----------\n"
48540
		"----------\n"
48440
	);
48541
	);
48441
}
48542
}
48543
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=258798 - variation
48544
public void test1432() {
48545
	this.runNegativeTest(
48546
			new String[] {
48547
				"X.java", //-----------------------------------------------------------------------
48548
				"class Foo<T> {\n" + 
48549
				"	T bar(Foo<T> ft, T t) {\n" + 
48550
				"		return t;\n" + 
48551
				"	}\n" + 
48552
				"}\n" + 
48553
				"public class X {\n" + 
48554
				"	public void test() {\n" + 
48555
				"		Foo<Foo<Integer>> ffi = new Foo<Foo<Integer>>();\n" + 
48556
				"		Integer j = ffi.bar(ffi, new Foo());\n" + 
48557
				"	}\n" + 
48558
				"}\n",//-----------------------------------------------------------------------
48559
			},
48560
			"----------\n" + 
48561
			"1. ERROR in X.java (at line 9)\n" + 
48562
			"	Integer j = ffi.bar(ffi, new Foo());\n" + 
48563
			"	            ^^^^^^^^^^^^^^^^^^^^^^^\n" + 
48564
			"Type mismatch: cannot convert from Foo<Integer> to Integer\n" + 
48565
			"----------\n" + 
48566
			"2. WARNING in X.java (at line 9)\n" + 
48567
			"	Integer j = ffi.bar(ffi, new Foo());\n" + 
48568
			"	                         ^^^^^^^^^\n" + 
48569
			"Type safety: The expression of type Foo needs unchecked conversion to conform to Foo<Integer>\n" + 
48570
			"----------\n" + 
48571
			"3. WARNING in X.java (at line 9)\n" + 
48572
			"	Integer j = ffi.bar(ffi, new Foo());\n" + 
48573
			"	                             ^^^\n" + 
48574
			"Foo is a raw type. References to generic type Foo<T> should be parameterized\n" + 
48575
			"----------\n");
48576
}
48577
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=258798 - variation
48578
public void test1433() {
48579
	this.runNegativeTest(
48580
			new String[] {
48581
				"X.java", //-----------------------------------------------------------------------
48582
				"import java.util.*;\n" + 
48583
				"public class X<T> {\n" + 
48584
				"	Zork z;\n" +
48585
				"	<U> void foo(X<U> xu) {}\n" + 
48586
				"	void bar(X x) {\n" + 
48587
				"		foo(x);\n" + 
48588
				"	}\n" + 
48589
				"}\n",//-----------------------------------------------------------------------
48590
			},
48591
			"----------\n" + 
48592
			"1. ERROR in X.java (at line 3)\n" + 
48593
			"	Zork z;\n" + 
48594
			"	^^^^\n" + 
48595
			"Zork cannot be resolved to a type\n" + 
48596
			"----------\n" + 
48597
			"2. WARNING in X.java (at line 5)\n" + 
48598
			"	void bar(X x) {\n" + 
48599
			"	         ^\n" + 
48600
			"X is a raw type. References to generic type X<T> should be parameterized\n" + 
48601
			"----------\n" + 
48602
			"3. WARNING in X.java (at line 6)\n" + 
48603
			"	foo(x);\n" + 
48604
			"	^^^^^^\n" + 
48605
			"Type safety: Unchecked invocation foo(X) of the generic method foo(X<U>) of type X<T>\n" + 
48606
			"----------\n" + 
48607
			"4. WARNING in X.java (at line 6)\n" + 
48608
			"	foo(x);\n" + 
48609
			"	    ^\n" + 
48610
			"Type safety: The expression of type X needs unchecked conversion to conform to X<Object>\n" + 
48611
			"----------\n");
48612
}
48613
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=258798 - variation
48614
public void test1434() {
48615
	this.runNegativeTest(
48616
			new String[] {
48617
				"Foo.java", //-----------------------------------------------------------------------
48618
				"public class Foo {\n" + 
48619
				"	public static <I> I m2(Class<I> c) { return null; }	\n" + 
48620
				"	void bar() {\n" + 
48621
				"		Foo l2 = m2((Class)Foo.class);\n" + 
48622
				"	}\n" + 
48623
				"}\n",//-----------------------------------------------------------------------
48624
			},
48625
			"----------\n" + 
48626
			"1. WARNING in Foo.java (at line 4)\n" + 
48627
			"	Foo l2 = m2((Class)Foo.class);\n" + 
48628
			"	         ^^^^^^^^^^^^^^^^^^^^\n" + 
48629
			"Type safety: Unchecked invocation m2(Class) of the generic method m2(Class<I>) of type Foo\n" + 
48630
			"----------\n" + 
48631
			"2. ERROR in Foo.java (at line 4)\n" + 
48632
			"	Foo l2 = m2((Class)Foo.class);\n" + 
48633
			"	         ^^^^^^^^^^^^^^^^^^^^\n" + 
48634
			"Type mismatch: cannot convert from Object to Foo\n" + 
48635
			"----------\n" + 
48636
			"3. WARNING in Foo.java (at line 4)\n" + 
48637
			"	Foo l2 = m2((Class)Foo.class);\n" + 
48638
			"	            ^^^^^^^^^^^^^^^^\n" + 
48639
			"Type safety: The expression of type Class needs unchecked conversion to conform to Class<Foo>\n" + 
48640
			"----------\n" + 
48641
			"4. WARNING in Foo.java (at line 4)\n" + 
48642
			"	Foo l2 = m2((Class)Foo.class);\n" + 
48643
			"	            ^^^^^^^^^^^^^^^^\n" + 
48644
			"Unnecessary cast from Class<Foo> to Class\n" + 
48645
			"----------\n" + 
48646
			"5. WARNING in Foo.java (at line 4)\n" + 
48647
			"	Foo l2 = m2((Class)Foo.class);\n" + 
48648
			"	             ^^^^^\n" + 
48649
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
48650
			"----------\n");
48651
}
48652
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=258798 - variation
48653
public void test1435() {
48654
	this.runNegativeTest(
48655
			new String[] {
48656
				"X.java", //-----------------------------------------------------------------------
48657
				"public class X {\n" + 
48658
				"	<T extends Comparable<T>>	T min(T x, T y) { return x; }\n" + 
48659
				"	\n" + 
48660
				"	void foo(Foo f, Bar b) {\n" + 
48661
				"		min(f, f);\n" + 
48662
				"		min(b, b);\n" + 
48663
				"	}\n" + 
48664
				"}\n" + 
48665
				"abstract class Foo implements Comparable<Foo> {\n" + 
48666
				"}\n" + 
48667
				"abstract class Bar extends Foo {}\n",//-----------------------------------------------------------------------
48668
			},
48669
			"----------\n" + 
48670
			"1. ERROR in X.java (at line 6)\n" + 
48671
			"	min(b, b);\n" + 
48672
			"	^^^\n" + 
48673
			"Bound mismatch: The generic method min(T, T) of type X is not applicable for the arguments (Bar, Bar). The inferred type Bar is not a valid substitute for the bounded parameter <T extends Comparable<T>>\n" + 
48674
			"----------\n");
48675
}
48676
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=258798 - variation
48677
public void test1436() {
48678
	this.runNegativeTest(
48679
			new String[] {
48680
				"X.java", //-----------------------------------------------------------------------
48681
				"import java.util.*;\n" + 
48682
				"public class X {\n" + 
48683
				"	<U extends List<?>, T extends Throwable> void foo(List<U> lu, T t) throws T {\n" + 
48684
				"		if (lu.isEmpty()) throw t;\n" + 
48685
				"	}\n" + 
48686
				"	void bar(List l, IllegalArgumentException iae) {\n" + 
48687
				"		try {\n" + 
48688
				"			foo(l, iae);\n" + 
48689
				"		} catch (IllegalArgumentException e) {\n" + 
48690
				"		}\n" + 
48691
				"	}\n" + 
48692
				"}\n",//-----------------------------------------------------------------------
48693
			},
48694
			"----------\n" + 
48695
			"1. WARNING in X.java (at line 6)\n" + 
48696
			"	void bar(List l, IllegalArgumentException iae) {\n" + 
48697
			"	         ^^^^\n" + 
48698
			"List is a raw type. References to generic type List<E> should be parameterized\n" + 
48699
			"----------\n" + 
48700
			"2. WARNING in X.java (at line 8)\n" + 
48701
			"	foo(l, iae);\n" + 
48702
			"	^^^^^^^^^^^\n" + 
48703
			"Type safety: Unchecked invocation foo(List, IllegalArgumentException) of the generic method foo(List<U>, T) of type X\n" + 
48704
			"----------\n" + 
48705
			"3. ERROR in X.java (at line 8)\n" + 
48706
			"	foo(l, iae);\n" + 
48707
			"	^^^^^^^^^^^\n" + 
48708
			"Unhandled exception type Throwable\n" + 
48709
			"----------\n" + 
48710
			"4. WARNING in X.java (at line 8)\n" + 
48711
			"	foo(l, iae);\n" + 
48712
			"	    ^\n" + 
48713
			"Type safety: The expression of type List needs unchecked conversion to conform to List<List<?>>\n" + 
48714
			"----------\n");
48715
}
48716
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=258798 - variation
48717
public void test1437() {
48718
	this.runNegativeTest(
48719
			new String[] {
48720
				"X.java", //-----------------------------------------------------------------------
48721
				"import java.util.*;\n" + 
48722
				"public class X {\n" + 
48723
				"	<U extends List<?>, T extends Throwable> X(List<U> lu, T t) throws T {\n" + 
48724
				"		if (lu.isEmpty()) throw t;\n" + 
48725
				"	}\n" + 
48726
				"	void bar(List l, IllegalArgumentException iae) {\n" + 
48727
				"		try {\n" + 
48728
				"			new X(l, iae);\n" + 
48729
				"		} catch (IllegalArgumentException e) {\n" + 
48730
				"		}\n" + 
48731
				"	}\n" + 
48732
				"}\n",//-----------------------------------------------------------------------
48733
			},
48734
			"----------\n" + 
48735
			"1. WARNING in X.java (at line 6)\n" + 
48736
			"	void bar(List l, IllegalArgumentException iae) {\n" + 
48737
			"	         ^^^^\n" + 
48738
			"List is a raw type. References to generic type List<E> should be parameterized\n" + 
48739
			"----------\n" + 
48740
			"2. WARNING in X.java (at line 8)\n" + 
48741
			"	new X(l, iae);\n" + 
48742
			"	^^^^^^^^^^^^^\n" + 
48743
			"Type safety: Unchecked invocation X(List, IllegalArgumentException) of the generic constructor X(List<U>, T) of type X\n" + 
48744
			"----------\n" + 
48745
			"3. ERROR in X.java (at line 8)\n" + 
48746
			"	new X(l, iae);\n" + 
48747
			"	^^^^^^^^^^^^^\n" + 
48748
			"Unhandled exception type Throwable\n" + 
48749
			"----------\n" + 
48750
			"4. WARNING in X.java (at line 8)\n" + 
48751
			"	new X(l, iae);\n" + 
48752
			"	      ^\n" + 
48753
			"Type safety: The expression of type List needs unchecked conversion to conform to List<List<?>>\n" + 
48754
			"----------\n");
48755
}
48756
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=258798 - variation
48757
public void test1438() {
48758
	this.runNegativeTest(
48759
			new String[] {
48760
				"X.java", //-----------------------------------------------------------------------
48761
				"import java.util.*;\n" + 
48762
				"public class X {\n" + 
48763
				"	<U extends List<?>, T extends Throwable> X(List<U> lu, T t) throws T {\n" + 
48764
				"		if (lu.isEmpty()) throw t;\n" + 
48765
				"	}\n" + 
48766
				"	void bar(List l, IllegalArgumentException iae) {\n" + 
48767
				"		try {\n" + 
48768
				"			new X(l, iae){};\n" + 
48769
				"		} catch (IllegalArgumentException e) {\n" + 
48770
				"		}\n" + 
48771
				"	}\n" + 
48772
				"}\n",//-----------------------------------------------------------------------
48773
			},
48774
			"----------\n" + 
48775
			"1. WARNING in X.java (at line 6)\n" + 
48776
			"	void bar(List l, IllegalArgumentException iae) {\n" + 
48777
			"	         ^^^^\n" + 
48778
			"List is a raw type. References to generic type List<E> should be parameterized\n" + 
48779
			"----------\n" + 
48780
			"2. WARNING in X.java (at line 8)\n" + 
48781
			"	new X(l, iae){};\n" + 
48782
			"	^^^^^^^^^^^^^^^\n" + 
48783
			"Type safety: Unchecked invocation X(List, IllegalArgumentException) of the generic constructor X(List<U>, T) of type X\n" + 
48784
			"----------\n" + 
48785
			"3. ERROR in X.java (at line 8)\n" + 
48786
			"	new X(l, iae){};\n" + 
48787
			"	^^^^^^^^^^^^^^^\n" + 
48788
			"Unhandled exception type Throwable\n" + 
48789
			"----------\n" + 
48790
			"4. WARNING in X.java (at line 8)\n" + 
48791
			"	new X(l, iae){};\n" + 
48792
			"	      ^\n" + 
48793
			"Type safety: The expression of type List needs unchecked conversion to conform to List<List<?>>\n" + 
48794
			"----------\n");
48795
}
48796
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=258798 - variation
48797
public void test1439() {
48798
	this.runNegativeTest(
48799
			new String[] {
48800
				"X.java", //-----------------------------------------------------------------------
48801
				"import java.util.*;\n" + 
48802
				"public class X {\n" + 
48803
				"	<U extends List<?>, T extends Throwable> X(List<U> lu, T t) throws T {\n" + 
48804
				"		if (lu.isEmpty()) throw t;\n" + 
48805
				"	}\n" + 
48806
				"	X() { \n" + 
48807
				"		this((List) null, null);\n" + 
48808
				"	}\n" + 
48809
				"}\n" + 
48810
				"class Y extends X {\n" + 
48811
				"	<U extends List<?>, T extends Throwable> Y(List<U> lu, T t) {\n" + 
48812
				"		super((List)lu, t);\n" + 
48813
				"	}\n" + 
48814
				"}\n",//-----------------------------------------------------------------------
48815
			},
48816
			"----------\n" + 
48817
			"1. WARNING in X.java (at line 7)\n" + 
48818
			"	this((List) null, null);\n" + 
48819
			"	^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
48820
			"Type safety: Unchecked invocation X(List, null) of the generic constructor X(List<U>, T) of type X\n" + 
48821
			"----------\n" + 
48822
			"2. ERROR in X.java (at line 7)\n" + 
48823
			"	this((List) null, null);\n" + 
48824
			"	^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
48825
			"Unhandled exception type Throwable\n" + 
48826
			"----------\n" + 
48827
			"3. WARNING in X.java (at line 7)\n" + 
48828
			"	this((List) null, null);\n" + 
48829
			"	     ^^^^^^^^^^^\n" + 
48830
			"Type safety: The expression of type List needs unchecked conversion to conform to List<List<?>>\n" + 
48831
			"----------\n" + 
48832
			"4. WARNING in X.java (at line 7)\n" + 
48833
			"	this((List) null, null);\n" + 
48834
			"	      ^^^^\n" + 
48835
			"List is a raw type. References to generic type List<E> should be parameterized\n" + 
48836
			"----------\n" + 
48837
			"5. WARNING in X.java (at line 12)\n" + 
48838
			"	super((List)lu, t);\n" + 
48839
			"	^^^^^^^^^^^^^^^^^^^\n" + 
48840
			"Type safety: Unchecked invocation X(List, T) of the generic constructor X(List<U>, T) of type X\n" + 
48841
			"----------\n" + 
48842
			"6. ERROR in X.java (at line 12)\n" + 
48843
			"	super((List)lu, t);\n" + 
48844
			"	^^^^^^^^^^^^^^^^^^^\n" + 
48845
			"Unhandled exception type Throwable\n" + 
48846
			"----------\n" + 
48847
			"7. WARNING in X.java (at line 12)\n" + 
48848
			"	super((List)lu, t);\n" + 
48849
			"	      ^^^^^^^^\n" + 
48850
			"Type safety: The expression of type List needs unchecked conversion to conform to List<List<?>>\n" + 
48851
			"----------\n" + 
48852
			"8. WARNING in X.java (at line 12)\n" + 
48853
			"	super((List)lu, t);\n" + 
48854
			"	       ^^^^\n" + 
48855
			"List is a raw type. References to generic type List<E> should be parameterized\n" + 
48856
			"----------\n");
48857
}
48442
}
48858
}
(-)src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java (-33 / +43 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2009 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 2981-3002 Link Here
2981
				"	public static <T> void foo(List<T>... e) {}\n" +
2981
				"	public static <T> void foo(List<T>... e) {}\n" +
2982
				"}\n"
2982
				"}\n"
2983
			},
2983
			},
2984
			"----------\n" +
2984
			"----------\n" + 
2985
			"1. WARNING in p\\X.java (at line 6)\n" +
2985
			"1. WARNING in p\\X.java (at line 6)\n" + 
2986
			"	public X() { foo(data.l); }\n" +
2986
			"	public X() { foo(data.l); }\n" + 
2987
			"	             ^^^^^^^^^^^\n" +
2987
			"	             ^^^^^^^^^^^\n" + 
2988
			"Type safety: Unchecked invocation foo(List...) of the generic method foo(List<T>...) of type Z\n" +
2988
			"Type safety : A generic array of List<Object> is created for a varargs parameter\n" + 
2989
			"----------\n" +
2989
			"----------\n" + 
2990
			"2. WARNING in p\\X.java (at line 6)\n" +
2990
			"2. WARNING in p\\X.java (at line 6)\n" + 
2991
			"	public X() { foo(data.l); }\n" +
2991
			"	public X() { foo(data.l); }\n" + 
2992
			"	                 ^^^^^^\n" +
2992
			"	             ^^^^^^^^^^^\n" + 
2993
			"Type safety: The expression of type List needs unchecked conversion to conform to List<T>\n" +
2993
			"Type safety: Unchecked invocation foo(List) of the generic method foo(List<T>...) of type Z\n" + 
2994
			"----------\n" +
2994
			"----------\n" + 
2995
			"----------\n" +
2995
			"3. WARNING in p\\X.java (at line 6)\n" + 
2996
			"1. WARNING in p\\Y.java (at line 4)\n" +
2996
			"	public X() { foo(data.l); }\n" + 
2997
			"	List l = null;\n" +
2997
			"	                 ^^^^^^\n" + 
2998
			"	^^^^\n" +
2998
			"Type safety: The expression of type List needs unchecked conversion to conform to List<Object>\n" + 
2999
			"List is a raw type. References to generic type List<E> should be parameterized\n" +
2999
			"----------\n" + 
3000
			"----------\n" + 
3001
			"1. WARNING in p\\Y.java (at line 4)\n" + 
3002
			"	List l = null;\n" + 
3003
			"	^^^^\n" + 
3004
			"List is a raw type. References to generic type List<E> should be parameterized\n" + 
3000
			"----------\n"
3005
			"----------\n"
3001
			// unchecked conversion warnings
3006
			// unchecked conversion warnings
3002
		);
3007
		);
Lines 3021-3042 Link Here
3021
				"	public static <T> void foo(List<T>... e) {}\n" +
3026
				"	public static <T> void foo(List<T>... e) {}\n" +
3022
				"}\n"
3027
				"}\n"
3023
			},
3028
			},
3024
			"----------\n" +
3029
			"----------\n" + 
3025
			"1. WARNING in p\\X.java (at line 5)\n" +
3030
			"1. WARNING in p\\X.java (at line 5)\n" + 
3026
			"	public X() { foo(data.l); }\n" +
3031
			"	public X() { foo(data.l); }\n" + 
3027
			"	             ^^^^^^^^^^^\n" +
3032
			"	             ^^^^^^^^^^^\n" + 
3028
			"Type safety: Unchecked invocation foo(List...) of the generic method foo(List<T>...) of type Y\n" +
3033
			"Type safety : A generic array of List<Object> is created for a varargs parameter\n" + 
3029
			"----------\n" +
3034
			"----------\n" + 
3030
			"2. WARNING in p\\X.java (at line 5)\n" +
3035
			"2. WARNING in p\\X.java (at line 5)\n" + 
3031
			"	public X() { foo(data.l); }\n" +
3036
			"	public X() { foo(data.l); }\n" + 
3032
			"	                 ^^^^^^\n" +
3037
			"	             ^^^^^^^^^^^\n" + 
3033
			"Type safety: The expression of type List needs unchecked conversion to conform to List<T>\n" +
3038
			"Type safety: Unchecked invocation foo(List) of the generic method foo(List<T>...) of type Y\n" + 
3034
			"----------\n" +
3039
			"----------\n" + 
3035
			"----------\n" +
3040
			"3. WARNING in p\\X.java (at line 5)\n" + 
3036
			"1. WARNING in p\\Y.java (at line 4)\n" +
3041
			"	public X() { foo(data.l); }\n" + 
3037
			"	List l = null;\n" +
3042
			"	                 ^^^^^^\n" + 
3038
			"	^^^^\n" +
3043
			"Type safety: The expression of type List needs unchecked conversion to conform to List<Object>\n" + 
3039
			"List is a raw type. References to generic type List<E> should be parameterized\n" +
3044
			"----------\n" + 
3045
			"----------\n" + 
3046
			"1. WARNING in p\\Y.java (at line 4)\n" + 
3047
			"	List l = null;\n" + 
3048
			"	^^^^\n" + 
3049
			"List is a raw type. References to generic type List<E> should be parameterized\n" + 
3040
			"----------\n"
3050
			"----------\n"
3041
			// unchecked conversion warnings
3051
			// unchecked conversion warnings
3042
		);
3052
		);
(-)src/org/eclipse/jdt/core/tests/dom/BatchASTCreationTests.java (-2 / +32 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2004, 2007 IBM Corporation and others.
2
 * Copyright (c) 2004, 2009 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 1404-1414 Link Here
1404
				"class W<T> extends Z<T> {\n" +
1404
				"class W<T> extends Z<T> {\n" +
1405
				"}",
1405
				"}",
1406
			},
1406
			},
1407
			"Lp1/X;.foo<T:Lp1/Y<-TT;>;>(Lp1/Z<TT;>;)V%<>"
1407
			"Lp1/X;.foo<T:Lp1/Y<-TT;>;>(Lp1/Z<TT;>;)V%<Lp1/X~Y<Lp1/X~Y;-Lp1/X~Y<Lp1/X~Y;-Lp1/X;:2TT;>;>;>"
1408
		);
1408
		);
1409
	}
1409
	}
1410
1410
1411
	/*
1411
	/*
1412
	 * Ensures that a raw method binding can be created using its key in batch creation.
1413
	 * (regression test for bug 87749 different IMethodBindings of generic method have equal getKey())
1414
	 */
1415
	public void test063a() throws CoreException {
1416
		assertRequestedBindingFound(
1417
			new String[] {
1418
				"/P/p1/X.java",
1419
				"package p1;\n" +
1420
				"public class X<U extends X<T>> {\n" +
1421
				"	public void foo(Z<U> z) {\n" +
1422
				"    }\n" +
1423
				"    /**\n" +
1424
				"     * @see #foo(Z)\n" +
1425
				"     */\n" +
1426
				"    static void bar(X x) {\n" +
1427
				"        /*start*/x.foo(new W())/*end*/;\n" +
1428
				"    }\n" +
1429
				"}\n" +
1430
				"class Y<T> {\n" +
1431
				"}\n" +
1432
				"class Z<T> {\n" +
1433
				"}\n" +
1434
				"class W<T> extends Z<T> {\n" +
1435
				"}",
1436
			},
1437
			"Lp1/X<>;.foo(Lp1/Z;)V"
1438
		);
1439
	}
1440
	
1441
	/*
1412
	 * Ensures that a parameterized type binding with a capture binding in its arguments can be created using its key in batch creation.
1442
	 * Ensures that a parameterized type binding with a capture binding in its arguments can be created using its key in batch creation.
1413
	 * (regression test for bug 94092 ASTParser#createASTs(..) restores wrong bindings from capture keys)
1443
	 * (regression test for bug 94092 ASTParser#createASTs(..) restores wrong bindings from capture keys)
1414
	 */
1444
	 */

Return to bug 258798