Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 122013 Details for
Bug 258798
[1.5][compiler] Return type should be erased after unchecked conversion during inference
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Final patch
258798b.txt (text/plain), 220.70 KB, created by
Philipe Mulet
on 2009-01-08 16:09:59 EST
(
hide
)
Description:
Final patch
Filename:
MIME Type:
Creator:
Philipe Mulet
Created:
2009-01-08 16:09:59 EST
Size:
220.70 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/ast/NameReference.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/NameReference.java,v >retrieving revision 1.20 >diff -u -r1.20 NameReference.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/NameReference.java 25 Sep 2008 23:10:29 -0000 1.20 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/NameReference.java 8 Jan 2009 20:33:19 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2006 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -26,39 +26,47 @@ > //will be a TypeReference (static message sends.....) and there is > //no changeClass in java. > public NameReference() { >- super(); > this.bits |= Binding.TYPE | Binding.VARIABLE; // restrictiveFlag >- > } >+ > public FieldBinding fieldBinding() { > //this method should be sent ONLY after a check against isFieldReference() > //check its use doing senders......... >- > return (FieldBinding) this.binding ; > } >+ > public boolean isSuperAccess() { > return false; > } >+ > public boolean isTypeAccess() { > // null is acceptable when we are resolving the first part of a reference > return this.binding == null || this.binding instanceof ReferenceBinding; > } >+ > public boolean isTypeReference() { > return this.binding instanceof ReferenceBinding; > } >+ > public void setActualReceiverType(ReferenceBinding receiverType) { > if (receiverType == null) return; // error scenario only > this.actualReceiverType = receiverType; > } >+ > public void setDepth(int depth) { > this.bits &= ~DepthMASK; // flush previous depth if any > if (depth > 0) { > this.bits |= (depth & 0xFF) << DepthSHIFT; // encoded on 8 bits > } > } >+ > public void setFieldIndex(int index){ > // ignored > } > >+public void setUnchecked(boolean isUnchecked) { >+ // ignored >+} >+ > public abstract String unboundReferenceErrorName(); > } >Index: compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java,v >retrieving revision 1.63 >diff -u -r1.63 Javadoc.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java 24 Nov 2008 08:22:40 -0000 1.63 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java 8 Jan 2009 20:33:16 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -260,36 +260,35 @@ > resolveReference(this.seeReferences[i], methScope); > > // see whether we can have a super reference >- if (methDecl != null && (methDecl.isConstructor() || overriding) && !superRef) { >- if (this.seeReferences[i] instanceof JavadocMessageSend) { >- JavadocMessageSend messageSend = (JavadocMessageSend) this.seeReferences[i]; >- // if binding is valid then look if we have a reference to an overriden method/constructor >- if (messageSend.binding != null && messageSend.binding.isValidBinding() && messageSend.actualReceiverType instanceof ReferenceBinding) { >- ReferenceBinding methodReceiverType = (ReferenceBinding) messageSend.actualReceiverType; >- if ((methodReceiverType.isSuperclassOf(methDecl.binding.declaringClass) || (methodReceiverType.isInterface() && methDecl.binding.declaringClass.implementsInterface(methodReceiverType, true))) && >- CharOperation.equals(messageSend.selector, methDecl.selector) && >- (methDecl.binding.returnType.isCompatibleWith(messageSend.binding.returnType))) { >- if (messageSend.arguments == null && methDecl.arguments == null) { >- superRef = true; >- } >- else if (messageSend.arguments != null && methDecl.arguments != null) { >- superRef = methDecl.binding.areParameterErasuresEqual(messageSend.binding); >+ if (methDecl != null && !superRef) { >+ if (!methDecl.isConstructor()) { >+ if (overriding && this.seeReferences[i] instanceof JavadocMessageSend) { >+ JavadocMessageSend messageSend = (JavadocMessageSend) this.seeReferences[i]; >+ // if binding is valid then look if we have a reference to an overriden method/constructor >+ if (messageSend.binding != null && messageSend.binding.isValidBinding() && messageSend.actualReceiverType instanceof ReferenceBinding) { >+ ReferenceBinding methodReceiverType = (ReferenceBinding) messageSend.actualReceiverType; >+ TypeBinding superType = methDecl.binding.declaringClass.findSuperTypeOriginatingFrom(methodReceiverType); >+ if (superType != null && superType.original() != methDecl.binding.declaringClass && CharOperation.equals(messageSend.selector, methDecl.selector)) { >+ if (methScope.environment().methodVerifier().doesMethodOverride(methDecl.binding, messageSend.binding.original())) { >+ superRef = true; >+ } > } > } > } >- } >- else if (this.seeReferences[i] instanceof JavadocAllocationExpression) { >+ } else if (this.seeReferences[i] instanceof JavadocAllocationExpression) { > JavadocAllocationExpression allocationExpr = (JavadocAllocationExpression) this.seeReferences[i]; > // if binding is valid then look if we have a reference to an overriden method/constructor > if (allocationExpr.binding != null && allocationExpr.binding.isValidBinding()) { >- if (methDecl.binding.declaringClass.isCompatibleWith(allocationExpr.resolvedType)) { >- if (allocationExpr.arguments == null && methDecl.arguments == null) { >- superRef = true; >- } >- else if (allocationExpr.arguments != null && methDecl.arguments != null && allocationExpr.arguments.length == methDecl.arguments.length) { >- superRef = methDecl.binding.areParametersCompatibleWith(allocationExpr.binding.parameters); >+ ReferenceBinding allocType = (ReferenceBinding) allocationExpr.resolvedType.original(); >+ ReferenceBinding superType = (ReferenceBinding) methDecl.binding.declaringClass.findSuperTypeOriginatingFrom(allocType); >+ if (superType != null && superType.original() != methDecl.binding.declaringClass) { >+ MethodBinding superConstructor = methScope.getConstructor(superType, methDecl.binding.parameters, allocationExpr); >+ if (superConstructor.isValidBinding() && superConstructor.original() == allocationExpr.binding.original()) { >+ if (superConstructor.areParametersEqual(methDecl.binding)) { >+ superRef = true; >+ } > } >- } >+ } > } > } > } >Index: compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java,v >retrieving revision 1.96 >diff -u -r1.96 ASTNode.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java 30 Sep 2008 15:31:26 -0000 1.96 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java 8 Jan 2009 20:33:02 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -39,7 +39,7 @@ > public final static int Bit14 = 0x2000; // strictly assigned (reference lhs) | discard enclosing instance (explicit constr call) | hasBeenGenerated (type decl) > 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) > public final static int Bit16 = 0x8000; // in javadoc comment (name ref, type ref, msg) >- public final static int Bit17 = 0x10000; // compound assigned (reference lhs) >+ public final static int Bit17 = 0x10000; // compound assigned (reference lhs) | unchecked (msg, alloc, explicit constr call) > public final static int Bit18 = 0x20000; // non null (expression) | onDemand (import reference) > public final static int Bit19 = 0x40000; // didResolve (parameterized qualified type ref/parameterized single type ref) | empty (javadoc return statement) | needReceiverGenericCast (msg/fieldref) > public final static int Bit20 = 0x80000; >@@ -159,6 +159,9 @@ > // for explicit constructor call > public static final int DiscardEnclosingInstance = Bit14; // used for codegen > >+ // for all method/constructor invocations (msg, alloc, expl. constr call) >+ public static final int Unchecked = Bit17; >+ > // for empty statement > public static final int IsUsefulEmptyStatement = Bit1; > >@@ -241,14 +244,14 @@ > return INVOCATION_ARGUMENT_WILDCARD; > } > } >- TypeBinding checkedParameterType = originalParameterType == null ? parameterType : originalParameterType; >+ TypeBinding checkedParameterType = parameterType; // originalParameterType == null ? parameterType : originalParameterType; > if (argumentType != checkedParameterType && argumentType.needsUncheckedConversion(checkedParameterType)) { > scope.problemReporter().unsafeTypeConversion(argument, argumentType, checkedParameterType); > return INVOCATION_ARGUMENT_UNCHECKED; > } > return INVOCATION_ARGUMENT_OK; > } >- public static void checkInvocationArguments(BlockScope scope, Expression receiver, TypeBinding receiverType, MethodBinding method, Expression[] arguments, TypeBinding[] argumentTypes, boolean argsContainCast, InvocationSite invocationSite) { >+ public static void checkInvocationArguments(BlockScope scope, Expression receiver, TypeBinding receiverType, MethodBinding method, Expression[] arguments, TypeBinding[] argumentTypes, boolean argsContainCast, InvocationSite invocationSite, boolean uncheckedBoundCheck) { > TypeBinding[] params = method.parameters; > int paramLength = params.length; > boolean isRawMemberInvocation = !method.isStatic() >@@ -260,7 +263,7 @@ > if (!isRawMemberInvocation) { > if (method instanceof ParameterizedGenericMethodBinding) { > ParameterizedGenericMethodBinding paramMethod = (ParameterizedGenericMethodBinding) method; >- if (paramMethod.isUnchecked || (paramMethod.isRaw && method.hasSubstitutedParameters())) { >+ if (paramMethod.isRaw && method.hasSubstitutedParameters()) { > rawOriginalGenericMethod = method.original(); > } > } >@@ -296,9 +299,8 @@ > for (int i = lastIndex; i < argLength; i++) { > invocationStatus |= checkInvocationArgument(scope, arguments[i], parameterType, argumentTypes[i], originalRawParam); > } >- } >- >- if (paramLength == argumentTypes.length) { // 70056 >+ } >+ if (paramLength == argLength) { // 70056 > int varargsIndex = paramLength - 1; > ArrayBinding varargsType = (ArrayBinding) params[varargsIndex]; > TypeBinding lastArgType = argumentTypes[varargsIndex]; >@@ -335,8 +337,13 @@ > scope.problemReporter().wildcardInvocation((ASTNode)invocationSite, receiverType, method, argumentTypes); > } else if (!method.isStatic() && !receiverType.isUnboundWildcard() && method.declaringClass.isRawType() && method.hasSubstitutedParameters()) { > scope.problemReporter().unsafeRawInvocation((ASTNode)invocationSite, method); >- } else if (rawOriginalGenericMethod != null) { >- scope.problemReporter().unsafeRawGenericMethodInvocation((ASTNode)invocationSite, method); >+ } else if (rawOriginalGenericMethod != null >+ || uncheckedBoundCheck >+ || ((invocationStatus & INVOCATION_ARGUMENT_UNCHECKED) != 0 >+ && method instanceof ParameterizedGenericMethodBinding >+ /*&& method.returnType != scope.environment().convertToRawType(method.returnType.erasure(), true)*/)) { >+ invocationSite.setUnchecked(true); >+ scope.problemReporter().unsafeRawGenericMethodInvocation((ASTNode)invocationSite, method, argumentTypes); > } > } > public ASTNode concreteStatement() { >Index: compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java,v >retrieving revision 1.91 >diff -u -r1.91 QualifiedAllocationExpression.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java 17 Sep 2008 11:11:09 -0000 1.91 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java 8 Jan 2009 20:33:19 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -82,6 +82,9 @@ > // record some dependency information for exception types > ReferenceBinding[] thrownExceptions; > if (((thrownExceptions = this.binding.thrownExceptions).length) != 0) { >+ if ((this.bits & ASTNode.Unchecked) != 0) { >+ thrownExceptions = currentScope.environment().convertToRawTypes(this.binding.original().thrownExceptions, true, true); >+ } > // check exception handling > flowContext.checkExceptionHandlers( > thrownExceptions, >@@ -369,7 +372,7 @@ > if (isMethodUseDeprecated(this.binding, scope, true)) { > scope.problemReporter().deprecatedMethod(this.binding, this); > } >- checkInvocationArguments(scope, null, allocationType, this.binding, this.arguments, argumentTypes, argsContainCast, this); >+ checkInvocationArguments(scope, null, allocationType, this.binding, this.arguments, argumentTypes, argsContainCast, this, (this.bits & ASTNode.Unchecked) != 0); > if (this.typeArguments != null && this.binding.original().typeVariables == Binding.NO_TYPE_VARIABLES) { > scope.problemReporter().unnecessaryTypeArgumentsForMethodInvocation(this.binding, this.genericTypeArguments, this.typeArguments); > } >@@ -446,13 +449,13 @@ > this.enclosingInstance.computeConversion(scope, targetEnclosing, enclosingInstanceType); > } > if (this.arguments != null) { >- checkInvocationArguments(scope, null, anonymousSuperclass, inheritedBinding, this.arguments, argumentTypes, argsContainCast, this); >+ checkInvocationArguments(scope, null, anonymousSuperclass, inheritedBinding, this.arguments, argumentTypes, argsContainCast, this, (this.bits & ASTNode.Unchecked) != 0); > } > if (this.typeArguments != null && inheritedBinding.original().typeVariables == Binding.NO_TYPE_VARIABLES) { > scope.problemReporter().unnecessaryTypeArgumentsForMethodInvocation(inheritedBinding, this.genericTypeArguments, this.typeArguments); > } > // Update the anonymous inner class : superclass, interface >- this.binding = this.anonymousType.createDefaultConstructorWithBinding(inheritedBinding); >+ this.binding = this.anonymousType.createDefaultConstructorWithBinding(inheritedBinding, (this.bits & ASTNode.Unchecked) != 0); > return this.resolvedType; > } > >Index: compiler/org/eclipse/jdt/internal/compiler/ast/AbstractVariableDeclaration.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractVariableDeclaration.java,v >retrieving revision 1.33 >diff -u -r1.33 AbstractVariableDeclaration.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/AbstractVariableDeclaration.java 27 Jun 2008 16:03:55 -0000 1.33 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/AbstractVariableDeclaration.java 8 Jan 2009 20:33:02 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2006 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -128,4 +128,9 @@ > public void setFieldIndex(int depth) { > // do nothing by default > } >+ >+ public void setUnchecked(boolean isUnchecked) { >+ // ignored >+ } >+ > } >Index: compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java,v >retrieving revision 1.76 >diff -u -r1.76 AllocationExpression.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java 17 Sep 2008 11:11:09 -0000 1.76 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java 8 Jan 2009 20:33:02 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -43,6 +43,9 @@ > // record some dependency information for exception types > ReferenceBinding[] thrownExceptions; > if (((thrownExceptions = this.binding.thrownExceptions).length) != 0) { >+ if ((this.bits & ASTNode.Unchecked) != 0) { >+ thrownExceptions = currentScope.environment().convertToRawTypes(this.binding.original().thrownExceptions, true, true); >+ } > // check exception handling > flowContext.checkExceptionHandlers( > thrownExceptions, >@@ -353,7 +356,7 @@ > } > if (isMethodUseDeprecated(this.binding, scope, true)) > scope.problemReporter().deprecatedMethod(this.binding, this); >- checkInvocationArguments(scope, null, allocationType, this.binding, this.arguments, argumentTypes, argsContainCast, this); >+ checkInvocationArguments(scope, null, allocationType, this.binding, this.arguments, argumentTypes, argsContainCast, this, (this.bits & ASTNode.Unchecked) != 0); > if (this.typeArguments != null && this.binding.original().typeVariables == Binding.NO_TYPE_VARIABLES) { > scope.problemReporter().unnecessaryTypeArgumentsForMethodInvocation(this.binding, this.genericTypeArguments, this.typeArguments); > } >@@ -372,6 +375,15 @@ > // ignored > } > >+public void setUnchecked(boolean isUnchecked) { >+ if (isUnchecked) { >+ this.bits |= ASTNode.Unchecked; >+ } else { >+ this.bits &= ~ASTNode.Unchecked; >+ } >+ >+} >+ > public void traverse(ASTVisitor visitor, BlockScope scope) { > if (visitor.visit(this, scope)) { > if (this.typeArguments != null) { >Index: compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java,v >retrieving revision 1.67 >diff -u -r1.67 ExplicitConstructorCall.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java 17 Sep 2008 11:11:09 -0000 1.67 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java 8 Jan 2009 20:33:09 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -81,6 +81,9 @@ > > ReferenceBinding[] thrownExceptions; > if ((thrownExceptions = this.binding.thrownExceptions) != Binding.NO_EXCEPTIONS) { >+ if ((this.bits & ASTNode.Unchecked) != 0) { >+ thrownExceptions = currentScope.environment().convertToRawTypes(this.binding.original().thrownExceptions, true, true); >+ } > // check exceptions > flowContext.checkExceptionHandlers( > thrownExceptions, >@@ -397,7 +400,7 @@ > if (isMethodUseDeprecated(this.binding, scope, this.accessMode != ExplicitConstructorCall.ImplicitSuper)) { > scope.problemReporter().deprecatedMethod(this.binding, this); > } >- checkInvocationArguments(scope, null, receiverType, this.binding, this.arguments, argumentTypes, argsContainCast, this); >+ checkInvocationArguments(scope, null, receiverType, this.binding, this.arguments, argumentTypes, argsContainCast, this, (this.bits & ASTNode.Unchecked) != 0); > if (this.binding.isPrivate() || receiverType.isLocalType()) { > this.binding.original().modifiers |= ExtraCompilerModifiers.AccLocallyUsed; > } >@@ -430,6 +433,15 @@ > // ignore for here > } > >+ public void setUnchecked(boolean isUnchecked) { >+ if (isUnchecked) { >+ this.bits |= ASTNode.Unchecked; >+ } else { >+ this.bits &= ~ASTNode.Unchecked; >+ } >+ >+ } >+ > public void traverse(ASTVisitor visitor, BlockScope scope) { > if (visitor.visit(this, scope)) { > if (this.qualification != null) { >Index: compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java,v >retrieving revision 1.152 >diff -u -r1.152 TypeDeclaration.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java 24 Sep 2008 16:05:23 -0000 1.152 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java 8 Jan 2009 20:33:25 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -345,7 +345,7 @@ > } > > // anonymous type constructor creation: rank is important since bindings already got sorted >-public MethodBinding createDefaultConstructorWithBinding(MethodBinding inheritedConstructorBinding) { >+public MethodBinding createDefaultConstructorWithBinding(MethodBinding inheritedConstructorBinding, boolean isUnchecked) { > //Add to method'set, the default constuctor that just recall the > //super constructor with the same arguments > String baseName = "$anonymous"; //$NON-NLS-1$ >@@ -393,11 +393,15 @@ > } > > //============BINDING UPDATE========================== >+ ReferenceBinding[] thrownExceptions = isUnchecked >+ ? this.scope.environment().convertToRawTypes(inheritedConstructorBinding.original().thrownExceptions, true, true) >+ : inheritedConstructorBinding.thrownExceptions; >+ > SourceTypeBinding sourceType = this.binding; > constructor.binding = new MethodBinding( > constructor.modifiers, //methodDeclaration > argumentsLength == 0 ? Binding.NO_PARAMETERS : argumentTypes, //arguments bindings >- inheritedConstructorBinding.thrownExceptions, //exceptions >+ thrownExceptions, //exceptions > sourceType); //declaringClass > constructor.binding.tagBits |= (inheritedConstructorBinding.tagBits & TagBits.HasMissingType); > constructor.binding.modifiers |= ExtraCompilerModifiers.AccIsDefaultConstructor; >Index: compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java,v >retrieving revision 1.124 >diff -u -r1.124 FieldReference.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java 1 Oct 2008 22:27:55 -0000 1.124 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java 8 Jan 2009 20:33:13 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -609,6 +609,10 @@ > // ignored > } > >+public void setUnchecked(boolean isUnchecked) { >+ // ignored >+} >+ > public void traverse(ASTVisitor visitor, BlockScope scope) { > if (visitor.visit(this, scope)) { > this.receiver.traverse(visitor, scope); >Index: compiler/org/eclipse/jdt/internal/compiler/ast/CastExpression.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CastExpression.java,v >retrieving revision 1.124 >diff -u -r1.124 CastExpression.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/CastExpression.java 2 Dec 2008 10:02:46 -0000 1.124 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/CastExpression.java 8 Jan 2009 20:33:05 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -256,6 +256,7 @@ > public void setActualReceiverType(ReferenceBinding actualReceiverType) { /* ignore */} > public void setDepth(int depth) { /* ignore */} > public void setFieldIndex(int depth){ /* ignore */} >+ public void setUnchecked(boolean isUnchecked) {/* ignore */} > public int sourceStart() { return 0; } > public int sourceEnd() { return 0; } > }; >@@ -287,7 +288,8 @@ > } > } > for (int i = 0; i < argumentLength; i++) { >- if (originalArgumentTypes[i] != alternateArgumentTypes[i]) { >+ if (originalArgumentTypes[i] != alternateArgumentTypes[i] >+ /*&& !originalArgumentTypes[i].needsUncheckedConversion(alternateArgumentTypes[i])*/) { > scope.problemReporter().unnecessaryCast((CastExpression)arguments[i]); > } > } >Index: compiler/org/eclipse/jdt/internal/compiler/ast/Argument.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Argument.java,v >retrieving revision 1.63 >diff -u -r1.63 Argument.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/Argument.java 27 Jun 2008 16:03:55 -0000 1.63 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/Argument.java 8 Jan 2009 20:33:02 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -93,7 +93,6 @@ > } > > public TypeBinding resolveForCatch(BlockScope scope) { >- > // resolution on an argument of a catch clause > // provide the scope with a side effect : insertion of a LOCAL > // that represents the argument. The type must be from JavaThrowable >Index: compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java,v >retrieving revision 1.139 >diff -u -r1.139 MessageSend.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java 7 Jan 2009 16:32:59 -0000 1.139 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java 8 Jan 2009 20:33:19 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -69,6 +69,9 @@ > } > ReferenceBinding[] thrownExceptions; > if ((thrownExceptions = this.binding.thrownExceptions) != Binding.NO_EXCEPTIONS) { >+ if ((this.bits & ASTNode.Unchecked) != 0) { >+ thrownExceptions = currentScope.environment().convertToRawTypes(this.binding.original().thrownExceptions, true, true); >+ } > // must verify that exceptions potentially thrown by this expression are caught in the method > flowContext.checkExceptionHandlers(thrownExceptions, this, flowInfo.copy(), currentScope); > // TODO (maxime) the copy above is needed because of a side effect into >@@ -394,8 +397,7 @@ > scope.problemReporter().errorNoMethodFor(this, this.actualReceiverType, argumentTypes); > return null; > } >- this.binding = >- this.receiver.isImplicitThis() >+ this.binding = this.receiver.isImplicitThis() > ? scope.getImplicitMethod(this.selector, argumentTypes, this) > : scope.getMethod(this.actualReceiverType, this.selector, argumentTypes, this); > if (!this.binding.isValidBinding()) { >@@ -466,7 +468,7 @@ > scope.problemReporter().indirectAccessToStaticMethod(this, this.binding); > } > } >- checkInvocationArguments(scope, this.receiver, this.actualReceiverType, this.binding, this.arguments, argumentTypes, argsContainCast, this); >+ checkInvocationArguments(scope, this.receiver, this.actualReceiverType, this.binding, this.arguments, argumentTypes, argsContainCast, this, (this.bits & ASTNode.Unchecked) != 0); > > //-------message send that are known to fail at compile time----------- > if (this.binding.isAbstract()) { >@@ -482,8 +484,18 @@ > if (this.binding == scope.environment().arrayClone && compilerOptions.sourceLevel >= ClassFileConstants.JDK1_5) { > this.resolvedType = this.actualReceiverType; > } else { >- TypeBinding returnType = this.binding.returnType; >- if (returnType != null) returnType = returnType.capture(scope, this.sourceEnd); >+ TypeBinding returnType; >+ if ((this.bits & ASTNode.Unchecked) != 0) { >+ returnType = this.binding.original().returnType; >+ if (returnType != null) { >+ returnType = scope.environment().convertToRawType(returnType.erasure(), true); >+ } >+ } else { >+ returnType = this.binding.returnType; >+ if (returnType != null) { >+ returnType = returnType.capture(scope, this.sourceEnd); >+ } >+ } > this.resolvedType = returnType; > } > if (this.receiver.isSuper() && compilerOptions.getSeverity(CompilerOptions.OverridingMethodWithoutSuperInvocation) != ProblemSeverities.Ignore) { >@@ -527,6 +539,14 @@ > // ignore for here > } > >+public void setUnchecked(boolean isUnchecked) { >+ if (isUnchecked) { >+ this.bits |= ASTNode.Unchecked; >+ } else { >+ this.bits &= ~ASTNode.Unchecked; >+ } >+} >+ > public void traverse(ASTVisitor visitor, BlockScope blockScope) { > if (visitor.visit(this, blockScope)) { > this.receiver.traverse(visitor, blockScope); >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java,v >retrieving revision 1.111 >diff -u -r1.111 ParameterizedTypeBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java 6 Oct 2008 13:23:51 -0000 1.111 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java 8 Jan 2009 20:33:43 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005, 2008 IBM Corporation and others. >+ * Copyright (c) 2005, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -33,7 +33,6 @@ > private ReferenceBinding enclosingType; > > public ParameterizedTypeBinding(ReferenceBinding type, TypeBinding[] arguments, ReferenceBinding enclosingType, LookupEnvironment environment){ >- > this.environment = environment; > this.enclosingType = enclosingType; // never unresolved, never lazy per construction > // if (enclosingType != null && enclosingType.isGenericType()) { >@@ -151,7 +150,13 @@ > * A >> F corresponds to: F.collectSubstitutes(..., A, ..., CONSTRAINT_SUPER (2)) > */ > public void collectSubstitutes(Scope scope, TypeBinding actualType, InferenceContext inferenceContext, int constraint) { >- if ((this.tagBits & TagBits.HasTypeVariable) == 0) return; >+ if ((this.tagBits & TagBits.HasTypeVariable) == 0) { >+ TypeBinding actualEquivalent = actualType.findSuperTypeOriginatingFrom(this.type); >+ if (actualEquivalent != null && actualEquivalent.isRawType()) { >+ inferenceContext.isUnchecked = true; >+ } >+ return; >+ } > if (actualType == TypeBinding.NULL) return; > > if (!(actualType instanceof ReferenceBinding)) return; >@@ -186,7 +191,7 @@ > formalArguments = ((ParameterizedTypeBinding)formalEquivalent).arguments; > break; > case Binding.RAW_TYPE : >- if (!inferenceContext.checkRawSubstitution()) { >+ if (inferenceContext.depth > 0) { > inferenceContext.status = InferenceContext.FAILED; // marker for impossible inference > } > return; >@@ -202,8 +207,10 @@ > actualArguments = ((ParameterizedTypeBinding)actualEquivalent).arguments; > break; > case Binding.RAW_TYPE : >- if (!inferenceContext.checkRawSubstitution()) { >+ if (inferenceContext.depth > 0) { > inferenceContext.status = InferenceContext.FAILED; // marker for impossible inference >+ } else { >+ inferenceContext.isUnchecked = true; > } > return; > default : >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedMethodBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedMethodBinding.java,v >retrieving revision 1.27 >diff -u -r1.27 ParameterizedMethodBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedMethodBinding.java 27 Jun 2008 16:04:02 -0000 1.27 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedMethodBinding.java 8 Jan 2009 20:33:40 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -26,7 +26,6 @@ > * Create method of parameterized type, substituting original parameters/exception/return type with type arguments. > */ > public ParameterizedMethodBinding(final ParameterizedTypeBinding parameterizedDeclaringClass, MethodBinding originalMethod) { >- > super( > originalMethod.modifiers, > originalMethod.selector, >@@ -49,7 +48,7 @@ > final TypeVariableBinding[] substitutedVariables = new TypeVariableBinding[length]; > for (int i = 0; i < length; i++) { // copy original type variable to relocate > TypeVariableBinding originalVariable = originalVariables[i]; >- substitutedVariables[i] = new TypeVariableBinding(originalVariable.sourceName, this, originalVariable.rank); >+ substitutedVariables[i] = new TypeVariableBinding(originalVariable.sourceName, this, originalVariable.rank, parameterizedDeclaringClass.environment); > } > this.typeVariables = substitutedVariables; > >@@ -136,7 +135,6 @@ > * This is a CODE ASSIST method ONLY. > */ > public ParameterizedMethodBinding(final ReferenceBinding declaringClass, MethodBinding originalMethod, char[][] alternateParamaterNames, final LookupEnvironment environment) { >- > super( > originalMethod.modifiers, > originalMethod.selector, >@@ -162,7 +160,8 @@ > originalVariable.sourceName : > alternateParamaterNames[i], > this, >- originalVariable.rank); >+ originalVariable.rank, >+ environment); > } > this.typeVariables = substitutedVariables; > >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/InvocationSite.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/InvocationSite.java,v >retrieving revision 1.13 >diff -u -r1.13 InvocationSite.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/InvocationSite.java 27 Jun 2008 16:04:02 -0000 1.13 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/InvocationSite.java 8 Jan 2009 20:33:31 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2006 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -15,14 +15,19 @@ > TypeBinding[] genericTypeArguments(); > boolean isSuperAccess(); > boolean isTypeAccess(); >- void setDepth(int depth); >- void setFieldIndex(int depth); >- > // in case the receiver type does not match the actual receiver type > // e.g. pkg.Type.C (receiver type of C is type of source context, > // but actual receiver type is pkg.Type) > // e.g2. in presence of implicit access to enclosing type > void setActualReceiverType(ReferenceBinding receiverType); >- int sourceStart(); >+ void setDepth(int depth); >+ void setFieldIndex(int depth); >+ /** >+ * Positioned when a method/constructor invocation is detected having required unchecked conversion >+ * for becoming applicable. >+ * @param isUnchecked >+ */ >+ void setUnchecked(boolean isUnchecked); > int sourceEnd(); >+ int sourceStart(); > } >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java,v >retrieving revision 1.65 >diff -u -r1.65 ParameterizedGenericMethodBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java 27 Jun 2008 16:04:02 -0000 1.65 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java 8 Jan 2009 20:33:40 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -27,17 +27,15 @@ > public boolean wasInferred; // only set to true for instances resulting from method invocation inferrence > public boolean isRaw; // set to true for method behaving as raw for substitution purpose > private MethodBinding tiebreakMethod; >- public boolean isUnchecked; // transient flag set during inference (warning: bindings are shared, so flag cannot be trusted beyond) > > /** > * Perform inference of generic method type parameters and/or expected type > */ > public static MethodBinding computeCompatibleMethod(MethodBinding originalMethod, TypeBinding[] arguments, Scope scope, InvocationSite invocationSite) { >- > ParameterizedGenericMethodBinding methodSubstitute; > TypeVariableBinding[] typeVariables = originalMethod.typeVariables; > TypeBinding[] substitutes = invocationSite.genericTypeArguments(); >- >+ TypeBinding[] uncheckedArguments = null; > computeSubstitutes: { > if (substitutes != null) { > // explicit type arguments got supplied >@@ -48,19 +46,21 @@ > methodSubstitute = scope.environment().createParameterizedGenericMethod(originalMethod, substitutes); > break computeSubstitutes; > } >- > // perform type argument inference (15.12.2.7) >- > // initializes the map of substitutes (var --> type[][]{ equal, extends, super} > TypeBinding[] parameters = originalMethod.parameters; > InferenceContext inferenceContext = new InferenceContext(originalMethod); > methodSubstitute = inferFromArgumentTypes(scope, originalMethod, arguments, parameters, inferenceContext); > if (methodSubstitute == null) > return null; >+ > // substitutes may hold null to denote unresolved vars, but null arguments got replaced with respective original variable in param method >- > // 15.12.2.8 - inferring unresolved type arguments > if (inferenceContext.hasUnresolvedTypeArgument()) { >+ if (inferenceContext.isUnchecked) { // only remember unchecked status post 15.12.2.7 >+ int length = inferenceContext.substitutes.length; >+ System.arraycopy(inferenceContext.substitutes, 0, uncheckedArguments = new TypeBinding[length], 0, length); >+ } > if (methodSubstitute.returnType != TypeBinding.VOID) { > TypeBinding expectedType = null; > // if message invocation has expected type >@@ -83,26 +83,26 @@ > } > > // bounds check >- if (!methodSubstitute.isRaw) { >- for (int i = 0, length = typeVariables.length; i < length; i++) { >- TypeVariableBinding typeVariable = typeVariables[i]; >- TypeBinding substitute = methodSubstitute.typeArguments[i]; >- switch (typeVariable.boundCheck(methodSubstitute, substitute)) { >- case TypeConstants.MISMATCH : >- // incompatible due to bound check >- int argLength = arguments.length; >- TypeBinding[] augmentedArguments = new TypeBinding[argLength + 2]; // append offending substitute and typeVariable >- System.arraycopy(arguments, 0, augmentedArguments, 0, argLength); >- augmentedArguments[argLength] = substitute; >- augmentedArguments[argLength+1] = typeVariable; >- return new ProblemMethodBinding(methodSubstitute, originalMethod.selector, augmentedArguments, ProblemReasons.ParameterBoundMismatch); >- case TypeConstants.UNCHECKED : >- // tolerate unchecked bounds >- methodSubstitute.isUnchecked = true; >- break; >- } >+ for (int i = 0, length = typeVariables.length; i < length; i++) { >+ TypeVariableBinding typeVariable = typeVariables[i]; >+ TypeBinding substitute = methodSubstitute.typeArguments[i]; >+ if (uncheckedArguments != null && uncheckedArguments[i] == null) continue; // only bound check if inferred through 15.12.2.6 >+ switch (typeVariable.boundCheck(methodSubstitute, substitute)) { >+ case TypeConstants.MISMATCH : >+ // incompatible due to bound check >+ int argLength = arguments.length; >+ TypeBinding[] augmentedArguments = new TypeBinding[argLength + 2]; // append offending substitute and typeVariable >+ System.arraycopy(arguments, 0, augmentedArguments, 0, argLength); >+ augmentedArguments[argLength] = substitute; >+ augmentedArguments[argLength+1] = typeVariable; >+ return new ProblemMethodBinding(methodSubstitute, originalMethod.selector, augmentedArguments, ProblemReasons.ParameterBoundMismatch); >+ case TypeConstants.UNCHECKED : >+ // tolerate unchecked bounds >+ invocationSite.setUnchecked(true); >+ break; > } > } >+ // check presence of unchecked argument conversion a posteriori (15.12.2.6) > return methodSubstitute; > } > >@@ -110,7 +110,6 @@ > * Collect argument type mapping, handling varargs > */ > private static ParameterizedGenericMethodBinding inferFromArgumentTypes(Scope scope, MethodBinding originalMethod, TypeBinding[] arguments, TypeBinding[] parameters, InferenceContext inferenceContext) { >- > if (originalMethod.isVarargs()) { > int paramLength = parameters.length; > int minArgLength = paramLength - 1; >@@ -152,10 +151,6 @@ > if (inferenceContext.status == InferenceContext.FAILED) return null; // impossible substitution > } > } >- if (inferenceContext.status == InferenceContext.RAW_SUBSTITUTION) { >- // raw generic method inferred >- return scope.environment().createParameterizedGenericMethod(originalMethod, (RawTypeBinding)null); >- } > TypeVariableBinding[] originalVariables = originalMethod.typeVariables; > if (!resolveSubstituteConstraints(scope, originalVariables , inferenceContext, false/*ignore Ti<:Uk*/)) > return null; // impossible substitution >@@ -261,7 +256,6 @@ > * Only invoked for non-static generic methods of raw type > */ > public ParameterizedGenericMethodBinding(MethodBinding originalMethod, RawTypeBinding rawType, LookupEnvironment environment) { >- > TypeVariableBinding[] originalVariables = originalMethod.typeVariables; > int length = originalVariables.length; > TypeBinding[] rawArguments = new TypeBinding[length]; >@@ -296,7 +290,6 @@ > * Create method of parameterized type, substituting original parameters with type arguments. > */ > public ParameterizedGenericMethodBinding(MethodBinding originalMethod, TypeBinding[] typeArguments, LookupEnvironment environment) { >- > this.environment = environment; > this.modifiers = originalMethod.modifiers; > this.selector = originalMethod.selector; >@@ -307,10 +300,10 @@ > this.tagBits = originalMethod.tagBits; > this.originalMethod = originalMethod; > this.parameters = Scope.substitute(this, originalMethod.parameters); >- this.thrownExceptions = Scope.substitute(this, originalMethod.thrownExceptions); > // error case where exception type variable would have been substituted by a non-reference type (207573) >- if (this.thrownExceptions == null) this.thrownExceptions = Binding.NO_EXCEPTIONS; > this.returnType = Scope.substitute(this, originalMethod.returnType); >+ this.thrownExceptions = Scope.substitute(this, originalMethod.thrownExceptions); >+ if (this.thrownExceptions == null) this.thrownExceptions = Binding.NO_EXCEPTIONS; > checkMissingType: { > if ((this.tagBits & TagBits.HasMissingType) != 0) > break checkMissingType; >@@ -389,67 +382,56 @@ > private ParameterizedGenericMethodBinding inferFromExpectedType(Scope scope, InferenceContext inferenceContext) { > TypeVariableBinding[] originalVariables = this.originalMethod.typeVariables; // immediate parent (could be a parameterized method) > int varLength = originalVariables.length; >- >- computeSubstitutes: { >- // infer from expected return type >- if (inferenceContext.expectedType != null) { >- this.returnType.collectSubstitutes(scope, inferenceContext.expectedType, inferenceContext, TypeConstants.CONSTRAINT_SUPER); >- if (inferenceContext.status == InferenceContext.FAILED) return null; // impossible substitution >- } >- // infer from bounds of type parameters >- for (int i = 0; i < varLength; i++) { >- TypeVariableBinding originalVariable = originalVariables[i]; >- TypeBinding argument = this.typeArguments[i]; >- boolean argAlreadyInferred = argument != originalVariable; >- if (originalVariable.firstBound == originalVariable.superclass) { >- TypeBinding substitutedBound = Scope.substitute(this, originalVariable.superclass); >- argument.collectSubstitutes(scope, substitutedBound, inferenceContext, TypeConstants.CONSTRAINT_SUPER); >+ // infer from expected return type >+ if (inferenceContext.expectedType != null) { >+ this.returnType.collectSubstitutes(scope, inferenceContext.expectedType, inferenceContext, TypeConstants.CONSTRAINT_SUPER); >+ if (inferenceContext.status == InferenceContext.FAILED) return null; // impossible substitution >+ } >+ // infer from bounds of type parameters >+ for (int i = 0; i < varLength; i++) { >+ TypeVariableBinding originalVariable = originalVariables[i]; >+ TypeBinding argument = this.typeArguments[i]; >+ boolean argAlreadyInferred = argument != originalVariable; >+ if (originalVariable.firstBound == originalVariable.superclass) { >+ TypeBinding substitutedBound = Scope.substitute(this, originalVariable.superclass); >+ argument.collectSubstitutes(scope, substitutedBound, inferenceContext, TypeConstants.CONSTRAINT_SUPER); >+ if (inferenceContext.status == InferenceContext.FAILED) return null; // impossible substitution >+ // JLS 15.12.2.8 claims reverse inference shouldn't occur, however it improves inference >+ // e.g. given: <E extends Object, S extends Collection<E>> S test1(S param) >+ // invocation: test1(new Vector<String>()) will infer: S=Vector<String> and with code below: E=String >+ if (argAlreadyInferred) { >+ substitutedBound.collectSubstitutes(scope, argument, inferenceContext, TypeConstants.CONSTRAINT_EXTENDS); > if (inferenceContext.status == InferenceContext.FAILED) return null; // impossible substitution >- // JLS 15.12.2.8 claims reverse inference shouldn't occur, however it improves inference >- // e.g. given: <E extends Object, S extends Collection<E>> S test1(S param) >- // invocation: test1(new Vector<String>()) will infer: S=Vector<String> and with code below: E=String >- if (argAlreadyInferred) { >- substitutedBound.collectSubstitutes(scope, argument, inferenceContext, TypeConstants.CONSTRAINT_EXTENDS); >- if (inferenceContext.status == InferenceContext.FAILED) return null; // impossible substitution >- } > } >- for (int j = 0, max = originalVariable.superInterfaces.length; j < max; j++) { >- TypeBinding substitutedBound = Scope.substitute(this, originalVariable.superInterfaces[j]); >- argument.collectSubstitutes(scope, substitutedBound, inferenceContext, TypeConstants.CONSTRAINT_SUPER); >+ } >+ for (int j = 0, max = originalVariable.superInterfaces.length; j < max; j++) { >+ TypeBinding substitutedBound = Scope.substitute(this, originalVariable.superInterfaces[j]); >+ argument.collectSubstitutes(scope, substitutedBound, inferenceContext, TypeConstants.CONSTRAINT_SUPER); >+ if (inferenceContext.status == InferenceContext.FAILED) return null; // impossible substitution >+ // JLS 15.12.2.8 claims reverse inference shouldn't occur, however it improves inference >+ if (argAlreadyInferred) { >+ substitutedBound.collectSubstitutes(scope, argument, inferenceContext, TypeConstants.CONSTRAINT_EXTENDS); > if (inferenceContext.status == InferenceContext.FAILED) return null; // impossible substitution >- // JLS 15.12.2.8 claims reverse inference shouldn't occur, however it improves inference >- if (argAlreadyInferred) { >- substitutedBound.collectSubstitutes(scope, argument, inferenceContext, TypeConstants.CONSTRAINT_EXTENDS); >- if (inferenceContext.status == InferenceContext.FAILED) return null; // impossible substitution >- } > } > } >- if (inferenceContext.status == InferenceContext.RAW_SUBSTITUTION) { >- // raw generic method inferred >- this.isRaw = true; >- this.isUnchecked = false; >- for (int i = 0; i < varLength; i++) { >- this.typeArguments[i] = originalVariables[i].upperBound(); >- } >- break computeSubstitutes; >- } >- if (!resolveSubstituteConstraints(scope, originalVariables, inferenceContext, true/*consider Ti<:Uk*/)) >- return null; // incompatible >- // this.typeArguments = substitutes; - no op since side effects got performed during #resolveSubstituteConstraints >- for (int i = 0; i < varLength; i++) { >- TypeBinding substitute = inferenceContext.substitutes[i]; >- if (substitute != null) { >- this.typeArguments[i] = inferenceContext.substitutes[i]; >- } else { >- // remaining unresolved variable are considered to be Object (or their bound actually) >- this.typeArguments[i] = originalVariables[i].upperBound(); >- } >- } > } >+ if (!resolveSubstituteConstraints(scope, originalVariables, inferenceContext, true/*consider Ti<:Uk*/)) >+ return null; // incompatible >+ // this.typeArguments = substitutes; - no op since side effects got performed during #resolveSubstituteConstraints >+ for (int i = 0; i < varLength; i++) { >+ TypeBinding substitute = inferenceContext.substitutes[i]; >+ if (substitute != null) { >+ this.typeArguments[i] = inferenceContext.substitutes[i]; >+ } else { >+ // remaining unresolved variable are considered to be Object (or their bound actually) >+ this.typeArguments[i] = originalVariables[i].upperBound(); >+ } >+ } > // may still need an extra substitution at the end (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=121369) > // to properly substitute a remaining unresolved variable which also appear in a formal bound >- this.typeArguments = Scope.substitute(this, this.typeArguments); >- // adjust method types to reflect latest inference >+ this.typeArguments = Scope.substitute(this, this.typeArguments); >+ >+ // adjust method types to reflect latest inference > TypeBinding oldReturnType = this.returnType; > this.returnType = Scope.substitute(this, this.returnType); > this.inferredReturnType = inferenceContext.hasExplicitExpectedType && this.returnType != oldReturnType; >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/CaptureBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CaptureBinding.java,v >retrieving revision 1.24 >diff -u -r1.24 CaptureBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/CaptureBinding.java 27 Jun 2008 16:04:02 -0000 1.24 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/CaptureBinding.java 8 Jan 2009 20:33:31 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -25,7 +25,7 @@ > public int position; > > public CaptureBinding(WildcardBinding wildcard, ReferenceBinding sourceType, int position, int captureID) { >- super(TypeConstants.WILDCARD_CAPTURE_NAME_PREFIX, null, 0); >+ super(TypeConstants.WILDCARD_CAPTURE_NAME_PREFIX, null, 0, wildcard.environment); > this.wildcard = wildcard; > this.modifiers = ClassFileConstants.AccPublic | ExtraCompilerModifiers.AccGenericSignature; // treat capture as public > this.fPackage = wildcard.fPackage; >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java,v >retrieving revision 1.114 >diff -u -r1.114 BinaryTypeBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java 27 Jun 2008 16:04:02 -0000 1.114 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java 8 Jan 2009 20:33:28 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -114,7 +114,7 @@ > break; > > case Binding.TYPE_PARAMETER : >- ((TypeVariableBinding) type).resolve(environment); >+ ((TypeVariableBinding) type).resolve(); > break; > > case Binding.GENERIC_TYPE : >@@ -606,7 +606,7 @@ > pendingVariable = false; > int colon = CharOperation.indexOf(':', typeSignature, i); > char[] variableName = CharOperation.subarray(typeSignature, i, colon); >- variables.add(new TypeVariableBinding(variableName, this, rank++)); >+ variables.add(new TypeVariableBinding(variableName, this, rank++, this.environment)); > } > } > } >@@ -807,7 +807,7 @@ > // NOTE: member types of binary types are resolved when needed > public TypeVariableBinding getTypeVariable(char[] variableName) { > TypeVariableBinding variable = super.getTypeVariable(variableName); >- variable.resolve(this.environment); >+ variable.resolve(); > return variable; > } > private void initializeTypeVariable(TypeVariableBinding variable, TypeVariableBinding[] existingVariables, SignatureWrapper wrapper, char[][][] missingTypeNames) { >@@ -934,7 +934,7 @@ > } > } > for (int i = method.typeVariables.length; --i >= 0;) { >- method.typeVariables[i].resolve(this.environment); >+ method.typeVariables[i].resolve(); > } > method.modifiers &= ~ExtraCompilerModifiers.AccUnresolved; > return method; >@@ -983,7 +983,7 @@ > return this.typeVariables; > > for (int i = this.typeVariables.length; --i >= 0;) >- this.typeVariables[i].resolve(this.environment); >+ this.typeVariables[i].resolve(); > this.tagBits &= ~TagBits.HasUnresolvedTypeVariables; > return this.typeVariables; > } >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java,v >retrieving revision 1.346 >diff -u -r1.346 Scope.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 5 Dec 2008 12:41:29 -0000 1.346 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 8 Jan 2009 20:33:58 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -45,6 +45,11 @@ > public int kind; > public Scope parent; > >+ protected Scope(int kind, Scope parent) { >+ this.kind = kind; >+ this.parent = parent; >+ } >+ > /* Answer an int describing the relationship between the given types. > * > * NOT_RELATED >@@ -59,7 +64,131 @@ > return Scope.NOT_RELATED; > } > >- public static TypeBinding getBaseType(char[] name) { >+ /** >+ * Returns a type where either all variables or specific ones got discarded. >+ * e.g. List<E> (discarding <E extends Enum<E>) will return: List<? extends Enum<?>> >+ */ >+ public static TypeBinding convertEliminatingTypeVariables(TypeBinding originalType, ReferenceBinding genericType, int rank, Set eliminatedVariables) { >+ if ((originalType.tagBits & TagBits.HasTypeVariable) != 0) { >+ switch (originalType.kind()) { >+ case Binding.ARRAY_TYPE : >+ ArrayBinding originalArrayType = (ArrayBinding) originalType; >+ TypeBinding originalLeafComponentType = originalArrayType.leafComponentType; >+ TypeBinding substitute = convertEliminatingTypeVariables(originalLeafComponentType, genericType, rank, eliminatedVariables); // substitute could itself be array type >+ if (substitute != originalLeafComponentType) { >+ return originalArrayType.environment.createArrayType(substitute.leafComponentType(), substitute.dimensions() + originalArrayType.dimensions()); >+ } >+ break; >+ case Binding.PARAMETERIZED_TYPE : >+ ParameterizedTypeBinding paramType = (ParameterizedTypeBinding) originalType; >+ ReferenceBinding originalEnclosing = paramType.enclosingType(); >+ ReferenceBinding substitutedEnclosing = originalEnclosing; >+ if (originalEnclosing != null) { >+ substitutedEnclosing = (ReferenceBinding) convertEliminatingTypeVariables(originalEnclosing, genericType, rank, eliminatedVariables); >+ } >+ TypeBinding[] originalArguments = paramType.arguments; >+ TypeBinding[] substitutedArguments = originalArguments; >+ for (int i = 0, length = originalArguments == null ? 0 : originalArguments.length; i < length; i++) { >+ TypeBinding originalArgument = originalArguments[i]; >+ TypeBinding substitutedArgument = convertEliminatingTypeVariables(originalArgument, paramType.genericType(), i, eliminatedVariables); >+ if (substitutedArgument != originalArgument) { >+ if (substitutedArguments == originalArguments) { >+ System.arraycopy(originalArguments, 0, substitutedArguments = new TypeBinding[length], 0, i); >+ } >+ substitutedArguments[i] = substitutedArgument; >+ } else if (substitutedArguments != originalArguments) { >+ substitutedArguments[i] = originalArgument; >+ } >+ } >+ if (originalEnclosing != substitutedEnclosing || originalArguments != substitutedArguments) { >+ return paramType.environment.createParameterizedType(paramType.genericType(), substitutedArguments, substitutedEnclosing); >+ } >+ break; >+ case Binding.TYPE_PARAMETER : >+ if (genericType == null) { >+ break; >+ } >+ TypeVariableBinding originalVariable = (TypeVariableBinding) originalType; >+ if (eliminatedVariables != null && eliminatedVariables.contains(originalType)) { >+ return originalVariable.environment.createWildcard(genericType, rank, null, null, Wildcard.UNBOUND); >+ } >+ TypeBinding originalUpperBound = originalVariable.upperBound(); >+ if (eliminatedVariables == null) { >+ eliminatedVariables = new HashSet(2); >+ } >+ eliminatedVariables.add(originalVariable); >+ TypeBinding substitutedUpperBound = convertEliminatingTypeVariables(originalUpperBound, genericType, rank, eliminatedVariables); >+ eliminatedVariables.remove(originalVariable); >+ return originalVariable.environment.createWildcard(genericType, rank, substitutedUpperBound, null, Wildcard.EXTENDS); >+ case Binding.RAW_TYPE : >+ break; >+ case Binding.GENERIC_TYPE : >+ ReferenceBinding currentType = (ReferenceBinding) originalType; >+ originalEnclosing = currentType.enclosingType(); >+ substitutedEnclosing = originalEnclosing; >+ if (originalEnclosing != null) { >+ substitutedEnclosing = (ReferenceBinding) convertEliminatingTypeVariables(originalEnclosing, genericType, rank, eliminatedVariables); >+ } >+ originalArguments = currentType.typeVariables(); >+ substitutedArguments = originalArguments; >+ for (int i = 0, length = originalArguments == null ? 0 : originalArguments.length; i < length; i++) { >+ TypeBinding originalArgument = originalArguments[i]; >+ TypeBinding substitutedArgument = convertEliminatingTypeVariables(originalArgument, currentType, i, eliminatedVariables); >+ if (substitutedArgument != originalArgument) { >+ if (substitutedArguments == originalArguments) { >+ System.arraycopy(originalArguments, 0, substitutedArguments = new TypeBinding[length], 0, i); >+ } >+ substitutedArguments[i] = substitutedArgument; >+ } else if (substitutedArguments != originalArguments) { >+ substitutedArguments[i] = originalArgument; >+ } >+ } >+ if (originalEnclosing != substitutedEnclosing || originalArguments != substitutedArguments) { >+ return ((TypeVariableBinding)originalArguments[0]).environment.createParameterizedType(genericType, substitutedArguments, substitutedEnclosing); >+ } >+ break; >+ case Binding.WILDCARD_TYPE : >+ WildcardBinding wildcard = (WildcardBinding) originalType; >+ TypeBinding originalBound = wildcard.bound; >+ TypeBinding substitutedBound = originalBound; >+ if (originalBound != null) { >+ substitutedBound = convertEliminatingTypeVariables(originalBound, genericType, rank, eliminatedVariables); >+ if (substitutedBound != originalBound) { >+ return wildcard.environment.createWildcard(wildcard.genericType, wildcard.rank, substitutedBound, null, wildcard.boundKind); >+ } >+ } >+ break; >+ case Binding.INTERSECTION_TYPE : >+ WildcardBinding intersection = (WildcardBinding) originalType; >+ originalBound = intersection.bound; >+ substitutedBound = originalBound; >+ if (originalBound != null) { >+ substitutedBound = convertEliminatingTypeVariables(originalBound, genericType, rank, eliminatedVariables); >+ } >+ TypeBinding[] originalOtherBounds = intersection.otherBounds; >+ TypeBinding[] substitutedOtherBounds = originalOtherBounds; >+ for (int i = 0, length = originalOtherBounds == null ? 0 : originalOtherBounds.length; i < length; i++) { >+ TypeBinding originalOtherBound = originalOtherBounds[i]; >+ TypeBinding substitutedOtherBound = convertEliminatingTypeVariables(originalOtherBound, genericType, rank, eliminatedVariables); >+ if (substitutedOtherBound != originalOtherBound) { >+ if (substitutedOtherBounds == originalOtherBounds) { >+ System.arraycopy(originalOtherBounds, 0, substitutedOtherBounds = new TypeBinding[length], 0, i); >+ } >+ substitutedOtherBounds[i] = substitutedOtherBound; >+ } else if (substitutedOtherBounds != originalOtherBounds) { >+ substitutedOtherBounds[i] = originalOtherBound; >+ } >+ } >+ if (substitutedBound != originalBound || substitutedOtherBounds != originalOtherBounds) { >+ return intersection.environment.createWildcard(intersection.genericType, intersection.rank, substitutedBound, substitutedOtherBounds, intersection.boundKind); >+ } >+ break; >+ } >+ } >+ return originalType; >+ } >+ >+ public static TypeBinding getBaseType(char[] name) { > // list should be optimized (with most often used first) > int length = name.length; > if (length > 2 && length < 8) { >@@ -121,7 +250,7 @@ > return null; > } > >- // 5.1.10 >+ // 5.1.10 > public static ReferenceBinding[] greaterLowerBound(ReferenceBinding[] types) { > if (types == null) return null; > int length = types.length; >@@ -335,11 +464,6 @@ > return substitutedTypes; > } > >- protected Scope(int kind, Scope parent) { >- this.kind = kind; >- this.parent = parent; >- } >- > /* > * Boxing primitive > */ >@@ -587,7 +711,7 @@ > int count = 0; > for (int i = 0; i < length; i++) { > TypeParameter typeParameter = typeParameters[i]; >- TypeVariableBinding parameterBinding = new TypeVariableBinding(typeParameter.name, declaringElement, i); >+ TypeVariableBinding parameterBinding = new TypeVariableBinding(typeParameter.name, declaringElement, i, environment()); > parameterBinding.fPackage = unitPackage; > typeParameter.binding = parameterBinding; > >@@ -2665,22 +2789,25 @@ > // <T extends X<Object>> void foo(T t) {} > // foo(T) will show up as foo(Y#RAW) and not foo(X#RAW) > // Y#RAW is not more specific than a rawified X<T> >- if (oneParam == one.original().parameters[i] >- && twoParam.leafComponentType().erasure() != two.original().parameters[i].leafComponentType().erasure()) { >- return false; >- } >+ TypeBinding originalOneParam = one.original().parameters[i].leafComponentType(); >+ if ((originalOneParam.isTypeVariable() ? ((TypeVariableBinding) originalOneParam).upperBound() >+ : originalOneParam).isRawType()) >+ if (twoParam.leafComponentType().erasure() != two.original().parameters[i] >+ .leafComponentType().erasure()) >+ return false; > } > } else if (oneParam.isCompatibleWith(twoParam)) { > if (oneParam.leafComponentType().isRawType()) { >- // A#RAW is not more specific than a rawified A<T> >- if (oneParam.needsUncheckedConversion(two.declaringClass.isRawType() ? twoParam : two.original().parameters[i])) >- return false; >+ if (oneParam.needsUncheckedConversion(twoParam)) >+ if (oneParam.leafComponentType().erasure() != twoParam.leafComponentType().erasure()) >+ return false; > } > } else { > if (i == oneParamsLength - 1 && one.isVarargs() && two.isVarargs()) { > TypeBinding eType = ((ArrayBinding) twoParam).elementsType(); > if (oneParam == eType || oneParam.isCompatibleWith(eType)) >- return true; // special case to choose between 2 varargs methods when the last arg is Object[] >+ return true; // special case to choose between 2 varargs methods when the last arg is >+ // Object[] > } > return false; > } >@@ -2690,7 +2817,8 @@ > > if (one.isVarargs() && two.isVarargs()) { > if (oneParamsLength > twoParamsLength) { >- // special case when autoboxing makes (int, int...) better than (Object...) but not (int...) or (Integer, int...) >+ // special case when autoboxing makes (int, int...) better than (Object...) but not (int...) or >+ // (Integer, int...) > if (((ArrayBinding) twoParams[twoParamsLength - 1]).elementsType().id != TypeIds.T_JavaLangObject) > return false; > } >@@ -2699,12 +2827,12 @@ > if (oneParams[i] != twoParams[i] && !oneParams[i].isCompatibleWith(twoParams[i])) > return false; > if (parameterCompatibilityLevel(one, twoParams) == NOT_COMPATIBLE >- && parameterCompatibilityLevel(two, oneParams) == VARARGS_COMPATIBLE) >- return true; >+ && parameterCompatibilityLevel(two, oneParams) == VARARGS_COMPATIBLE) >+ return true; > } > return false; > } >- >+ > public boolean isBoxingCompatibleWith(TypeBinding expressionType, TypeBinding targetType) { > LookupEnvironment environment = environment(); > if (environment.globalOptions.sourceLevel < ClassFileConstants.JDK1_5 || expressionType.isBaseType() == targetType.isBaseType()) >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java,v >retrieving revision 1.69 >diff -u -r1.69 TypeVariableBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java 26 Sep 2008 16:32:56 -0000 1.69 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java 8 Jan 2009 20:34:04 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2007 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -32,22 +32,24 @@ > public ReferenceBinding superclass; > public ReferenceBinding[] superInterfaces; > public char[] genericTypeSignature; >- >- public TypeVariableBinding(char[] sourceName, Binding declaringElement, int rank) { >+ LookupEnvironment environment; >+ >+ public TypeVariableBinding(char[] sourceName, Binding declaringElement, int rank, LookupEnvironment environment) { > this.sourceName = sourceName; > this.declaringElement = declaringElement; > this.rank = rank; > this.modifiers = ClassFileConstants.AccPublic | ExtraCompilerModifiers.AccGenericSignature; // treat type var as public > this.tagBits |= TagBits.HasTypeVariable; >+ this.environment = environment; > } > > /** > * Returns true if the argument type satisfies all bounds of the type parameter > */ > public int boundCheck(Substitution substitution, TypeBinding argumentType) { >- >- if (argumentType == TypeBinding.NULL || argumentType == this) >+ if (argumentType == TypeBinding.NULL || argumentType == this) { > return TypeConstants.OK; >+ } > boolean hasSubstitution = substitution != null; > if (!(argumentType instanceof ReferenceBinding || argumentType.isArrayType())) > return TypeConstants.MISMATCH; >@@ -63,27 +65,27 @@ > TypeBinding wildcardBound = wildcard.bound; > if (wildcardBound == this) > return TypeConstants.OK; >- ReferenceBinding superclassBound = hasSubstitution ? (ReferenceBinding)Scope.substitute(substitution, this.superclass) : this.superclass; > boolean isArrayBound = wildcardBound.isArrayType(); > if (!wildcardBound.isInterface()) { >- if (superclassBound.id != TypeIds.T_JavaLangObject) { >+ TypeBinding substitutedSuperType = hasSubstitution ? Scope.substitute(substitution, this.superclass) : this.superclass; >+ if (substitutedSuperType.id != TypeIds.T_JavaLangObject) { > if (isArrayBound) { >- if (!wildcardBound.isCompatibleWith(superclassBound)) >+ if (!wildcardBound.isCompatibleWith(substitutedSuperType)) > return TypeConstants.MISMATCH; > } else { >- TypeBinding match = wildcardBound.findSuperTypeOriginatingFrom(superclassBound); >+ TypeBinding match = wildcardBound.findSuperTypeOriginatingFrom(substitutedSuperType); > if (match != null) { >- if (superclassBound.isProvablyDistinct(match)) { >+ if (substitutedSuperType.isProvablyDistinct(match)) { > return TypeConstants.MISMATCH; > } > } else { >- match = superclassBound.findSuperTypeOriginatingFrom(wildcardBound); >+ match = substitutedSuperType.findSuperTypeOriginatingFrom(wildcardBound); > if (match != null) { > if (match.isProvablyDistinct(wildcardBound)) { > return TypeConstants.MISMATCH; > } > } else { >- if (!wildcardBound.isTypeVariable() && !superclassBound.isTypeVariable()) { >+ if (!wildcardBound.isTypeVariable() && !substitutedSuperType.isTypeVariable()) { > return TypeConstants.MISMATCH; > } > } >@@ -91,18 +93,16 @@ > } > } > } >- ReferenceBinding[] superInterfaceBounds = hasSubstitution ? Scope.substitute(substitution, this.superInterfaces) : this.superInterfaces; >- int length = superInterfaceBounds.length; > boolean mustImplement = isArrayBound || ((ReferenceBinding)wildcardBound).isFinal(); >- for (int i = 0; i < length; i++) { >- TypeBinding superInterfaceBound = superInterfaceBounds[i]; >+ for (int i = 0, length = this.superInterfaces.length; i < length; i++) { >+ TypeBinding substitutedSuperType = hasSubstitution ? Scope.substitute(substitution, this.superInterfaces[i]) : this.superInterfaces[i]; > if (isArrayBound) { >- if (!wildcardBound.isCompatibleWith(superInterfaceBound)) >+ if (!wildcardBound.isCompatibleWith(substitutedSuperType)) > return TypeConstants.MISMATCH; > } else { >- TypeBinding match = wildcardBound.findSuperTypeOriginatingFrom(superInterfaceBound); >+ TypeBinding match = wildcardBound.findSuperTypeOriginatingFrom(substitutedSuperType); > if (match != null) { >- if (superInterfaceBound.isProvablyDistinct(match)) { >+ if (substitutedSuperType.isProvablyDistinct(match)) { > return TypeConstants.MISMATCH; > } > } else if (mustImplement) { >@@ -380,19 +380,19 @@ > public char[] readableName() { > return this.sourceName; > } >- ReferenceBinding resolve(LookupEnvironment environment) { >+ ReferenceBinding resolve() { > if ((this.modifiers & ExtraCompilerModifiers.AccUnresolved) == 0) > return this; > > TypeBinding oldSuperclass = this.superclass, oldFirstInterface = null; > if (this.superclass != null) >- this.superclass = (ReferenceBinding) BinaryTypeBinding.resolveType(this.superclass, environment, true /* raw conversion */); >+ this.superclass = (ReferenceBinding) BinaryTypeBinding.resolveType(this.superclass, this.environment, true /* raw conversion */); > ReferenceBinding[] interfaces = this.superInterfaces; > int length; > if ((length = interfaces.length) != 0) { > oldFirstInterface = interfaces[0]; > for (int i = length; --i >= 0;) { >- interfaces[i] = (ReferenceBinding) BinaryTypeBinding.resolveType(interfaces[i], environment, true /* raw conversion */); >+ interfaces[i] = (ReferenceBinding) BinaryTypeBinding.resolveType(interfaces[i], this.environment, true /* raw conversion */); > } > } > // refresh the firstBound in case it changed >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java,v >retrieving revision 1.100 >diff -u -r1.100 LookupEnvironment.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java 3 Oct 2008 18:10:36 -0000 1.100 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java 8 Jan 2009 20:33:37 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -11,9 +11,7 @@ > package org.eclipse.jdt.internal.compiler.lookup; > > import java.util.HashMap; >-import java.util.HashSet; > import java.util.Map; >-import java.util.Set; > > import org.eclipse.jdt.core.compiler.CharOperation; > import org.eclipse.jdt.internal.compiler.ClassFilePool; >@@ -386,123 +384,6 @@ > return packageBinding; > } > >-public TypeBinding convertEliminatingTypeVariables(TypeBinding originalType, ReferenceBinding genericType, int rank, Set eliminatedVariables) { >- if ((originalType.tagBits & TagBits.HasTypeVariable) != 0) { >- switch (originalType.kind()) { >- case Binding.ARRAY_TYPE : >- ArrayBinding originalArrayType = (ArrayBinding) originalType; >- TypeBinding originalLeafComponentType = originalArrayType.leafComponentType; >- TypeBinding substitute = convertEliminatingTypeVariables(originalLeafComponentType, genericType, rank, eliminatedVariables); // substitute could itself be array type >- if (substitute != originalLeafComponentType) { >- return createArrayType(substitute.leafComponentType(), substitute.dimensions() + originalArrayType.dimensions()); >- } >- break; >- case Binding.PARAMETERIZED_TYPE : >- ParameterizedTypeBinding paramType = (ParameterizedTypeBinding) originalType; >- ReferenceBinding originalEnclosing = paramType.enclosingType(); >- ReferenceBinding substitutedEnclosing = originalEnclosing; >- if (originalEnclosing != null) { >- substitutedEnclosing = (ReferenceBinding) convertEliminatingTypeVariables(originalEnclosing, genericType, rank, eliminatedVariables); >- } >- TypeBinding[] originalArguments = paramType.arguments; >- TypeBinding[] substitutedArguments = originalArguments; >- for (int i = 0, length = originalArguments == null ? 0 : originalArguments.length; i < length; i++) { >- TypeBinding originalArgument = originalArguments[i]; >- TypeBinding substitutedArgument = convertEliminatingTypeVariables(originalArgument, paramType.genericType(), i, eliminatedVariables); >- if (substitutedArgument != originalArgument) { >- if (substitutedArguments == originalArguments) { >- System.arraycopy(originalArguments, 0, substitutedArguments = new TypeBinding[length], 0, i); >- } >- substitutedArguments[i] = substitutedArgument; >- } else if (substitutedArguments != originalArguments) { >- substitutedArguments[i] = originalArgument; >- } >- } >- if (originalEnclosing != substitutedEnclosing || originalArguments != substitutedArguments) { >- return createParameterizedType(paramType.genericType(), substitutedArguments, substitutedEnclosing); >- } >- break; >- case Binding.TYPE_PARAMETER : >- if (eliminatedVariables != null && eliminatedVariables.contains(originalType)) { >- return createWildcard(genericType, rank, null, null, Wildcard.UNBOUND); >- } >- TypeVariableBinding variable = (TypeVariableBinding) originalType; >- TypeBinding originalUpperBound = variable.upperBound(); >- if (eliminatedVariables == null) { >- eliminatedVariables = new HashSet(2); >- } >- eliminatedVariables.add(variable); >- TypeBinding substitutedUpperBound = convertEliminatingTypeVariables(originalUpperBound, genericType, rank, eliminatedVariables); >- eliminatedVariables.remove(variable); >- return createWildcard(genericType, rank, substitutedUpperBound, null, Wildcard.EXTENDS); >- case Binding.RAW_TYPE : >- break; >- case Binding.GENERIC_TYPE : >- ReferenceBinding currentType = (ReferenceBinding) originalType; >- originalEnclosing = currentType.enclosingType(); >- substitutedEnclosing = originalEnclosing; >- if (originalEnclosing != null) { >- substitutedEnclosing = (ReferenceBinding) convertEliminatingTypeVariables(originalEnclosing, genericType, rank, eliminatedVariables); >- } >- originalArguments = currentType.typeVariables(); >- substitutedArguments = originalArguments; >- for (int i = 0, length = originalArguments == null ? 0 : originalArguments.length; i < length; i++) { >- TypeBinding originalArgument = originalArguments[i]; >- TypeBinding substitutedArgument = convertEliminatingTypeVariables(originalArgument, currentType, i, eliminatedVariables); >- if (substitutedArgument != originalArgument) { >- if (substitutedArguments == originalArguments) { >- System.arraycopy(originalArguments, 0, substitutedArguments = new TypeBinding[length], 0, i); >- } >- substitutedArguments[i] = substitutedArgument; >- } else if (substitutedArguments != originalArguments) { >- substitutedArguments[i] = originalArgument; >- } >- } >- if (originalEnclosing != substitutedEnclosing || originalArguments != substitutedArguments) { >- return createParameterizedType(genericType, substitutedArguments, substitutedEnclosing); >- } >- break; >- case Binding.WILDCARD_TYPE : >- WildcardBinding wildcard = (WildcardBinding) originalType; >- TypeBinding originalBound = wildcard.bound; >- TypeBinding substitutedBound = originalBound; >- if (originalBound != null) { >- substitutedBound = convertEliminatingTypeVariables(originalBound, genericType, rank, eliminatedVariables); >- if (substitutedBound != originalBound) { >- return createWildcard(wildcard.genericType, wildcard.rank, substitutedBound, null, wildcard.boundKind); >- } >- } >- break; >- case Binding.INTERSECTION_TYPE : >- WildcardBinding intersection = (WildcardBinding) originalType; >- originalBound = intersection.bound; >- substitutedBound = originalBound; >- if (originalBound != null) { >- substitutedBound = convertEliminatingTypeVariables(originalBound, genericType, rank, eliminatedVariables); >- } >- TypeBinding[] originalOtherBounds = intersection.otherBounds; >- TypeBinding[] substitutedOtherBounds = originalOtherBounds; >- for (int i = 0, length = originalOtherBounds == null ? 0 : originalOtherBounds.length; i < length; i++) { >- TypeBinding originalOtherBound = originalOtherBounds[i]; >- TypeBinding substitutedOtherBound = convertEliminatingTypeVariables(originalOtherBound, genericType, rank, eliminatedVariables); >- if (substitutedOtherBound != originalOtherBound) { >- if (substitutedOtherBounds == originalOtherBounds) { >- System.arraycopy(originalOtherBounds, 0, substitutedOtherBounds = new TypeBinding[length], 0, i); >- } >- substitutedOtherBounds[i] = substitutedOtherBound; >- } else if (substitutedOtherBounds != originalOtherBounds) { >- substitutedOtherBounds[i] = originalOtherBound; >- } >- } >- if (substitutedBound != originalBound || substitutedOtherBounds != originalOtherBounds) { >- return createWildcard(intersection.genericType, intersection.rank, substitutedBound, substitutedOtherBounds, intersection.boundKind); >- } >- break; >- } >- } >- return originalType; >-} >- > /** > * Convert a given source type into a parameterized form if generic. > * generic X<E> --> param X<E> >@@ -598,6 +479,27 @@ > return type; > } > >+/** >+ * Convert an array of types in raw forms. >+ * Only allocate an array if anything is different. >+ */ >+public ReferenceBinding[] convertToRawTypes(ReferenceBinding[] originalTypes, boolean forceErasure, boolean forceRawEnclosingType) { >+ if (originalTypes == null) return null; >+ ReferenceBinding[] convertedTypes = originalTypes; >+ for (int i = 0, length = originalTypes.length; i < length; i++) { >+ ReferenceBinding originalType = originalTypes[i]; >+ ReferenceBinding convertedType = (ReferenceBinding) convertToRawType(forceErasure ? originalType.erasure() : originalType, forceRawEnclosingType); >+ if (convertedType != originalType) { >+ if (convertedTypes == originalTypes) { >+ System.arraycopy(originalTypes, 0, convertedTypes = new ReferenceBinding[length], 0, i); >+ } >+ convertedTypes[i] = convertedType; >+ } else if (convertedTypes != originalTypes) { >+ convertedTypes[i] = originalType; >+ } >+ } >+ return convertedTypes; >+} > > // variation for unresolved types in binaries (consider generic type as raw) > public TypeBinding convertUnresolvedBinaryToRawType(TypeBinding type) { >@@ -657,7 +559,6 @@ > } > return type; > } >- > /* > * Used to guarantee annotation identity. > */ >@@ -667,6 +568,7 @@ > } > return new AnnotationBinding(annotationType, pairs); > } >+ > /* > * Used to guarantee array type identity. > */ >@@ -708,10 +610,10 @@ > this.uniqueArrayBindings[dimIndex] = arrayBindings; > return arrayBindings[length] = new ArrayBinding(leafComponentType, dimensionCount, this); > } >- > public BinaryTypeBinding createBinaryTypeFrom(IBinaryType binaryType, PackageBinding packageBinding, AccessRestriction accessRestriction) { > return createBinaryTypeFrom(binaryType, packageBinding, true, accessRestriction); > } >+ > public BinaryTypeBinding createBinaryTypeFrom(IBinaryType binaryType, PackageBinding packageBinding, boolean needFieldsAndMethods, AccessRestriction accessRestriction) { > BinaryTypeBinding binaryBinding = new BinaryTypeBinding(packageBinding, binaryType, this); > >@@ -1342,7 +1244,6 @@ > return this.nameEnvironment.isPackage(null, name); > return this.nameEnvironment.isPackage(compoundName, name); > } >- > // The method verifier is lazily initialized to guarantee the receiver, the compiler & the oracle are ready. > public MethodVerifier methodVerifier() { > if (this.verifier == null) >@@ -1351,6 +1252,7 @@ > : new MethodVerifier15(this); // covariance only if sourceLevel is >= 1.5 > return this.verifier; > } >+ > public void releaseClassFiles(org.eclipse.jdt.internal.compiler.ClassFile[] classFiles) { > for (int i = 0, fileCount = classFiles.length; i < fileCount; i++) > this.classFilePool.release(classFiles[i]); >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/InferenceContext.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/InferenceContext.java,v >retrieving revision 1.5 >diff -u -r1.5 InferenceContext.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/InferenceContext.java 27 Jun 2008 16:04:02 -0000 1.5 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/InferenceContext.java 8 Jan 2009 20:33:31 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2007 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -21,9 +21,9 @@ > int status; > TypeBinding expectedType; > boolean hasExplicitExpectedType; // indicates whether the expectedType (if set) was explicit in code, or set by default >+ public boolean isUnchecked; > TypeBinding[] substitutes; > final static int FAILED = 1; >- final static int RAW_SUBSTITUTION = 2; > > public InferenceContext(MethodBinding genericMethod) { > this.genericMethod = genericMethod; >@@ -33,16 +33,6 @@ > this.substitutes = new TypeBinding[varLength]; > } > >-public boolean checkRawSubstitution() { >- // only at first level, during inference from arguments >- if (this.depth > 0) return false; >-// if (this.argumentIndex < 0 || this.depth != 0) { >-// return false; >-// } >- this.status = RAW_SUBSTITUTION; >- return true; >-} >- > public TypeBinding[] getSubstitutes(TypeVariableBinding typeVariable, int constraint) { > return this.collectedSubstitutes[typeVariable.rank][constraint]; > } >@@ -99,9 +89,6 @@ > case FAILED : > buffer.append("failed]");//$NON-NLS-1$ > break; >- case RAW_SUBSTITUTION : >- buffer.append("raw-subst]");//$NON-NLS-1$ >- break; > } > if (this.expectedType == null) { > buffer.append(" [expectedType=null]"); //$NON-NLS-1$ >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/LocalVariableBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LocalVariableBinding.java,v >retrieving revision 1.45 >diff -u -r1.45 LocalVariableBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/LocalVariableBinding.java 7 Jul 2008 17:08:07 -0000 1.45 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/LocalVariableBinding.java 8 Jan 2009 20:33:31 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2007 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -53,7 +53,6 @@ > * Answer the receiver's binding type from Binding.BindingID. > */ > public final int kind() { >- > return LOCAL; > } > >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java,v >retrieving revision 1.103 >diff -u -r1.103 TypeBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java 6 Oct 2008 13:23:51 -0000 1.103 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java 8 Jan 2009 20:34:04 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -724,7 +724,7 @@ > } > if (variable.firstBound == null) // unbound variable > return false; >- TypeBinding eliminatedType = (paramType.environment.convertEliminatingTypeVariables(variable, paramType.genericType(), rank, null)); >+ TypeBinding eliminatedType = Scope.convertEliminatingTypeVariables(variable, paramType.genericType(), rank, null); > switch (eliminatedType.kind()) { > case Binding.WILDCARD_TYPE : > case Binding.INTERSECTION_TYPE : >@@ -779,7 +779,7 @@ > } > if (otherVariable.firstBound == null) // unbound variable > return false; >- TypeBinding otherEliminatedType = (paramType.environment.convertEliminatingTypeVariables(otherVariable, paramType.genericType(), rank, null)); >+ TypeBinding otherEliminatedType = Scope.convertEliminatingTypeVariables(otherVariable, paramType.genericType(), rank, null); > switch (otherEliminatedType.kind()) { > case Binding.WILDCARD_TYPE : > case Binding.INTERSECTION_TYPE : >Index: eval/org/eclipse/jdt/internal/eval/CodeSnippetReturnStatement.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetReturnStatement.java,v >retrieving revision 1.34 >diff -u -r1.34 CodeSnippetReturnStatement.java >--- eval/org/eclipse/jdt/internal/eval/CodeSnippetReturnStatement.java 17 Sep 2008 09:08:40 -0000 1.34 >+++ eval/org/eclipse/jdt/internal/eval/CodeSnippetReturnStatement.java 8 Jan 2009 20:34:35 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2006 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -142,4 +142,7 @@ > // ignored > } > >+public void setUnchecked(boolean isUnchecked) { >+ // ignored >+} > } >Index: eval/org/eclipse/jdt/internal/eval/CodeSnippetSuperReference.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetSuperReference.java,v >retrieving revision 1.20 >diff -u -r1.20 CodeSnippetSuperReference.java >--- eval/org/eclipse/jdt/internal/eval/CodeSnippetSuperReference.java 27 Jun 2008 16:04:06 -0000 1.20 >+++ eval/org/eclipse/jdt/internal/eval/CodeSnippetSuperReference.java 8 Jan 2009 20:34:35 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2007 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -55,5 +55,9 @@ > // ignored > } > >+public void setUnchecked(boolean isUnchecked) { >+ // ignored >+} >+ > } > >Index: eval/org/eclipse/jdt/internal/eval/CodeSnippetMessageSend.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetMessageSend.java,v >retrieving revision 1.60 >diff -u -r1.60 CodeSnippetMessageSend.java >--- eval/org/eclipse/jdt/internal/eval/CodeSnippetMessageSend.java 30 Sep 2008 15:31:26 -0000 1.60 >+++ eval/org/eclipse/jdt/internal/eval/CodeSnippetMessageSend.java 8 Jan 2009 20:34:34 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2007 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -11,6 +11,7 @@ > package org.eclipse.jdt.internal.eval; > > import org.eclipse.jdt.core.compiler.CharOperation; >+import org.eclipse.jdt.internal.compiler.ast.ASTNode; > import org.eclipse.jdt.internal.compiler.ast.CastExpression; > import org.eclipse.jdt.internal.compiler.ast.Expression; > import org.eclipse.jdt.internal.compiler.ast.MessageSend; >@@ -311,7 +312,7 @@ > } > } > } >- checkInvocationArguments(scope, this.receiver, this.actualReceiverType, this.binding, this.arguments, argumentTypes, argsContainCast, this); >+ checkInvocationArguments(scope, this.receiver, this.actualReceiverType, this.binding, this.arguments, argumentTypes, argsContainCast, this, (this.bits & ASTNode.Unchecked) != 0); > > //-------message send that are known to fail at compile time----------- > if (this.binding.isAbstract()) { >@@ -331,7 +332,13 @@ > this.resolvedType = this.actualReceiverType; > } else { > TypeBinding returnType = this.binding.returnType; >- if (returnType != null) returnType = returnType.capture(scope, this.sourceEnd); >+ >+ if (returnType != null) { >+ if ((this.bits & ASTNode.Unchecked) != 0) { >+ returnType = scope.environment().convertToRawType(returnType.erasure(), true); >+ } >+ returnType = returnType.capture(scope, this.sourceEnd); >+ } > this.resolvedType = returnType; > } > return this.resolvedType; >Index: eval/org/eclipse/jdt/internal/eval/CodeSnippetThisReference.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetThisReference.java,v >retrieving revision 1.35 >diff -u -r1.35 CodeSnippetThisReference.java >--- eval/org/eclipse/jdt/internal/eval/CodeSnippetThisReference.java 25 Sep 2008 23:10:29 -0000 1.35 >+++ eval/org/eclipse/jdt/internal/eval/CodeSnippetThisReference.java 8 Jan 2009 20:34:35 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2007 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -41,6 +41,7 @@ > this.evaluationContext = evaluationContext; > this.isImplicit = isImplicit; > } >+ > public boolean checkAccess(MethodScope methodScope) { > // this/super cannot be used in constructor call > if (this.evaluationContext.isConstructorCall) { >@@ -55,6 +56,7 @@ > } > return true; > } >+ > public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) { > int pc = codeStream.position; > if (valueRequired) { >@@ -63,18 +65,22 @@ > } > codeStream.recordPositionsFrom(pc, this.sourceStart); > } >+ > /** > * @see org.eclipse.jdt.internal.compiler.lookup.InvocationSite#genericTypeArguments() > */ > public TypeBinding[] genericTypeArguments() { > return null; > } >+ > public boolean isSuperAccess(){ > return false; > } >+ > public boolean isTypeAccess(){ > return false; > } >+ > public StringBuffer printExpression(int indent, StringBuffer output){ > > char[] declaringType = this.evaluationContext.declaringTypeName; >@@ -85,8 +91,8 @@ > output.append(declaringType); > return output.append(")this"); //$NON-NLS-1$ > } >+ > public TypeBinding resolveType(BlockScope scope) { >- > // implicit this > this.constant = Constant.NotAConstant; > TypeBinding snippetType = null; >@@ -105,13 +111,20 @@ > } > return this.resolvedType = this.delegateThis.type; > } >+ > public void setActualReceiverType(ReferenceBinding receiverType) { > // ignored > } >+ > public void setDepth(int depth){ > // ignored > } >+ > public void setFieldIndex(int index){ > // ignored > } >+ >+ public void setUnchecked(boolean isUnchecked) { >+ // ignored >+ } > } >Index: compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java,v >retrieving revision 1.386 >diff -u -r1.386 ProblemReporter.java >--- compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java 10 Dec 2008 19:39:17 -0000 1.386 >+++ compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java 8 Jan 2009 20:34:34 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -21,15 +21,97 @@ > import org.eclipse.jdt.core.compiler.CharOperation; > import org.eclipse.jdt.core.compiler.IProblem; > import org.eclipse.jdt.core.compiler.InvalidInputException; >-import org.eclipse.jdt.internal.compiler.*; >-import org.eclipse.jdt.internal.compiler.ast.*; >+import org.eclipse.jdt.internal.compiler.CompilationResult; >+import org.eclipse.jdt.internal.compiler.IErrorHandlingPolicy; >+import org.eclipse.jdt.internal.compiler.IProblemFactory; >+import org.eclipse.jdt.internal.compiler.ast.ASTNode; >+import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; >+import org.eclipse.jdt.internal.compiler.ast.AbstractVariableDeclaration; >+import org.eclipse.jdt.internal.compiler.ast.AllocationExpression; >+import org.eclipse.jdt.internal.compiler.ast.Annotation; >+import org.eclipse.jdt.internal.compiler.ast.AnnotationMethodDeclaration; >+import org.eclipse.jdt.internal.compiler.ast.Argument; >+import org.eclipse.jdt.internal.compiler.ast.ArrayAllocationExpression; >+import org.eclipse.jdt.internal.compiler.ast.ArrayQualifiedTypeReference; >+import org.eclipse.jdt.internal.compiler.ast.ArrayReference; >+import org.eclipse.jdt.internal.compiler.ast.ArrayTypeReference; >+import org.eclipse.jdt.internal.compiler.ast.Assignment; >+import org.eclipse.jdt.internal.compiler.ast.BinaryExpression; >+import org.eclipse.jdt.internal.compiler.ast.Block; >+import org.eclipse.jdt.internal.compiler.ast.BranchStatement; >+import org.eclipse.jdt.internal.compiler.ast.CaseStatement; >+import org.eclipse.jdt.internal.compiler.ast.CastExpression; >+import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration; >+import org.eclipse.jdt.internal.compiler.ast.CompoundAssignment; >+import org.eclipse.jdt.internal.compiler.ast.ConditionalExpression; >+import org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration; >+import org.eclipse.jdt.internal.compiler.ast.EqualExpression; >+import org.eclipse.jdt.internal.compiler.ast.ExplicitConstructorCall; >+import org.eclipse.jdt.internal.compiler.ast.Expression; >+import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration; >+import org.eclipse.jdt.internal.compiler.ast.FieldReference; >+import org.eclipse.jdt.internal.compiler.ast.ImportReference; >+import org.eclipse.jdt.internal.compiler.ast.Initializer; >+import org.eclipse.jdt.internal.compiler.ast.InstanceOfExpression; >+import org.eclipse.jdt.internal.compiler.ast.IntLiteral; >+import org.eclipse.jdt.internal.compiler.ast.LabeledStatement; >+import org.eclipse.jdt.internal.compiler.ast.Literal; >+import org.eclipse.jdt.internal.compiler.ast.LocalDeclaration; >+import org.eclipse.jdt.internal.compiler.ast.LongLiteral; >+import org.eclipse.jdt.internal.compiler.ast.MemberValuePair; >+import org.eclipse.jdt.internal.compiler.ast.MessageSend; >+import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration; >+import org.eclipse.jdt.internal.compiler.ast.NameReference; >+import org.eclipse.jdt.internal.compiler.ast.NumberLiteral; >+import org.eclipse.jdt.internal.compiler.ast.ParameterizedQualifiedTypeReference; >+import org.eclipse.jdt.internal.compiler.ast.ParameterizedSingleTypeReference; >+import org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression; >+import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference; >+import org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference; >+import org.eclipse.jdt.internal.compiler.ast.Reference; >+import org.eclipse.jdt.internal.compiler.ast.ReturnStatement; >+import org.eclipse.jdt.internal.compiler.ast.SingleNameReference; >+import org.eclipse.jdt.internal.compiler.ast.Statement; >+import org.eclipse.jdt.internal.compiler.ast.SwitchStatement; >+import org.eclipse.jdt.internal.compiler.ast.ThisReference; >+import org.eclipse.jdt.internal.compiler.ast.TryStatement; >+import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; >+import org.eclipse.jdt.internal.compiler.ast.TypeParameter; >+import org.eclipse.jdt.internal.compiler.ast.TypeReference; >+import org.eclipse.jdt.internal.compiler.ast.UnaryExpression; >+import org.eclipse.jdt.internal.compiler.ast.Wildcard; > import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; > import org.eclipse.jdt.internal.compiler.env.AccessRestriction; > import org.eclipse.jdt.internal.compiler.env.ICompilationUnit; > import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; > import org.eclipse.jdt.internal.compiler.impl.ReferenceContext; >-import org.eclipse.jdt.internal.compiler.lookup.*; >-import org.eclipse.jdt.internal.compiler.parser.*; >+import org.eclipse.jdt.internal.compiler.lookup.ArrayBinding; >+import org.eclipse.jdt.internal.compiler.lookup.Binding; >+import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers; >+import org.eclipse.jdt.internal.compiler.lookup.FieldBinding; >+import org.eclipse.jdt.internal.compiler.lookup.InvocationSite; >+import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding; >+import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; >+import org.eclipse.jdt.internal.compiler.lookup.ParameterizedGenericMethodBinding; >+import org.eclipse.jdt.internal.compiler.lookup.ProblemMethodBinding; >+import org.eclipse.jdt.internal.compiler.lookup.ProblemReasons; >+import org.eclipse.jdt.internal.compiler.lookup.ProblemReferenceBinding; >+import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; >+import org.eclipse.jdt.internal.compiler.lookup.Scope; >+import org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding; >+import org.eclipse.jdt.internal.compiler.lookup.SyntheticArgumentBinding; >+import org.eclipse.jdt.internal.compiler.lookup.TagBits; >+import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; >+import org.eclipse.jdt.internal.compiler.lookup.TypeConstants; >+import org.eclipse.jdt.internal.compiler.lookup.TypeIds; >+import org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding; >+import org.eclipse.jdt.internal.compiler.lookup.WildcardBinding; >+import org.eclipse.jdt.internal.compiler.parser.JavadocTagConstants; >+import org.eclipse.jdt.internal.compiler.parser.Parser; >+import org.eclipse.jdt.internal.compiler.parser.RecoveryScanner; >+import org.eclipse.jdt.internal.compiler.parser.Scanner; >+import org.eclipse.jdt.internal.compiler.parser.ScannerHelper; >+import org.eclipse.jdt.internal.compiler.parser.TerminalTokens; > import org.eclipse.jdt.internal.compiler.util.Messages; > > public class ProblemReporter extends ProblemHandler { >@@ -6828,7 +6910,7 @@ > nodeSourceStart(field,location), > nodeSourceEnd(field, location)); > } >-public void unsafeRawGenericMethodInvocation(ASTNode location, MethodBinding rawMethod) { >+public void unsafeRawGenericMethodInvocation(ASTNode location, MethodBinding rawMethod, TypeBinding[] argumentTypes) { > boolean isConstructor = rawMethod.isConstructor(); > int severity = computeSeverity(isConstructor ? IProblem.UnsafeRawGenericConstructorInvocation : IProblem.UnsafeRawGenericMethodInvocation); > if (severity == ProblemSeverities.Ignore) return; >@@ -6839,13 +6921,13 @@ > new String(rawMethod.declaringClass.sourceName()), > typesAsString(rawMethod.original().isVarargs(), rawMethod.original().parameters, false), > new String(rawMethod.declaringClass.readableName()), >- typesAsString(rawMethod.original().isVarargs(), rawMethod.parameters, false), >+ typesAsString(rawMethod.original().isVarargs(), argumentTypes, false), > }, > new String[] { > new String(rawMethod.declaringClass.sourceName()), > typesAsString(rawMethod.original().isVarargs(), rawMethod.original().parameters, true), > new String(rawMethod.declaringClass.shortReadableName()), >- typesAsString(rawMethod.original().isVarargs(), rawMethod.parameters, true), >+ typesAsString(false, argumentTypes, true), > }, > severity, > location.sourceStart, >@@ -6857,13 +6939,13 @@ > new String(rawMethod.selector), > typesAsString(rawMethod.original().isVarargs(), rawMethod.original().parameters, false), > new String(rawMethod.declaringClass.readableName()), >- typesAsString(rawMethod.original().isVarargs(), rawMethod.parameters, false), >+ typesAsString(false, argumentTypes, false), > }, > new String[] { > new String(rawMethod.selector), > typesAsString(rawMethod.original().isVarargs(), rawMethod.original().parameters, true), > new String(rawMethod.declaringClass.shortReadableName()), >- typesAsString(rawMethod.original().isVarargs(), rawMethod.parameters, true), >+ typesAsString(false, argumentTypes, true), > }, > severity, > location.sourceStart, >Index: codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java,v >retrieving revision 1.382 >diff -u -r1.382 CompletionEngine.java >--- codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 5 Dec 2008 15:55:50 -0000 1.382 >+++ codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 8 Jan 2009 20:32:58 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -452,6 +452,7 @@ > public void setActualReceiverType(ReferenceBinding receiverType) {/* empty */} > public void setDepth(int depth){/* empty */} > public void setFieldIndex(int depth){/* empty */} >+ public void setUnchecked(boolean isUnchecked) {/* empty */} > public int sourceEnd() { return 0; } > public int sourceStart() { return 0; } > }; >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java,v >retrieving revision 1.781 >diff -u -r1.781 GenericTypeTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 7 Jan 2009 17:31:54 -0000 1.781 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 8 Jan 2009 20:37:24 -0000 >@@ -13989,21 +13989,21 @@ > " }\n" + > "}\n" > }, >- "----------\n" + >- "1. ERROR in X.java (at line 3)\n" + >- " Zork z;\n" + >- " ^^^^\n" + >- "Zork cannot be resolved to a type\n" + >- "----------\n" + >- "2. WARNING in X.java (at line 16)\n" + >- " return m_manager.getById(getClass(), new Integer(1));\n" + >- " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >- "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" + >- "----------\n" + >- "3. WARNING in X.java (at line 16)\n" + >- " return m_manager.getById(getClass(), new Integer(1));\n" + >- " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >- "Type safety: The expression of type capture#1-of ? extends Test needs unchecked conversion to conform to ITest<C>\n" + >+ "----------\n" + >+ "1. ERROR in X.java (at line 3)\n" + >+ " Zork z;\n" + >+ " ^^^^\n" + >+ "Zork cannot be resolved to a type\n" + >+ "----------\n" + >+ "2. WARNING in X.java (at line 16)\n" + >+ " return m_manager.getById(getClass(), new Integer(1));\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "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" + >+ "----------\n" + >+ "3. WARNING in X.java (at line 16)\n" + >+ " return m_manager.getById(getClass(), new Integer(1));\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type safety: The expression of type ITest needs unchecked conversion to conform to ITest<C>\n" + > "----------\n"); > } > >@@ -15121,21 +15121,26 @@ > " }\n" + > "}\n" > }, >- "----------\n" + >- "1. WARNING in X.java (at line 8)\n" + >- " take(new A());\n" + >- " ^^^^^^^\n" + >- "Type safety: The expression of type Super.A needs unchecked conversion to conform to Super<Double>.A<Double>\n" + >- "----------\n" + >- "2. WARNING in X.java (at line 8)\n" + >- " take(new A());\n" + >- " ^\n" + >- "Super.A is a raw type. References to generic type Super<S>.A<E> should be parameterized\n" + >- "----------\n" + >- "3. ERROR in X.java (at line 14)\n" + >- " Zork z;\n" + >- " ^^^^\n" + >- "Zork cannot be resolved to a type\n" + >+ "----------\n" + >+ "1. WARNING in X.java (at line 8)\n" + >+ " take(new A());\n" + >+ " ^^^^^^^^^^^^^\n" + >+ "Type safety: Unchecked invocation take(Super.A) of the generic method take(Super<S>.A<S>) of type Super<Double>\n" + >+ "----------\n" + >+ "2. WARNING in X.java (at line 8)\n" + >+ " take(new A());\n" + >+ " ^^^^^^^\n" + >+ "Type safety: The expression of type Super.A needs unchecked conversion to conform to Super<Double>.A<Double>\n" + >+ "----------\n" + >+ "3. WARNING in X.java (at line 8)\n" + >+ " take(new A());\n" + >+ " ^\n" + >+ "Super.A is a raw type. References to generic type Super<S>.A<E> should be parameterized\n" + >+ "----------\n" + >+ "4. ERROR in X.java (at line 14)\n" + >+ " Zork z;\n" + >+ " ^^^^\n" + >+ "Zork cannot be resolved to a type\n" + > "----------\n"); > } > >@@ -15734,81 +15739,81 @@ > " Zork z;\n" + > "}\n" > }, >- "----------\n" + >- "1. WARNING in X.java (at line 6)\n" + >- " public void test(List list,final Comparator comparator, X x) {\n" + >- " ^^^^\n" + >- "List is a raw type. References to generic type List<E> should be parameterized\n" + >- "----------\n" + >- "2. WARNING in X.java (at line 6)\n" + >- " public void test(List list,final Comparator comparator, X x) {\n" + >- " ^^^^^^^^^^\n" + >- "Comparator is a raw type. References to generic type Comparator<T> should be parameterized\n" + >- "----------\n" + >- "3. WARNING in X.java (at line 6)\n" + >- " public void test(List list,final Comparator comparator, X x) {\n" + >- " ^\n" + >- "X is a raw type. References to generic type X<E> should be parameterized\n" + >- "----------\n" + >- "4. WARNING in X.java (at line 7)\n" + >- " foo(list, comparator);\n" + >- " ^^^^^^^^^^^^^^^^^^^^^\n" + >- "Type safety: Unchecked invocation foo(List, Comparator) of the generic method foo(List<T>, Comparator<? super T>) of type X<E>\n" + >- "----------\n" + >- "5. WARNING in X.java (at line 7)\n" + >- " foo(list, comparator);\n" + >- " ^^^^\n" + >- "Type safety: The expression of type List needs unchecked conversion to conform to List<T>\n" + >- "----------\n" + >- "6. WARNING in X.java (at line 7)\n" + >- " foo(list, comparator);\n" + >- " ^^^^^^^^^^\n" + >- "Type safety: The expression of type Comparator needs unchecked conversion to conform to Comparator<? super T>\n" + >- "----------\n" + >- "7. WARNING in X.java (at line 8)\n" + >- " bar(list, comparator);\n" + >- " ^^^^^^^^^^^^^^^^^^^^^\n" + >- "Type safety: Unchecked invocation bar(List, Comparator) of the generic method bar(List<T>, Comparator<? super T>) of type X<E>\n" + >- "----------\n" + >- "8. WARNING in X.java (at line 8)\n" + >- " bar(list, comparator);\n" + >- " ^^^^\n" + >- "Type safety: The expression of type List needs unchecked conversion to conform to List<T>\n" + >- "----------\n" + >- "9. WARNING in X.java (at line 8)\n" + >- " bar(list, comparator);\n" + >- " ^^^^^^^^^^\n" + >- "Type safety: The expression of type Comparator needs unchecked conversion to conform to Comparator<? super T>\n" + >- "----------\n" + >- "10. WARNING in X.java (at line 10)\n" + >- " x.foo(list, comparator);\n" + >- " ^^^^^^^^^^^^^^^^^^^^^^^\n" + >- "Type safety: The method foo(List, Comparator) belongs to the raw type X. References to generic type X<E> should be parameterized\n" + >- "----------\n" + >- "11. WARNING in X.java (at line 11)\n" + >- " x.bar(list, comparator);\n" + >- " ^^^^^^^^^^^^^^^^^^^^^^^\n" + >- "The static method bar(List, Comparator) from the type X should be accessed in a static way\n" + >- "----------\n" + >- "12. WARNING in X.java (at line 11)\n" + >- " x.bar(list, comparator);\n" + >- " ^^^^^^^^^^^^^^^^^^^^^^^\n" + >- "Type safety: Unchecked invocation bar(List, Comparator) of the generic method bar(List<T>, Comparator<? super T>) of type X\n" + >- "----------\n" + >- "13. WARNING in X.java (at line 11)\n" + >- " x.bar(list, comparator);\n" + >- " ^^^^\n" + >- "Type safety: The expression of type List needs unchecked conversion to conform to List<T>\n" + >- "----------\n" + >- "14. WARNING in X.java (at line 11)\n" + >- " x.bar(list, comparator);\n" + >- " ^^^^^^^^^^\n" + >- "Type safety: The expression of type Comparator needs unchecked conversion to conform to Comparator<? super T>\n" + >- "----------\n" + >- "15. ERROR in X.java (at line 18)\n" + >- " Zork z;\n" + >- " ^^^^\n" + >- "Zork cannot be resolved to a type\n" + >+ "----------\n" + >+ "1. WARNING in X.java (at line 6)\n" + >+ " public void test(List list,final Comparator comparator, X x) {\n" + >+ " ^^^^\n" + >+ "List is a raw type. References to generic type List<E> should be parameterized\n" + >+ "----------\n" + >+ "2. WARNING in X.java (at line 6)\n" + >+ " public void test(List list,final Comparator comparator, X x) {\n" + >+ " ^^^^^^^^^^\n" + >+ "Comparator is a raw type. References to generic type Comparator<T> should be parameterized\n" + >+ "----------\n" + >+ "3. WARNING in X.java (at line 6)\n" + >+ " public void test(List list,final Comparator comparator, X x) {\n" + >+ " ^\n" + >+ "X is a raw type. References to generic type X<E> should be parameterized\n" + >+ "----------\n" + >+ "4. WARNING in X.java (at line 7)\n" + >+ " foo(list, comparator);\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type safety: Unchecked invocation foo(List, Comparator) of the generic method foo(List<T>, Comparator<? super T>) of type X<E>\n" + >+ "----------\n" + >+ "5. WARNING in X.java (at line 7)\n" + >+ " foo(list, comparator);\n" + >+ " ^^^^\n" + >+ "Type safety: The expression of type List needs unchecked conversion to conform to List<Object>\n" + >+ "----------\n" + >+ "6. WARNING in X.java (at line 7)\n" + >+ " foo(list, comparator);\n" + >+ " ^^^^^^^^^^\n" + >+ "Type safety: The expression of type Comparator needs unchecked conversion to conform to Comparator<? super Object>\n" + >+ "----------\n" + >+ "7. WARNING in X.java (at line 8)\n" + >+ " bar(list, comparator);\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type safety: Unchecked invocation bar(List, Comparator) of the generic method bar(List<T>, Comparator<? super T>) of type X<E>\n" + >+ "----------\n" + >+ "8. WARNING in X.java (at line 8)\n" + >+ " bar(list, comparator);\n" + >+ " ^^^^\n" + >+ "Type safety: The expression of type List needs unchecked conversion to conform to List<Object>\n" + >+ "----------\n" + >+ "9. WARNING in X.java (at line 8)\n" + >+ " bar(list, comparator);\n" + >+ " ^^^^^^^^^^\n" + >+ "Type safety: The expression of type Comparator needs unchecked conversion to conform to Comparator<? super Object>\n" + >+ "----------\n" + >+ "10. WARNING in X.java (at line 10)\n" + >+ " x.foo(list, comparator);\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type safety: The method foo(List, Comparator) belongs to the raw type X. References to generic type X<E> should be parameterized\n" + >+ "----------\n" + >+ "11. WARNING in X.java (at line 11)\n" + >+ " x.bar(list, comparator);\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "The static method bar(List<Object>, Comparator<? super Object>) from the type X should be accessed in a static way\n" + >+ "----------\n" + >+ "12. WARNING in X.java (at line 11)\n" + >+ " x.bar(list, comparator);\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type safety: Unchecked invocation bar(List, Comparator) of the generic method bar(List<T>, Comparator<? super T>) of type X\n" + >+ "----------\n" + >+ "13. WARNING in X.java (at line 11)\n" + >+ " x.bar(list, comparator);\n" + >+ " ^^^^\n" + >+ "Type safety: The expression of type List needs unchecked conversion to conform to List<Object>\n" + >+ "----------\n" + >+ "14. WARNING in X.java (at line 11)\n" + >+ " x.bar(list, comparator);\n" + >+ " ^^^^^^^^^^\n" + >+ "Type safety: The expression of type Comparator needs unchecked conversion to conform to Comparator<? super Object>\n" + >+ "----------\n" + >+ "15. ERROR in X.java (at line 18)\n" + >+ " Zork z;\n" + >+ " ^^^^\n" + >+ "Zork cannot be resolved to a type\n" + > "----------\n"); > } > // array bound for wildcard >@@ -16653,36 +16658,36 @@ > " }\n" + > "}\n", > }, >- "----------\n" + >- "1. WARNING in X.java (at line 9)\n" + >- " Class c = Foo.class;\n" + >- " ^^^^^\n" + >- "Class is a raw type. References to generic type Class<T> should be parameterized\n" + >- "----------\n" + >- "2. WARNING in X.java (at line 10)\n" + >- " EnumSet<Enum> eSet = EnumSet.allOf(c);\n" + >- " ^^^^\n" + >- "Enum is a raw type. References to generic type Enum<E> should be parameterized\n" + >- "----------\n" + >- "3. ERROR in X.java (at line 10)\n" + >- " EnumSet<Enum> eSet = EnumSet.allOf(c);\n" + >- " ^^^^\n" + >- "Bound mismatch: The type Enum is not a valid substitute for the bounded parameter <E extends Enum<E>> of the type EnumSet<E>\n" + >- "----------\n" + >- "4. WARNING in X.java (at line 10)\n" + >- " EnumSet<Enum> eSet = EnumSet.allOf(c);\n" + >- " ^^^^^^^^^^^^^^^^\n" + >- "Type safety: Unchecked invocation allOf(Class) of the generic method allOf(Class<E>) of type EnumSet\n" + >- "----------\n" + >- "5. WARNING in X.java (at line 10)\n" + >- " EnumSet<Enum> eSet = EnumSet.allOf(c);\n" + >- " ^^^^^^^^^^^^^^^^\n" + >- "Type safety: The expression of type EnumSet needs unchecked conversion to conform to EnumSet<Enum>\n" + >- "----------\n" + >- "6. WARNING in X.java (at line 10)\n" + >- " EnumSet<Enum> eSet = EnumSet.allOf(c);\n" + >- " ^\n" + >- "Type safety: The expression of type Class needs unchecked conversion to conform to Class<E>\n" + >+ "----------\n" + >+ "1. WARNING in X.java (at line 9)\n" + >+ " Class c = Foo.class;\n" + >+ " ^^^^^\n" + >+ "Class is a raw type. References to generic type Class<T> should be parameterized\n" + >+ "----------\n" + >+ "2. WARNING in X.java (at line 10)\n" + >+ " EnumSet<Enum> eSet = EnumSet.allOf(c);\n" + >+ " ^^^^\n" + >+ "Enum is a raw type. References to generic type Enum<E> should be parameterized\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 10)\n" + >+ " EnumSet<Enum> eSet = EnumSet.allOf(c);\n" + >+ " ^^^^\n" + >+ "Bound mismatch: The type Enum is not a valid substitute for the bounded parameter <E extends Enum<E>> of the type EnumSet<E>\n" + >+ "----------\n" + >+ "4. WARNING in X.java (at line 10)\n" + >+ " EnumSet<Enum> eSet = EnumSet.allOf(c);\n" + >+ " ^^^^^^^^^^^^^^^^\n" + >+ "Type safety: Unchecked invocation allOf(Class) of the generic method allOf(Class<E>) of type EnumSet\n" + >+ "----------\n" + >+ "5. WARNING in X.java (at line 10)\n" + >+ " EnumSet<Enum> eSet = EnumSet.allOf(c);\n" + >+ " ^^^^^^^^^^^^^^^^\n" + >+ "Type safety: The expression of type EnumSet needs unchecked conversion to conform to EnumSet<Enum>\n" + >+ "----------\n" + >+ "6. WARNING in X.java (at line 10)\n" + >+ " EnumSet<Enum> eSet = EnumSet.allOf(c);\n" + >+ " ^\n" + >+ "Type safety: The expression of type Class needs unchecked conversion to conform to Class<Enum>\n" + > "----------\n"); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=86838 - variation >@@ -16729,7 +16734,7 @@ > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=86838 - variation > public void test0536() { >- this.runConformTest( >+ this.runNegativeTest( > new String[] { > "X.java", > "import java.util.EnumSet;\n" + >@@ -16741,11 +16746,37 @@ > "public class X {\n" + > " public static void main(String[] args) {\n" + > " Class c = Foo.class;\n" + >- " EnumSet<?> eSet = EnumSet.allOf(c);\n" + >+ " EnumSet<?> eSet = (EnumSet<?>) EnumSet.allOf(c);\n" + > " }\n" + >+ " Zork z;\n" + > "}\n", > }, >- "" >+ "----------\n" + >+ "1. WARNING in X.java (at line 9)\n" + >+ " Class c = Foo.class;\n" + >+ " ^^^^^\n" + >+ "Class is a raw type. References to generic type Class<T> should be parameterized\n" + >+ "----------\n" + >+ "2. WARNING in X.java (at line 10)\n" + >+ " EnumSet<?> eSet = (EnumSet<?>) EnumSet.allOf(c);\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Unnecessary cast from EnumSet to EnumSet<?>\n" + >+ "----------\n" + >+ "3. WARNING in X.java (at line 10)\n" + >+ " EnumSet<?> eSet = (EnumSet<?>) EnumSet.allOf(c);\n" + >+ " ^^^^^^^^^^^^^^^^\n" + >+ "Type safety: Unchecked invocation allOf(Class) of the generic method allOf(Class<E>) of type EnumSet\n" + >+ "----------\n" + >+ "4. WARNING in X.java (at line 10)\n" + >+ " EnumSet<?> eSet = (EnumSet<?>) EnumSet.allOf(c);\n" + >+ " ^\n" + >+ "Type safety: The expression of type Class needs unchecked conversion to conform to Class<Enum<Enum<E>>>\n" + >+ "----------\n" + >+ "5. ERROR in X.java (at line 12)\n" + >+ " Zork z;\n" + >+ " ^^^^\n" + >+ "Zork cannot be resolved to a type\n" + >+ "----------\n" > ); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=86838 - variation >@@ -16767,26 +16798,26 @@ > " Zork z;\n" + > "}\n", > }, >- "----------\n" + >- "1. WARNING in X.java (at line 9)\n" + >- " Class c = Foo.class;\n" + >- " ^^^^^\n" + >- "Class is a raw type. References to generic type Class<T> should be parameterized\n" + >- "----------\n" + >- "2. WARNING in X.java (at line 10)\n" + >- " EnumSet<?> eSet = EnumSet.allOf(c);\n" + >- " ^^^^^^^^^^^^^^^^\n" + >- "Type safety: Unchecked invocation allOf(Class) of the generic method allOf(Class<E>) of type EnumSet\n" + >- "----------\n" + >- "3. WARNING in X.java (at line 10)\n" + >- " EnumSet<?> eSet = EnumSet.allOf(c);\n" + >- " ^\n" + >- "Type safety: The expression of type Class needs unchecked conversion to conform to Class<E>\n" + >- "----------\n" + >- "4. ERROR in X.java (at line 12)\n" + >- " Zork z;\n" + >- " ^^^^\n" + >- "Zork cannot be resolved to a type\n" + >+ "----------\n" + >+ "1. WARNING in X.java (at line 9)\n" + >+ " Class c = Foo.class;\n" + >+ " ^^^^^\n" + >+ "Class is a raw type. References to generic type Class<T> should be parameterized\n" + >+ "----------\n" + >+ "2. WARNING in X.java (at line 10)\n" + >+ " EnumSet<?> eSet = EnumSet.allOf(c);\n" + >+ " ^^^^^^^^^^^^^^^^\n" + >+ "Type safety: Unchecked invocation allOf(Class) of the generic method allOf(Class<E>) of type EnumSet\n" + >+ "----------\n" + >+ "3. WARNING in X.java (at line 10)\n" + >+ " EnumSet<?> eSet = EnumSet.allOf(c);\n" + >+ " ^\n" + >+ "Type safety: The expression of type Class needs unchecked conversion to conform to Class<Enum<Enum<E>>>\n" + >+ "----------\n" + >+ "4. ERROR in X.java (at line 12)\n" + >+ " Zork z;\n" + >+ " ^^^^\n" + >+ "Zork cannot be resolved to a type\n" + > "----------\n"); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=86838 - variation >@@ -16807,31 +16838,31 @@ > " }\n" + > "}\n", > }, >- "----------\n" + >- "1. WARNING in X.java (at line 9)\n" + >- " Class c = Foo.class;\n" + >- " ^^^^^\n" + >- "Class is a raw type. References to generic type Class<T> should be parameterized\n" + >- "----------\n" + >- "2. ERROR in X.java (at line 10)\n" + >- " EnumSet<Enum<?>> eSet = EnumSet.allOf(c);\n" + >- " ^^^^\n" + >- "Bound mismatch: The type Enum<?> is not a valid substitute for the bounded parameter <E extends Enum<E>> of the type EnumSet<E>\n" + >- "----------\n" + >- "3. WARNING in X.java (at line 10)\n" + >- " EnumSet<Enum<?>> eSet = EnumSet.allOf(c);\n" + >- " ^^^^^^^^^^^^^^^^\n" + >- "Type safety: Unchecked invocation allOf(Class) of the generic method allOf(Class<E>) of type EnumSet\n" + >- "----------\n" + >- "4. WARNING in X.java (at line 10)\n" + >- " EnumSet<Enum<?>> eSet = EnumSet.allOf(c);\n" + >- " ^^^^^^^^^^^^^^^^\n" + >- "Type safety: The expression of type EnumSet needs unchecked conversion to conform to EnumSet<Enum<?>>\n" + >- "----------\n" + >- "5. WARNING in X.java (at line 10)\n" + >- " EnumSet<Enum<?>> eSet = EnumSet.allOf(c);\n" + >- " ^\n" + >- "Type safety: The expression of type Class needs unchecked conversion to conform to Class<E>\n" + >+ "----------\n" + >+ "1. WARNING in X.java (at line 9)\n" + >+ " Class c = Foo.class;\n" + >+ " ^^^^^\n" + >+ "Class is a raw type. References to generic type Class<T> should be parameterized\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 10)\n" + >+ " EnumSet<Enum<?>> eSet = EnumSet.allOf(c);\n" + >+ " ^^^^\n" + >+ "Bound mismatch: The type Enum<?> is not a valid substitute for the bounded parameter <E extends Enum<E>> of the type EnumSet<E>\n" + >+ "----------\n" + >+ "3. WARNING in X.java (at line 10)\n" + >+ " EnumSet<Enum<?>> eSet = EnumSet.allOf(c);\n" + >+ " ^^^^^^^^^^^^^^^^\n" + >+ "Type safety: Unchecked invocation allOf(Class) of the generic method allOf(Class<E>) of type EnumSet\n" + >+ "----------\n" + >+ "4. WARNING in X.java (at line 10)\n" + >+ " EnumSet<Enum<?>> eSet = EnumSet.allOf(c);\n" + >+ " ^^^^^^^^^^^^^^^^\n" + >+ "Type safety: The expression of type EnumSet needs unchecked conversion to conform to EnumSet<Enum<?>>\n" + >+ "----------\n" + >+ "5. WARNING in X.java (at line 10)\n" + >+ " EnumSet<Enum<?>> eSet = EnumSet.allOf(c);\n" + >+ " ^\n" + >+ "Type safety: The expression of type Class needs unchecked conversion to conform to Class<Enum<?>>\n" + > "----------\n"); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=86838 - variation >@@ -18874,21 +18905,21 @@ > " Zork z;\n" + > "}\n", > }, >- "----------\n" + >- "1. WARNING in Ball.java (at line 2)\n" + >- " class Ball implements Comparable {\n" + >- " ^^^^^^^^^^\n" + >- "Comparable is a raw type. References to generic type Comparable<T> should be parameterized\n" + >- "----------\n" + >- "2. WARNING in Ball.java (at line 10)\n" + >- " Collections.sort(foo);\n" + >- " ^^^^^^^^^^^^^^^^^^^^^\n" + >- "Type safety: Unchecked invocation sort(List<Ball>) of the generic method sort(List<T>) of type Collections\n" + >- "----------\n" + >- "3. ERROR in Ball.java (at line 12)\n" + >- " Zork z;\n" + >- " ^^^^\n" + >- "Zork cannot be resolved to a type\n" + >+ "----------\n" + >+ "1. WARNING in Ball.java (at line 2)\n" + >+ " class Ball implements Comparable {\n" + >+ " ^^^^^^^^^^\n" + >+ "Comparable is a raw type. References to generic type Comparable<T> should be parameterized\n" + >+ "----------\n" + >+ "2. WARNING in Ball.java (at line 10)\n" + >+ " Collections.sort(foo);\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type safety: Unchecked invocation sort(LinkedList<Ball>) of the generic method sort(List<T>) of type Collections\n" + >+ "----------\n" + >+ "3. ERROR in Ball.java (at line 12)\n" + >+ " Zork z;\n" + >+ " ^^^^\n" + >+ "Zork cannot be resolved to a type\n" + > "----------\n"); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=81831 >@@ -22751,36 +22782,36 @@ > " Zork z;\n" + > "}\n", > }, >- "----------\n" + >- "1. WARNING in X.java (at line 13)\n" + >- " public class ActionImpl<T extends Base> extends Action<T> implements Comparable<ActionImpl> {\n" + >- " ^^^^^^^^^^\n" + >- "X.ActionImpl is a raw type. References to generic type X.ActionImpl<T> should be parameterized\n" + >- "----------\n" + >- "2. WARNING in X.java (at line 14)\n" + >- " public int compareTo(ActionImpl o) {\n" + >- " ^^^^^^^^^^\n" + >- "X.ActionImpl is a raw type. References to generic type X.ActionImpl<T> should be parameterized\n" + >- "----------\n" + >- "3. WARNING in X.java (at line 20)\n" + >- " Set<ActionImpl> set = new TreeSet<ActionImpl>();\n" + >- " ^^^^^^^^^^\n" + >- "X.ActionImpl is a raw type. References to generic type X.ActionImpl<T> should be parameterized\n" + >- "----------\n" + >- "4. WARNING in X.java (at line 20)\n" + >- " Set<ActionImpl> set = new TreeSet<ActionImpl>();\n" + >- " ^^^^^^^^^^\n" + >- "X.ActionImpl is a raw type. References to generic type X.ActionImpl<T> should be parameterized\n" + >- "----------\n" + >- "5. WARNING in X.java (at line 21)\n" + >- " Collections.max(set);\n" + >- " ^^^^^^^^^^^^^^^^^^^^\n" + >- "Type safety: Unchecked invocation max(Collection<? extends X.ActionImpl>) of the generic method max(Collection<? extends T>) of type Collections\n" + >- "----------\n" + >- "6. ERROR in X.java (at line 23)\n" + >- " Zork z;\n" + >- " ^^^^\n" + >- "Zork cannot be resolved to a type\n" + >+ "----------\n" + >+ "1. WARNING in X.java (at line 13)\n" + >+ " public class ActionImpl<T extends Base> extends Action<T> implements Comparable<ActionImpl> {\n" + >+ " ^^^^^^^^^^\n" + >+ "X.ActionImpl is a raw type. References to generic type X.ActionImpl<T> should be parameterized\n" + >+ "----------\n" + >+ "2. WARNING in X.java (at line 14)\n" + >+ " public int compareTo(ActionImpl o) {\n" + >+ " ^^^^^^^^^^\n" + >+ "X.ActionImpl is a raw type. References to generic type X.ActionImpl<T> should be parameterized\n" + >+ "----------\n" + >+ "3. WARNING in X.java (at line 20)\n" + >+ " Set<ActionImpl> set = new TreeSet<ActionImpl>();\n" + >+ " ^^^^^^^^^^\n" + >+ "X.ActionImpl is a raw type. References to generic type X.ActionImpl<T> should be parameterized\n" + >+ "----------\n" + >+ "4. WARNING in X.java (at line 20)\n" + >+ " Set<ActionImpl> set = new TreeSet<ActionImpl>();\n" + >+ " ^^^^^^^^^^\n" + >+ "X.ActionImpl is a raw type. References to generic type X.ActionImpl<T> should be parameterized\n" + >+ "----------\n" + >+ "5. WARNING in X.java (at line 21)\n" + >+ " Collections.max(set);\n" + >+ " ^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type safety: Unchecked invocation max(Set<X.ActionImpl>) of the generic method max(Collection<? extends T>) of type Collections\n" + >+ "----------\n" + >+ "6. ERROR in X.java (at line 23)\n" + >+ " Zork z;\n" + >+ " ^^^^\n" + >+ "Zork cannot be resolved to a type\n" + > "----------\n"); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=98364 >@@ -27607,36 +27638,36 @@ > "\n" + > "}\n", > }, >- "----------\n" + >- "1. WARNING in X.java (at line 20)\n" + >- " List<List> o = Foo.foo1();\n" + >- " ^^^^\n" + >- "List is a raw type. References to generic type List<E> should be parameterized\n" + >- "----------\n" + >- "2. ERROR in X.java (at line 20)\n" + >- " List<List> o = Foo.foo1();\n" + >- " ^^^^\n" + >- "The method foo1() in the type Foo is not applicable for the arguments ()\n" + >- "----------\n" + >- "3. ERROR in X.java (at line 21)\n" + >- " Foo.bar1(o);\n" + >- " ^^^^\n" + >- "The method bar1(List<List<T>>) in the type Foo is not applicable for the arguments (List<List>)\n" + >- "----------\n" + >- "4. WARNING in X.java (at line 24)\n" + >- " List o = Foo.foo2();\n" + >- " ^^^^\n" + >- "List is a raw type. References to generic type List<E> should be parameterized\n" + >- "----------\n" + >- "5. WARNING in X.java (at line 25)\n" + >- " Foo.bar2(o);\n" + >- " ^^^^^^^^^^^\n" + >- "Type safety: Unchecked invocation bar2(List) of the generic method bar2(List<T>) of type Foo\n" + >- "----------\n" + >- "6. WARNING in X.java (at line 25)\n" + >- " Foo.bar2(o);\n" + >- " ^\n" + >- "Type safety: The expression of type List needs unchecked conversion to conform to List<T>\n" + >+ "----------\n" + >+ "1. WARNING in X.java (at line 20)\n" + >+ " List<List> o = Foo.foo1();\n" + >+ " ^^^^\n" + >+ "List is a raw type. References to generic type List<E> should be parameterized\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 20)\n" + >+ " List<List> o = Foo.foo1();\n" + >+ " ^^^^\n" + >+ "The method foo1() in the type Foo is not applicable for the arguments ()\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 21)\n" + >+ " Foo.bar1(o);\n" + >+ " ^^^^\n" + >+ "The method bar1(List<List<T>>) in the type Foo is not applicable for the arguments (List<List>)\n" + >+ "----------\n" + >+ "4. WARNING in X.java (at line 24)\n" + >+ " List o = Foo.foo2();\n" + >+ " ^^^^\n" + >+ "List is a raw type. References to generic type List<E> should be parameterized\n" + >+ "----------\n" + >+ "5. WARNING in X.java (at line 25)\n" + >+ " Foo.bar2(o);\n" + >+ " ^^^^^^^^^^^\n" + >+ "Type safety: Unchecked invocation bar2(List) of the generic method bar2(List<T>) of type Foo\n" + >+ "----------\n" + >+ "6. WARNING in X.java (at line 25)\n" + >+ " Foo.bar2(o);\n" + >+ " ^\n" + >+ "Type safety: The expression of type List needs unchecked conversion to conform to List<Runnable>\n" + > "----------\n"); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=114365 >@@ -28272,21 +28303,21 @@ > " }\n" + > "}\n" , > }, >- "----------\n" + >- "1. ERROR in X.java (at line 7)\n" + >- " String s = getClass();\n" + >- " ^^^^^^^^^^\n" + >- "Type mismatch: cannot convert from Class<capture#1-of ? extends X> to String\n" + >- "----------\n" + >- "2. ERROR in X.java (at line 8)\n" + >- " return (String) getDefault(getClass());\n" + >- " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >- "Cannot cast from capture#2-of ? extends X to String\n" + >- "----------\n" + >- "3. WARNING in X.java (at line 8)\n" + >- " return (String) getDefault(getClass());\n" + >- " ^^^^^^^^^^^^^^^^^^^^^^\n" + >- "Type safety: Unchecked invocation getDefault(Class<capture#2-of ? extends X>) of the generic method getDefault(Class<T>) of type X<C>\n" + >+ "----------\n" + >+ "1. ERROR in X.java (at line 7)\n" + >+ " String s = getClass();\n" + >+ " ^^^^^^^^^^\n" + >+ "Type mismatch: cannot convert from Class<capture#1-of ? extends X> to String\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 8)\n" + >+ " return (String) getDefault(getClass());\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Cannot cast from X to String\n" + >+ "----------\n" + >+ "3. WARNING in X.java (at line 8)\n" + >+ " return (String) getDefault(getClass());\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type safety: Unchecked invocation getDefault(Class<capture#2-of ? extends X>) of the generic method getDefault(Class<T>) of type X<C>\n" + > "----------\n"); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=125445 >@@ -30043,31 +30074,31 @@ > " }\n" + > "}\n", > }, >- "----------\n" + >- "1. WARNING in X.java (at line 6)\n" + >- " Class<? extends Enum> enumType = null;\n" + >- " ^^^^\n" + >- "Enum is a raw type. References to generic type Enum<E> should be parameterized\n" + >- "----------\n" + >- "2. WARNING in X.java (at line 7)\n" + >- " final Collection<E> test = allOf(enumType);\n" + >- " ^^^^^^^^^^^^^^^\n" + >- "Type safety: Unchecked invocation allOf(Class<capture#1-of ? extends Enum>) of the generic method allOf(Class<E>) of type X\n" + >- "----------\n" + >- "3. ERROR in X.java (at line 7)\n" + >- " final Collection<E> test = allOf(enumType);\n" + >- " ^^^^^^^^^^^^^^^\n" + >- "Type mismatch: cannot convert from Collection<capture#1-of ? extends Enum> to Collection<E>\n" + >- "----------\n" + >- "4. WARNING in X.java (at line 9)\n" + >- " Collection<? extends Enum> colType = null;\n" + >- " ^^^^\n" + >- "Enum is a raw type. References to generic type Enum<E> should be parameterized\n" + >- "----------\n" + >- "5. ERROR in X.java (at line 10)\n" + >- " final Collection<E> test2 = colType;\n" + >- " ^^^^^^^\n" + >- "Type mismatch: cannot convert from Collection<capture#2-of ? extends Enum> to Collection<E>\n" + >+ "----------\n" + >+ "1. WARNING in X.java (at line 6)\n" + >+ " Class<? extends Enum> enumType = null;\n" + >+ " ^^^^\n" + >+ "Enum is a raw type. References to generic type Enum<E> should be parameterized\n" + >+ "----------\n" + >+ "2. WARNING in X.java (at line 7)\n" + >+ " final Collection<E> test = allOf(enumType);\n" + >+ " ^^^^^^^^^^^^^^^\n" + >+ "Type safety: Unchecked invocation allOf(Class<capture#1-of ? extends Enum>) of the generic method allOf(Class<E>) of type X\n" + >+ "----------\n" + >+ "3. WARNING in X.java (at line 7)\n" + >+ " final Collection<E> test = allOf(enumType);\n" + >+ " ^^^^^^^^^^^^^^^\n" + >+ "Type safety: The expression of type Collection needs unchecked conversion to conform to Collection<E>\n" + >+ "----------\n" + >+ "4. WARNING in X.java (at line 9)\n" + >+ " Collection<? extends Enum> colType = null;\n" + >+ " ^^^^\n" + >+ "Enum is a raw type. References to generic type Enum<E> should be parameterized\n" + >+ "----------\n" + >+ "5. ERROR in X.java (at line 10)\n" + >+ " final Collection<E> test2 = colType;\n" + >+ " ^^^^^^^\n" + >+ "Type mismatch: cannot convert from Collection<capture#2-of ? extends Enum> to Collection<E>\n" + > "----------\n"); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=119238 >@@ -31106,21 +31137,26 @@ > " Zork z;\n" + > "}\n" > }, >- "----------\n" + >- "1. WARNING in X.java (at line 7)\n" + >- " X x = newInstance();\n" + >- " ^\n" + >- "X is a raw type. References to generic type X<A> should be parameterized\n" + >- "----------\n" + >- "2. WARNING in X.java (at line 8)\n" + >- " return new X[] { x };\n" + >- " ^^^^^^^^^^^^^\n" + >- "Type safety: The expression of type X[] needs unchecked conversion to conform to X<String>[]\n" + >- "----------\n" + >- "3. ERROR in X.java (at line 10)\n" + >- " Zork z;\n" + >- " ^^^^\n" + >- "Zork cannot be resolved to a type\n" + >+ "----------\n" + >+ "1. WARNING in X.java (at line 7)\n" + >+ " X x = newInstance();\n" + >+ " ^\n" + >+ "X is a raw type. References to generic type X<A> should be parameterized\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 7)\n" + >+ " X x = newInstance();\n" + >+ " ^^^^^^^^^^^\n" + >+ "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" + >+ "----------\n" + >+ "3. WARNING in X.java (at line 8)\n" + >+ " return new X[] { x };\n" + >+ " ^^^^^^^^^^^^^\n" + >+ "Type safety: The expression of type X[] needs unchecked conversion to conform to X<String>[]\n" + >+ "----------\n" + >+ "4. ERROR in X.java (at line 10)\n" + >+ " Zork z;\n" + >+ " ^^^^\n" + >+ "Zork cannot be resolved to a type\n" + > "----------\n"); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=118273 - variation >@@ -31163,7 +31199,7 @@ > "5. WARNING in X.java (at line 7)\n" + > " Comparable c = newInstance2(x);\n" + > " ^\n" + >- "Type safety: The expression of type X needs unchecked conversion to conform to X<B>\n" + >+ "Type safety: The expression of type X needs unchecked conversion to conform to X<Comparable>\n" + > "----------\n" + > "6. ERROR in X.java (at line 9)\n" + > " Zork z;\n" + >@@ -32482,26 +32518,31 @@ > " }\n" + > "}", // ================= > }, >- "----------\n" + >- "1. WARNING in X.java (at line 9)\n" + >- " Iterator<Number> it1 = X.chain(new Iterator[] { l1.iterator(), l2.iterator() });\n" + >- " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >- "Type safety: Unchecked invocation chain(Iterator...) of the generic method chain(Iterator<E>...) of type X\n" + >- "----------\n" + >- "2. WARNING in X.java (at line 9)\n" + >- " Iterator<Number> it1 = X.chain(new Iterator[] { l1.iterator(), l2.iterator() });\n" + >- " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >- "Type safety: The expression of type Iterator needs unchecked conversion to conform to Iterator<Number>\n" + >- "----------\n" + >- "3. ERROR in X.java (at line 14)\n" + >- " Iterator<Number> it2 = X.chain(l1.iterator(), l2.iterator());\n" + >- " ^^^^^\n" + >- "The method chain(Iterator<E>...) in the type X is not applicable for the arguments (Iterator<Integer>, Iterator<Float>)\n" + >- "----------\n" + >- "4. WARNING in X.java (at line 18)\n" + >- " Iterator<Number> it2 = X.chain(l1.iterator(), l1.iterator());\n" + >- " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >- "Type safety : A generic array of Iterator<Integer> is created for a varargs parameter\n" + >+ "----------\n" + >+ "1. WARNING in X.java (at line 9)\n" + >+ " Iterator<Number> it1 = X.chain(new Iterator[] { l1.iterator(), l2.iterator() });\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type safety: Unchecked invocation chain(Iterator[]) of the generic method chain(Iterator<E>...) of type X\n" + >+ "----------\n" + >+ "2. WARNING in X.java (at line 9)\n" + >+ " Iterator<Number> it1 = X.chain(new Iterator[] { l1.iterator(), l2.iterator() });\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type safety: The expression of type Iterator needs unchecked conversion to conform to Iterator<Number>\n" + >+ "----------\n" + >+ "3. WARNING in X.java (at line 9)\n" + >+ " Iterator<Number> it1 = X.chain(new Iterator[] { l1.iterator(), l2.iterator() });\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type safety: The expression of type Iterator[] needs unchecked conversion to conform to Iterator<Number>[]\n" + >+ "----------\n" + >+ "4. ERROR in X.java (at line 14)\n" + >+ " Iterator<Number> it2 = X.chain(l1.iterator(), l2.iterator());\n" + >+ " ^^^^^\n" + >+ "The method chain(Iterator<E>...) in the type X is not applicable for the arguments (Iterator<Integer>, Iterator<Float>)\n" + >+ "----------\n" + >+ "5. WARNING in X.java (at line 18)\n" + >+ " Iterator<Number> it2 = X.chain(l1.iterator(), l1.iterator());\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type safety : A generic array of Iterator<Integer> is created for a varargs parameter\n" + > "----------\n"); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=144879 >@@ -32530,36 +32571,41 @@ > " }\n" + > "}", // ================= > }, >- "----------\n" + >- "1. WARNING in X.java (at line 9)\n" + >- " Iterator<Number> it1 = X.chain(new Iterator[] { l1.iterator(), l2.iterator() });\n" + >- " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >- "Type safety: Unchecked invocation chain(Iterator...) of the generic method chain(Iterator<? extends T>...) of type X\n" + >- "----------\n" + >- "2. WARNING in X.java (at line 9)\n" + >- " Iterator<Number> it1 = X.chain(new Iterator[] { l1.iterator(), l2.iterator() });\n" + >- " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >- "Type safety: The expression of type Iterator needs unchecked conversion to conform to Iterator<Number>\n" + >- "----------\n" + >- "3. WARNING in X.java (at line 14)\n" + >- " Iterator<Number> it2 = X.chain(l1.iterator(), l2.iterator());\n" + >- " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >- "Type safety : A generic array of Iterator<? extends Number&Comparable<?>> is created for a varargs parameter\n" + >- "----------\n" + >- "4. ERROR in X.java (at line 14)\n" + >- " Iterator<Number> it2 = X.chain(l1.iterator(), l2.iterator());\n" + >- " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >- "Type mismatch: cannot convert from Iterator<Number&Comparable<?>> to Iterator<Number>\n" + >- "----------\n" + >- "5. WARNING in X.java (at line 18)\n" + >- " Iterator<Number> it2 = X.chain(l1.iterator(), l1.iterator());\n" + >- " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >- "Type safety : A generic array of Iterator<? extends Integer> is created for a varargs parameter\n" + >- "----------\n" + >- "6. ERROR in X.java (at line 18)\n" + >- " Iterator<Number> it2 = X.chain(l1.iterator(), l1.iterator());\n" + >- " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >- "Type mismatch: cannot convert from Iterator<Integer> to Iterator<Number>\n" + >+ "----------\n" + >+ "1. WARNING in X.java (at line 9)\n" + >+ " Iterator<Number> it1 = X.chain(new Iterator[] { l1.iterator(), l2.iterator() });\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type safety: Unchecked invocation chain(Iterator[]) of the generic method chain(Iterator<? extends T>...) of type X\n" + >+ "----------\n" + >+ "2. WARNING in X.java (at line 9)\n" + >+ " Iterator<Number> it1 = X.chain(new Iterator[] { l1.iterator(), l2.iterator() });\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type safety: The expression of type Iterator needs unchecked conversion to conform to Iterator<Number>\n" + >+ "----------\n" + >+ "3. WARNING in X.java (at line 9)\n" + >+ " Iterator<Number> it1 = X.chain(new Iterator[] { l1.iterator(), l2.iterator() });\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type safety: The expression of type Iterator[] needs unchecked conversion to conform to Iterator<? extends Number>[]\n" + >+ "----------\n" + >+ "4. WARNING in X.java (at line 14)\n" + >+ " Iterator<Number> it2 = X.chain(l1.iterator(), l2.iterator());\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type safety : A generic array of Iterator<? extends Number&Comparable<?>> is created for a varargs parameter\n" + >+ "----------\n" + >+ "5. ERROR in X.java (at line 14)\n" + >+ " Iterator<Number> it2 = X.chain(l1.iterator(), l2.iterator());\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type mismatch: cannot convert from Iterator<Number&Comparable<?>> to Iterator<Number>\n" + >+ "----------\n" + >+ "6. WARNING in X.java (at line 18)\n" + >+ " Iterator<Number> it2 = X.chain(l1.iterator(), l1.iterator());\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type safety : A generic array of Iterator<? extends Integer> is created for a varargs parameter\n" + >+ "----------\n" + >+ "7. ERROR in X.java (at line 18)\n" + >+ " Iterator<Number> it2 = X.chain(l1.iterator(), l1.iterator());\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type mismatch: cannot convert from Iterator<Integer> to Iterator<Number>\n" + > "----------\n"); > } > public void test1001() { >@@ -32770,7 +32816,7 @@ > " X x = bar(l, c);\n" + > " }\n" + > " <T> T bar(L<T> l, C<? extends T> c) { \n" + >- " return null;\n" + >+ " return zork;\n" + > " } \n" + > "}\n" + > "class C<E> {}\n" + >@@ -32778,26 +32824,31 @@ > "\n" + > "\n", // ================= > }, >- "----------\n" + >- "1. WARNING in X.java (at line 2)\r\n" + >- " void foo(L l, C<? extends X> c) {\r\n" + >- " ^\n" + >- "L is a raw type. References to generic type L<E> should be parameterized\n" + >- "----------\n" + >- "2. WARNING in X.java (at line 3)\r\n" + >- " X x = bar(l, c);\r\n" + >- " ^^^^^^^^^\n" + >- "Type safety: Unchecked invocation bar(L, C) of the generic method bar(L<T>, C<? extends T>) of type X\n" + >- "----------\n" + >- "3. ERROR in X.java (at line 3)\r\n" + >- " X x = bar(l, c);\r\n" + >- " ^^^^^^^^^\n" + >- "Type mismatch: cannot convert from Object to X\n" + >- "----------\n" + >- "4. WARNING in X.java (at line 3)\r\n" + >- " X x = bar(l, c);\r\n" + >- " ^\n" + >- "Type safety: The expression of type L needs unchecked conversion to conform to L<T>\n" + >+ "----------\n" + >+ "1. WARNING in X.java (at line 2)\n" + >+ " void foo(L l, C<? extends X> c) {\n" + >+ " ^\n" + >+ "L is a raw type. References to generic type L<E> should be parameterized\n" + >+ "----------\n" + >+ "2. WARNING in X.java (at line 3)\n" + >+ " X x = bar(l, c);\n" + >+ " ^^^^^^^^^\n" + >+ "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" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 3)\n" + >+ " X x = bar(l, c);\n" + >+ " ^^^^^^^^^\n" + >+ "Type mismatch: cannot convert from Object to X\n" + >+ "----------\n" + >+ "4. WARNING in X.java (at line 3)\n" + >+ " X x = bar(l, c);\n" + >+ " ^\n" + >+ "Type safety: The expression of type L needs unchecked conversion to conform to L<X>\n" + >+ "----------\n" + >+ "5. ERROR in X.java (at line 6)\n" + >+ " return zork;\n" + >+ " ^^^^\n" + >+ "zork cannot be resolved\n" + > "----------\n", > JavacTestOptions.EclipseJustification.EclipseBug148061); > } >@@ -32873,31 +32924,36 @@ > " <U> void bar3(Map<String,String> map, U s, Map<U,U> map2) {}\n" + > "}\n", // ================= > }, >- "----------\n" + >- "1. WARNING in X.java (at line 3)\n" + >- " void foo(HashMap map, String s, Map<String,String> map2) {\n" + >- " ^^^^^^^\n" + >- "HashMap is a raw type. References to generic type HashMap<K,V> should be parameterized\n" + >- "----------\n" + >- "2. WARNING in X.java (at line 4)\n" + >- " bar(map, s, map2); //1\n" + >- " ^^^^^^^^^^^^^^^^^\n" + >- "Type safety: Unchecked invocation bar(Map, Object, Map) of the generic method bar(Map<U,U>, U, Map<U,U>) of type X\n" + >- "----------\n" + >- "3. WARNING in X.java (at line 4)\n" + >- " bar(map, s, map2); //1\n" + >- " ^^^\n" + >- "Type safety: The expression of type HashMap needs unchecked conversion to conform to Map<U,U>\n" + >- "----------\n" + >- "4. WARNING in X.java (at line 6)\n" + >- " bar2(map, s, map2); //3\n" + >- " ^^^\n" + >- "Type safety: The expression of type HashMap needs unchecked conversion to conform to Map<String,String>\n" + >- "----------\n" + >- "5. WARNING in X.java (at line 7)\n" + >- " bar3(map, s, map2); //4\n" + >- " ^^^\n" + >- "Type safety: The expression of type HashMap needs unchecked conversion to conform to Map<String,String>\n" + >+ "----------\n" + >+ "1. WARNING in X.java (at line 3)\n" + >+ " void foo(HashMap map, String s, Map<String,String> map2) {\n" + >+ " ^^^^^^^\n" + >+ "HashMap is a raw type. References to generic type HashMap<K,V> should be parameterized\n" + >+ "----------\n" + >+ "2. WARNING in X.java (at line 4)\n" + >+ " bar(map, s, map2); //1\n" + >+ " ^^^^^^^^^^^^^^^^^\n" + >+ "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" + >+ "----------\n" + >+ "3. WARNING in X.java (at line 4)\n" + >+ " bar(map, s, map2); //1\n" + >+ " ^^^\n" + >+ "Type safety: The expression of type HashMap needs unchecked conversion to conform to Map<String,String>\n" + >+ "----------\n" + >+ "4. WARNING in X.java (at line 6)\n" + >+ " bar2(map, s, map2); //3\n" + >+ " ^^^\n" + >+ "Type safety: The expression of type HashMap needs unchecked conversion to conform to Map<String,String>\n" + >+ "----------\n" + >+ "5. WARNING in X.java (at line 7)\n" + >+ " bar3(map, s, map2); //4\n" + >+ " ^^^^^^^^^^^^^^^^^^\n" + >+ "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" + >+ "----------\n" + >+ "6. WARNING in X.java (at line 7)\n" + >+ " bar3(map, s, map2); //4\n" + >+ " ^^^\n" + >+ "Type safety: The expression of type HashMap needs unchecked conversion to conform to Map<String,String>\n" + > "----------\n"); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=148061 - variation >@@ -32918,63 +32974,68 @@ > " return null;\n" + > " }\n" + > " <T> C<T> bar3(L<T> l, C<T> c) {\n" + >- " return null;\n" + >+ " return zork;\n" + > " }\n" + > "}\n" + > "\n" + > "class C<E> {}\n" + > "class L<E> {}\n", // ================= > }, >- "----------\n" + >- "1. WARNING in X.java (at line 2)\r\n" + >- " void foo(L l, C<X> c) {\r\n" + >- " ^\n" + >- "L is a raw type. References to generic type L<E> should be parameterized\n" + >- "----------\n" + >- "2. WARNING in X.java (at line 3)\r\n" + >- " X x = bar1(l, c);\r\n" + >- " ^^^^^^^^^^\n" + >- "Type safety: Unchecked invocation bar1(L, C) of the generic method bar1(L<T>, C<T>) of type X\n" + >- "----------\n" + >- "3. ERROR in X.java (at line 3)\r\n" + >- " X x = bar1(l, c);\r\n" + >- " ^^^^^^^^^^\n" + >- "Type mismatch: cannot convert from Object to X\n" + >- "----------\n" + >- "4. WARNING in X.java (at line 3)\r\n" + >- " X x = bar1(l, c);\r\n" + >- " ^\n" + >- "Type safety: The expression of type L needs unchecked conversion to conform to L<T>\n" + >- "----------\n" + >- "5. WARNING in X.java (at line 4)\r\n" + >- " L<X> lx = bar2(l, c);\r\n" + >- " ^^^^^^^^^^\n" + >- "Type safety: Unchecked invocation bar2(L, C) of the generic method bar2(L<T>, C<T>) of type X\n" + >- "----------\n" + >- "6. WARNING in X.java (at line 4)\r\n" + >- " L<X> lx = bar2(l, c);\r\n" + >- " ^^^^^^^^^^\n" + >- "Type safety: The expression of type L needs unchecked conversion to conform to L<X>\n" + >- "----------\n" + >- "7. WARNING in X.java (at line 4)\r\n" + >- " L<X> lx = bar2(l, c);\r\n" + >- " ^\n" + >- "Type safety: The expression of type L needs unchecked conversion to conform to L<T>\n" + >- "----------\n" + >- "8. WARNING in X.java (at line 5)\r\n" + >- " C<X> cx = bar3(l, c);\r\n" + >- " ^^^^^^^^^^\n" + >- "Type safety: Unchecked invocation bar3(L, C) of the generic method bar3(L<T>, C<T>) of type X\n" + >- "----------\n" + >- "9. WARNING in X.java (at line 5)\r\n" + >- " C<X> cx = bar3(l, c);\r\n" + >- " ^^^^^^^^^^\n" + >- "Type safety: The expression of type C needs unchecked conversion to conform to C<X>\n" + >- "----------\n" + >- "10. WARNING in X.java (at line 5)\r\n" + >- " C<X> cx = bar3(l, c);\r\n" + >- " ^\n" + >- "Type safety: The expression of type L needs unchecked conversion to conform to L<T>\n" + >+ "----------\n" + >+ "1. WARNING in X.java (at line 2)\n" + >+ " void foo(L l, C<X> c) {\n" + >+ " ^\n" + >+ "L is a raw type. References to generic type L<E> should be parameterized\n" + >+ "----------\n" + >+ "2. WARNING in X.java (at line 3)\n" + >+ " X x = bar1(l, c);\n" + >+ " ^^^^^^^^^^\n" + >+ "Type safety: Unchecked invocation bar1(L, C<X>) of the generic method bar1(L<T>, C<T>) of type X\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 3)\n" + >+ " X x = bar1(l, c);\n" + >+ " ^^^^^^^^^^\n" + >+ "Type mismatch: cannot convert from Object to X\n" + >+ "----------\n" + >+ "4. WARNING in X.java (at line 3)\n" + >+ " X x = bar1(l, c);\n" + >+ " ^\n" + >+ "Type safety: The expression of type L needs unchecked conversion to conform to L<X>\n" + >+ "----------\n" + >+ "5. WARNING in X.java (at line 4)\n" + >+ " L<X> lx = bar2(l, c);\n" + >+ " ^^^^^^^^^^\n" + >+ "Type safety: Unchecked invocation bar2(L, C<X>) of the generic method bar2(L<T>, C<T>) of type X\n" + >+ "----------\n" + >+ "6. WARNING in X.java (at line 4)\n" + >+ " L<X> lx = bar2(l, c);\n" + >+ " ^^^^^^^^^^\n" + >+ "Type safety: The expression of type L needs unchecked conversion to conform to L<X>\n" + >+ "----------\n" + >+ "7. WARNING in X.java (at line 4)\n" + >+ " L<X> lx = bar2(l, c);\n" + >+ " ^\n" + >+ "Type safety: The expression of type L needs unchecked conversion to conform to L<X>\n" + >+ "----------\n" + >+ "8. WARNING in X.java (at line 5)\n" + >+ " C<X> cx = bar3(l, c);\n" + >+ " ^^^^^^^^^^\n" + >+ "Type safety: Unchecked invocation bar3(L, C<X>) of the generic method bar3(L<T>, C<T>) of type X\n" + >+ "----------\n" + >+ "9. WARNING in X.java (at line 5)\n" + >+ " C<X> cx = bar3(l, c);\n" + >+ " ^^^^^^^^^^\n" + >+ "Type safety: The expression of type C needs unchecked conversion to conform to C<X>\n" + >+ "----------\n" + >+ "10. WARNING in X.java (at line 5)\n" + >+ " C<X> cx = bar3(l, c);\n" + >+ " ^\n" + >+ "Type safety: The expression of type L needs unchecked conversion to conform to L<X>\n" + >+ "----------\n" + >+ "11. ERROR in X.java (at line 14)\n" + >+ " return zork;\n" + >+ " ^^^^\n" + >+ "zork cannot be resolved\n" + > "----------\n", > JavacTestOptions.EclipseJustification.EclipseBug148061); > } >@@ -33010,41 +33071,41 @@ > " }\n" + > "}\n", // ================= > }, >- "----------\n" + >- "1. WARNING in X.java (at line 14)\r\n" + >- " void foo(List l1, List<X> l2) {\r\n" + >- " ^^^^\n" + >- "List is a raw type. References to generic type List<E> should be parameterized\n" + >- "----------\n" + >- "2. WARNING in X.java (at line 15)\r\n" + >- " X x = bar1(l1, l2);\r\n" + >- " ^^^^^^^^^^^^\n" + >- "Type safety: Unchecked invocation bar1(List, List) of the generic method bar1(List<T>, List<T>) of type X\n" + >- "----------\n" + >- "3. ERROR in X.java (at line 15)\r\n" + >- " X x = bar1(l1, l2);\r\n" + >- " ^^^^^^^^^^^^\n" + >- "Type mismatch: cannot convert from Object to X\n" + >- "----------\n" + >- "4. WARNING in X.java (at line 15)\r\n" + >- " X x = bar1(l1, l2);\r\n" + >- " ^^\n" + >- "Type safety: The expression of type List needs unchecked conversion to conform to List<T>\n" + >- "----------\n" + >- "5. WARNING in X.java (at line 17)\r\n" + >- " List<X> lx = bar2(l1, l2);\r\n" + >- " ^^^^^^^^^^^^\n" + >- "Type safety: Unchecked invocation bar2(List, List) of the generic method bar2(List<T>, List<T>) of type X\n" + >- "----------\n" + >- "6. WARNING in X.java (at line 17)\r\n" + >- " List<X> lx = bar2(l1, l2);\r\n" + >- " ^^^^^^^^^^^^\n" + >- "Type safety: The expression of type List needs unchecked conversion to conform to List<X>\n" + >- "----------\n" + >- "7. WARNING in X.java (at line 17)\r\n" + >- " List<X> lx = bar2(l1, l2);\r\n" + >- " ^^\n" + >- "Type safety: The expression of type List needs unchecked conversion to conform to List<T>\n" + >+ "----------\n" + >+ "1. WARNING in X.java (at line 14)\n" + >+ " void foo(List l1, List<X> l2) {\n" + >+ " ^^^^\n" + >+ "List is a raw type. References to generic type List<E> should be parameterized\n" + >+ "----------\n" + >+ "2. WARNING in X.java (at line 15)\n" + >+ " X x = bar1(l1, l2);\n" + >+ " ^^^^^^^^^^^^\n" + >+ "Type safety: Unchecked invocation bar1(List, List<X>) of the generic method bar1(List<T>, List<T>) of type X\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 15)\n" + >+ " X x = bar1(l1, l2);\n" + >+ " ^^^^^^^^^^^^\n" + >+ "Type mismatch: cannot convert from Object to X\n" + >+ "----------\n" + >+ "4. WARNING in X.java (at line 15)\n" + >+ " X x = bar1(l1, l2);\n" + >+ " ^^\n" + >+ "Type safety: The expression of type List needs unchecked conversion to conform to List<X>\n" + >+ "----------\n" + >+ "5. WARNING in X.java (at line 17)\n" + >+ " List<X> lx = bar2(l1, l2);\n" + >+ " ^^^^^^^^^^^^\n" + >+ "Type safety: Unchecked invocation bar2(List, List<X>) of the generic method bar2(List<T>, List<T>) of type X\n" + >+ "----------\n" + >+ "6. WARNING in X.java (at line 17)\n" + >+ " List<X> lx = bar2(l1, l2);\n" + >+ " ^^^^^^^^^^^^\n" + >+ "Type safety: The expression of type List needs unchecked conversion to conform to List<X>\n" + >+ "----------\n" + >+ "7. WARNING in X.java (at line 17)\n" + >+ " List<X> lx = bar2(l1, l2);\n" + >+ " ^^\n" + >+ "Type safety: The expression of type List needs unchecked conversion to conform to List<X>\n" + > "----------\n", > JavacTestOptions.EclipseJustification.EclipseBug148061); > } >@@ -33063,41 +33124,41 @@ > " <U,V> Map<U,V> bar(List<U> lu, List<V> lv) { return null; }\n" + > "}\n", // ================= > }, >- "----------\n" + >- "1. WARNING in X.java (at line 4)\n" + >- " void foo1(List l, List<String> ls) {\n" + >- " ^^^^\n" + >- "List is a raw type. References to generic type List<E> should be parameterized\n" + >- "----------\n" + >- "2. WARNING in X.java (at line 5)\n" + >- " Set<Map.Entry<String,String>> mss1 = bar(l, ls).entrySet();\n" + >- " ^^^^^^^^^^\n" + >- "Type safety: Unchecked invocation bar(List, List) of the generic method bar(List<U>, List<V>) of type X\n" + >- "----------\n" + >- "3. WARNING in X.java (at line 5)\n" + >- " Set<Map.Entry<String,String>> mss1 = bar(l, ls).entrySet();\n" + >- " ^^^^^^^^^^^^^^^^^^^^^\n" + >- "Type safety: The expression of type Set needs unchecked conversion to conform to Set<Map.Entry<String,String>>\n" + >- "----------\n" + >- "4. WARNING in X.java (at line 5)\n" + >- " Set<Map.Entry<String,String>> mss1 = bar(l, ls).entrySet();\n" + >- " ^\n" + >- "Type safety: The expression of type List needs unchecked conversion to conform to List<U>\n" + >- "----------\n" + >- "5. WARNING in X.java (at line 6)\n" + >- " String s = bar(l, ls).entrySet();\n" + >- " ^^^^^^^^^^\n" + >- "Type safety: Unchecked invocation bar(List, List) of the generic method bar(List<U>, List<V>) of type X\n" + >- "----------\n" + >- "6. ERROR in X.java (at line 6)\n" + >- " String s = bar(l, ls).entrySet();\n" + >- " ^^^^^^^^^^^^^^^^^^^^^\n" + >- "Type mismatch: cannot convert from Set to String\n" + >- "----------\n" + >- "7. WARNING in X.java (at line 6)\n" + >- " String s = bar(l, ls).entrySet();\n" + >- " ^\n" + >- "Type safety: The expression of type List needs unchecked conversion to conform to List<U>\n" + >+ "----------\n" + >+ "1. WARNING in X.java (at line 4)\n" + >+ " void foo1(List l, List<String> ls) {\n" + >+ " ^^^^\n" + >+ "List is a raw type. References to generic type List<E> should be parameterized\n" + >+ "----------\n" + >+ "2. WARNING in X.java (at line 5)\n" + >+ " Set<Map.Entry<String,String>> mss1 = bar(l, ls).entrySet();\n" + >+ " ^^^^^^^^^^\n" + >+ "Type safety: Unchecked invocation bar(List, List<String>) of the generic method bar(List<U>, List<V>) of type X\n" + >+ "----------\n" + >+ "3. WARNING in X.java (at line 5)\n" + >+ " Set<Map.Entry<String,String>> mss1 = bar(l, ls).entrySet();\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type safety: The expression of type Set needs unchecked conversion to conform to Set<Map.Entry<String,String>>\n" + >+ "----------\n" + >+ "4. WARNING in X.java (at line 5)\n" + >+ " Set<Map.Entry<String,String>> mss1 = bar(l, ls).entrySet();\n" + >+ " ^\n" + >+ "Type safety: The expression of type List needs unchecked conversion to conform to List<Object>\n" + >+ "----------\n" + >+ "5. WARNING in X.java (at line 6)\n" + >+ " String s = bar(l, ls).entrySet();\n" + >+ " ^^^^^^^^^^\n" + >+ "Type safety: Unchecked invocation bar(List, List<String>) of the generic method bar(List<U>, List<V>) of type X\n" + >+ "----------\n" + >+ "6. ERROR in X.java (at line 6)\n" + >+ " String s = bar(l, ls).entrySet();\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type mismatch: cannot convert from Set to String\n" + >+ "----------\n" + >+ "7. WARNING in X.java (at line 6)\n" + >+ " String s = bar(l, ls).entrySet();\n" + >+ " ^\n" + >+ "Type safety: The expression of type List needs unchecked conversion to conform to List<Object>\n" + > "----------\n"); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=148061 - variation >@@ -33114,41 +33175,41 @@ > " <U,V> List<V> bar(List<U> lu, List<V> lv) { return null; }\n" + > "}\n", // ================= > }, >- "----------\n" + >- "1. WARNING in X.java (at line 3)\n" + >- " void foo1(List l, List<String> ls) {\n" + >- " ^^^^\n" + >- "List is a raw type. References to generic type List<E> should be parameterized\n" + >- "----------\n" + >- "2. WARNING in X.java (at line 4)\n" + >- " List<String> ls1 = bar(l, ls);\n" + >- " ^^^^^^^^^^\n" + >- "Type safety: Unchecked invocation bar(List, List) of the generic method bar(List<U>, List<V>) of type X\n" + >- "----------\n" + >- "3. WARNING in X.java (at line 4)\n" + >- " List<String> ls1 = bar(l, ls);\n" + >- " ^^^^^^^^^^\n" + >- "Type safety: The expression of type List needs unchecked conversion to conform to List<String>\n" + >- "----------\n" + >- "4. WARNING in X.java (at line 4)\n" + >- " List<String> ls1 = bar(l, ls);\n" + >- " ^\n" + >- "Type safety: The expression of type List needs unchecked conversion to conform to List<U>\n" + >- "----------\n" + >- "5. WARNING in X.java (at line 5)\n" + >- " String s = bar(l, ls);\n" + >- " ^^^^^^^^^^\n" + >- "Type safety: Unchecked invocation bar(List, List) of the generic method bar(List<U>, List<V>) of type X\n" + >- "----------\n" + >- "6. ERROR in X.java (at line 5)\n" + >- " String s = bar(l, ls);\n" + >- " ^^^^^^^^^^\n" + >- "Type mismatch: cannot convert from List to String\n" + >- "----------\n" + >- "7. WARNING in X.java (at line 5)\n" + >- " String s = bar(l, ls);\n" + >- " ^\n" + >- "Type safety: The expression of type List needs unchecked conversion to conform to List<U>\n" + >+ "----------\n" + >+ "1. WARNING in X.java (at line 3)\n" + >+ " void foo1(List l, List<String> ls) {\n" + >+ " ^^^^\n" + >+ "List is a raw type. References to generic type List<E> should be parameterized\n" + >+ "----------\n" + >+ "2. WARNING in X.java (at line 4)\n" + >+ " List<String> ls1 = bar(l, ls);\n" + >+ " ^^^^^^^^^^\n" + >+ "Type safety: Unchecked invocation bar(List, List<String>) of the generic method bar(List<U>, List<V>) of type X\n" + >+ "----------\n" + >+ "3. WARNING in X.java (at line 4)\n" + >+ " List<String> ls1 = bar(l, ls);\n" + >+ " ^^^^^^^^^^\n" + >+ "Type safety: The expression of type List needs unchecked conversion to conform to List<String>\n" + >+ "----------\n" + >+ "4. WARNING in X.java (at line 4)\n" + >+ " List<String> ls1 = bar(l, ls);\n" + >+ " ^\n" + >+ "Type safety: The expression of type List needs unchecked conversion to conform to List<Object>\n" + >+ "----------\n" + >+ "5. WARNING in X.java (at line 5)\n" + >+ " String s = bar(l, ls);\n" + >+ " ^^^^^^^^^^\n" + >+ "Type safety: Unchecked invocation bar(List, List<String>) of the generic method bar(List<U>, List<V>) of type X\n" + >+ "----------\n" + >+ "6. ERROR in X.java (at line 5)\n" + >+ " String s = bar(l, ls);\n" + >+ " ^^^^^^^^^^\n" + >+ "Type mismatch: cannot convert from List to String\n" + >+ "----------\n" + >+ "7. WARNING in X.java (at line 5)\n" + >+ " String s = bar(l, ls);\n" + >+ " ^\n" + >+ "Type safety: The expression of type List needs unchecked conversion to conform to List<Object>\n" + > "----------\n"); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=148061 - variation >@@ -33926,16 +33987,21 @@ > "}", // ================= > > }, >- "----------\n" + >- "1. WARNING in ComparableComparator.java (at line 14)\n" + >- " static <M extends String> Comparator<M> baz() {\n" + >- " ^^^^^^\n" + >- "The type parameter M should not be bounded by the final type String. Final types cannot be further extended\n" + >- "----------\n" + >- "2. ERROR in ComparableComparator.java (at line 27)\n" + >- " static Object BAR2 = ComparableComparator.bar();//1a\n" + >- " ^^^\n" + >- "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" + >+ "----------\n" + >+ "1. WARNING in ComparableComparator.java (at line 14)\n" + >+ " static <M extends String> Comparator<M> baz() {\n" + >+ " ^^^^^^\n" + >+ "The type parameter M should not be bounded by the final type String. Final types cannot be further extended\n" + >+ "----------\n" + >+ "2. ERROR in ComparableComparator.java (at line 25)\n" + >+ " static Comparator BAR = ComparableComparator.bar();//0\n" + >+ " ^^^\n" + >+ "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" + >+ "----------\n" + >+ "3. ERROR in ComparableComparator.java (at line 27)\n" + >+ " static Object BAR2 = ComparableComparator.bar();//1a\n" + >+ " ^^^\n" + >+ "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" + > "----------\n"); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=158548 >@@ -44592,7 +44658,7 @@ > "----------\n"); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=231094 >-public void _test1322() { >+public void test1322() { > this.runNegativeTest( > new String[] { > "X.java", // ================= >@@ -44620,35 +44686,35 @@ > "class Bob2 extends Bob {}\n" + > "class Thingy<T extends Bob> {}\n", // ================= > }, >- "----------\n" + >- "1. WARNING in X.java (at line 6)\n" + >- " x.doStuff(Bob.class, new Thingy());\n" + >- " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >- "Type safety: Unchecked invocation doStuff(Class, Thingy) of the generic method doStuff(Class<T>, Thingy<T>) of type X\n" + >- "----------\n" + >- "2. WARNING in X.java (at line 6)\n" + >- " x.doStuff(Bob.class, new Thingy());\n" + >- " ^^^^^^^^^^^^\n" + >- "Type safety: The expression of type Thingy needs unchecked conversion to conform to Thingy<T>\n" + >- "----------\n" + >- "3. WARNING in X.java (at line 6)\n" + >- " x.doStuff(Bob.class, new Thingy());\n" + >- " ^^^^^^\n" + >- "Thingy is a raw type. References to generic type Thingy<T> should be parameterized\n" + >- "----------\n" + >- "4. ERROR in X.java (at line 15)\n" + >- " x.doStuff(Jim.class, new Thingy());\n" + >- " ^^^^^^^\n" + >- "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" + >- "----------\n" + >- "5. WARNING in X.java (at line 15)\n" + >- " x.doStuff(Jim.class, new Thingy());\n" + >- " ^^^^^^\n" + >- "Thingy is a raw type. References to generic type Thingy<T> should be parameterized\n" + >+ "----------\n" + >+ "1. WARNING in X.java (at line 6)\n" + >+ " x.doStuff(Bob.class, new Thingy());\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type safety: Unchecked invocation doStuff(Class<Bob>, Thingy) of the generic method doStuff(Class<T>, Thingy<T>) of type X\n" + >+ "----------\n" + >+ "2. WARNING in X.java (at line 6)\n" + >+ " x.doStuff(Bob.class, new Thingy());\n" + >+ " ^^^^^^^^^^^^\n" + >+ "Type safety: The expression of type Thingy needs unchecked conversion to conform to Thingy<Bob>\n" + >+ "----------\n" + >+ "3. WARNING in X.java (at line 6)\n" + >+ " x.doStuff(Bob.class, new Thingy());\n" + >+ " ^^^^^^\n" + >+ "Thingy is a raw type. References to generic type Thingy<T> should be parameterized\n" + >+ "----------\n" + >+ "4. ERROR in X.java (at line 15)\n" + >+ " x.doStuff(Jim.class, new Thingy());\n" + >+ " ^^^^^^^\n" + >+ "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" + >+ "----------\n" + >+ "5. WARNING in X.java (at line 15)\n" + >+ " x.doStuff(Jim.class, new Thingy());\n" + >+ " ^^^^^^\n" + >+ "Thingy is a raw type. References to generic type Thingy<T> should be parameterized\n" + > "----------\n"); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=231094 - variation >-public void _test1323() { >+public void test1323() { > this.runNegativeTest( > new String[] { > "X.java", // ================= >@@ -44665,40 +44731,40 @@ > "class Bob2 extends Bob {}\n" + > "class Thingy<T extends Bob> {}\n", // ================= > }, >- "----------\n" + >- "1. ERROR in X.java (at line 4)\n" + >- " x.doStuff2(Jim.class, new Thingy());\n" + >- " ^^^^^^^^\n" + >- "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" + >- "----------\n" + >- "2. WARNING in X.java (at line 4)\n" + >- " x.doStuff2(Jim.class, new Thingy());\n" + >- " ^^^^^^\n" + >- "Thingy is a raw type. References to generic type Thingy<T> should be parameterized\n" + >- "----------\n" + >- "3. WARNING in X.java (at line 5)\n" + >- " String s = x.doStuff2(Bob2.class, new Thingy());\n" + >- " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >- "Type safety: Unchecked invocation doStuff2(Class<Bob2>, Thingy<Bob>) of the generic method doStuff2(Class<T>, Thingy<U>) of type X\n" + >- "----------\n" + >- "4. ERROR in X.java (at line 5)\n" + >- " String s = x.doStuff2(Bob2.class, new Thingy());\n" + >- " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >- "Type mismatch: cannot convert from Bob2 to String\n" + >- "----------\n" + >- "5. WARNING in X.java (at line 5)\n" + >- " String s = x.doStuff2(Bob2.class, new Thingy());\n" + >- " ^^^^^^^^^^^^\n" + >- "Type safety: The expression of type Thingy needs unchecked conversion to conform to Thingy<U>\n" + >- "----------\n" + >- "6. WARNING in X.java (at line 5)\n" + >- " String s = x.doStuff2(Bob2.class, new Thingy());\n" + >- " ^^^^^^\n" + >- "Thingy is a raw type. References to generic type Thingy<T> should be parameterized\n" + >+ "----------\n" + >+ "1. ERROR in X.java (at line 4)\n" + >+ " x.doStuff2(Jim.class, new Thingy());\n" + >+ " ^^^^^^^^\n" + >+ "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" + >+ "----------\n" + >+ "2. WARNING in X.java (at line 4)\n" + >+ " x.doStuff2(Jim.class, new Thingy());\n" + >+ " ^^^^^^\n" + >+ "Thingy is a raw type. References to generic type Thingy<T> should be parameterized\n" + >+ "----------\n" + >+ "3. WARNING in X.java (at line 5)\n" + >+ " String s = x.doStuff2(Bob2.class, new Thingy());\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type safety: Unchecked invocation doStuff2(Class<Bob2>, Thingy) of the generic method doStuff2(Class<T>, Thingy<U>) of type X\n" + >+ "----------\n" + >+ "4. ERROR in X.java (at line 5)\n" + >+ " String s = x.doStuff2(Bob2.class, new Thingy());\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type mismatch: cannot convert from Bob to String\n" + >+ "----------\n" + >+ "5. WARNING in X.java (at line 5)\n" + >+ " String s = x.doStuff2(Bob2.class, new Thingy());\n" + >+ " ^^^^^^^^^^^^\n" + >+ "Type safety: The expression of type Thingy needs unchecked conversion to conform to Thingy<Bob>\n" + >+ "----------\n" + >+ "6. WARNING in X.java (at line 5)\n" + >+ " String s = x.doStuff2(Bob2.class, new Thingy());\n" + >+ " ^^^^^^\n" + >+ "Thingy is a raw type. References to generic type Thingy<T> should be parameterized\n" + > "----------\n"); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=231094 - variation >-public void _test1324() { >+public void test1324() { > this.runNegativeTest( > new String[] { > "X.java", // ================= >@@ -44717,26 +44783,26 @@ > "class Bob {}\n" + > "class Thingy<T extends Bob> {}\n", // ================= > }, >- "----------\n" + >- "1. WARNING in X.java (at line 6)\n" + >- " x.doStuff(Bob.class, new Thingy());\n" + >- " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >- "Type safety: Unchecked invocation doStuff(Class<Bob>, Thingy<Bob>) of the generic method doStuff(Class<T>, Thingy<T>) of type X\n" + >- "----------\n" + >- "2. WARNING in X.java (at line 6)\n" + >- " x.doStuff(Bob.class, new Thingy());\n" + >- " ^^^^^^^^^^^^\n" + >- "Type safety: The expression of type Thingy needs unchecked conversion to conform to Thingy<T>\n" + >- "----------\n" + >- "3. WARNING in X.java (at line 6)\n" + >- " x.doStuff(Bob.class, new Thingy());\n" + >- " ^^^^^^\n" + >- "Thingy is a raw type. References to generic type Thingy<T> should be parameterized\n" + >- "----------\n" + >- "4. ERROR in X.java (at line 8)\n" + >- " Zork z;\n" + >- " ^^^^\n" + >- "Zork cannot be resolved to a type\n" + >+ "----------\n" + >+ "1. WARNING in X.java (at line 6)\n" + >+ " x.doStuff(Bob.class, new Thingy());\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type safety: Unchecked invocation doStuff(Class<Bob>, Thingy) of the generic method doStuff(Class<T>, Thingy<T>) of type X\n" + >+ "----------\n" + >+ "2. WARNING in X.java (at line 6)\n" + >+ " x.doStuff(Bob.class, new Thingy());\n" + >+ " ^^^^^^^^^^^^\n" + >+ "Type safety: The expression of type Thingy needs unchecked conversion to conform to Thingy<Bob>\n" + >+ "----------\n" + >+ "3. WARNING in X.java (at line 6)\n" + >+ " x.doStuff(Bob.class, new Thingy());\n" + >+ " ^^^^^^\n" + >+ "Thingy is a raw type. References to generic type Thingy<T> should be parameterized\n" + >+ "----------\n" + >+ "4. ERROR in X.java (at line 8)\n" + >+ " Zork z;\n" + >+ " ^^^^\n" + >+ "Zork cannot be resolved to a type\n" + > "----------\n"); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=231094 - variation >@@ -44753,30 +44819,30 @@ > " }\n" + > "}\n", // ================= > }, >- "----------\n" + >- "1. WARNING in X.java (at line 5)\n" + >- " void bar(X x) {\n" + >- " ^\n" + >- "X is a raw type. References to generic type X<E> should be parameterized\n" + >- "----------\n" + >- "2. WARNING in X.java (at line 6)\n" + >- " X<String> xs2 = foo(x);\n" + >- " ^^^^^^\n" + >- "Type safety: Unchecked invocation foo(X) of the generic method foo(X<T>) of type X<E>\n" + >- "----------\n" + >- "3. ERROR in X.java (at line 6)\n" + >- " X<String> xs2 = foo(x);\n" + >- " ^^^^^^\n" + >- "Type mismatch: cannot convert from Object to X<String>\n" + >- "----------\n" + >- "4. WARNING in X.java (at line 6)\n" + >- " X<String> xs2 = foo(x);\n" + >- " ^\n" + >- "Type safety: The expression of type X needs unchecked conversion to conform to X<T>\n" + >+ "----------\n" + >+ "1. WARNING in X.java (at line 5)\n" + >+ " void bar(X x) {\n" + >+ " ^\n" + >+ "X is a raw type. References to generic type X<E> should be parameterized\n" + >+ "----------\n" + >+ "2. WARNING in X.java (at line 6)\n" + >+ " X<String> xs2 = foo(x);\n" + >+ " ^^^^^^\n" + >+ "Type safety: Unchecked invocation foo(X) of the generic method foo(X<T>) of type X<E>\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 6)\n" + >+ " X<String> xs2 = foo(x);\n" + >+ " ^^^^^^\n" + >+ "Type mismatch: cannot convert from Object to X<String>\n" + >+ "----------\n" + >+ "4. WARNING in X.java (at line 6)\n" + >+ " X<String> xs2 = foo(x);\n" + >+ " ^\n" + >+ "Type safety: The expression of type X needs unchecked conversion to conform to X<Object>\n" + > "----------\n"); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=231094 - variation >-public void _test1326() { >+public void test1326() { > this.runNegativeTest( > new String[] { > "X.java", // ================= >@@ -44830,7 +44896,7 @@ > "2. WARNING in X.java (at line 9)\n" + > " X<String> xs2 = foo(x, xs).identity();\n" + > " ^^^^^^^^^^\n" + >- "Type safety: Unchecked invocation foo(X, X) of the generic method foo(X<T>, X<U>) of type X<E>\n" + >+ "Type safety: Unchecked invocation foo(X, X<String>) of the generic method foo(X<T>, X<U>) of type X<E>\n" + > "----------\n" + > "3. WARNING in X.java (at line 9)\n" + > " X<String> xs2 = foo(x, xs).identity();\n" + >@@ -44840,7 +44906,7 @@ > "4. WARNING in X.java (at line 9)\n" + > " X<String> xs2 = foo(x, xs).identity();\n" + > " ^\n" + >- "Type safety: The expression of type X needs unchecked conversion to conform to X<T>\n" + >+ "Type safety: The expression of type X needs unchecked conversion to conform to X<Object>\n" + > "----------\n"); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=231094 - variation >@@ -45617,31 +45683,41 @@ > "class Y<S> {}\n" + > "class Z { Zork z; }\n", // ================= > }, >- "----------\n" + >- "1. WARNING in Scratch.java (at line 2)\n" + >- " private Y rawObject = new Y();\n" + >- " ^\n" + >- "Y is a raw type. References to generic type Y<S> should be parameterized\n" + >- "----------\n" + >- "2. WARNING in Scratch.java (at line 2)\n" + >- " private Y rawObject = new Y();\n" + >- " ^\n" + >- "Y is a raw type. References to generic type Y<S> should be parameterized\n" + >- "----------\n" + >- "3. WARNING in Scratch.java (at line 4)\n" + >- " method(new X<Y<Z>>(), rawObject); // compile error in javac, unchecked conversion in Eclipse\n" + >- " ^^^^^^^^^\n" + >- "Type safety: The expression of type Y needs unchecked conversion to conform to Y<Z>\n" + >- "----------\n" + >- "4. WARNING in Scratch.java (at line 5)\n" + >- " this.<Y<Z>>method(new X<Y<Z>>(), rawObject); // unchecked warning in both\n" + >- " ^^^^^^^^^\n" + >- "Type safety: The expression of type Y needs unchecked conversion to conform to Y<Z>\n" + >- "----------\n" + >- "5. ERROR in Scratch.java (at line 11)\n" + >- " class Z { Zork z; }\n" + >- " ^^^^\n" + >- "Zork cannot be resolved to a type\n" + >+ "----------\n" + >+ "1. WARNING in Scratch.java (at line 2)\n" + >+ " private Y rawObject = new Y();\n" + >+ " ^\n" + >+ "Y is a raw type. References to generic type Y<S> should be parameterized\n" + >+ "----------\n" + >+ "2. WARNING in Scratch.java (at line 2)\n" + >+ " private Y rawObject = new Y();\n" + >+ " ^\n" + >+ "Y is a raw type. References to generic type Y<S> should be parameterized\n" + >+ "----------\n" + >+ "3. WARNING in Scratch.java (at line 4)\n" + >+ " method(new X<Y<Z>>(), rawObject); // compile error in javac, unchecked conversion in Eclipse\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type safety: Unchecked invocation method(X<Y<Z>>, Y) of the generic method method(X<T>, T) of type Scratch\n" + >+ "----------\n" + >+ "4. WARNING in Scratch.java (at line 4)\n" + >+ " method(new X<Y<Z>>(), rawObject); // compile error in javac, unchecked conversion in Eclipse\n" + >+ " ^^^^^^^^^\n" + >+ "Type safety: The expression of type Y needs unchecked conversion to conform to Y<Z>\n" + >+ "----------\n" + >+ "5. WARNING in Scratch.java (at line 5)\n" + >+ " this.<Y<Z>>method(new X<Y<Z>>(), rawObject); // unchecked warning in both\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type safety: Unchecked invocation method(X<Y<Z>>, Y) of the generic method method(X<T>, T) of type Scratch\n" + >+ "----------\n" + >+ "6. WARNING in Scratch.java (at line 5)\n" + >+ " this.<Y<Z>>method(new X<Y<Z>>(), rawObject); // unchecked warning in both\n" + >+ " ^^^^^^^^^\n" + >+ "Type safety: The expression of type Y needs unchecked conversion to conform to Y<Z>\n" + >+ "----------\n" + >+ "7. ERROR in Scratch.java (at line 11)\n" + >+ " class Z { Zork z; }\n" + >+ " ^^^^\n" + >+ "Zork cannot be resolved to a type\n" + > "----------\n"); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=238484 >@@ -47636,7 +47712,7 @@ > "----------\n"); > } > public void test1406() { >- this.runConformTest( >+ this.runNegativeTest( > new String[] { > "GenericTest.java", //----------------------------------------------------------------------- > "import java.util.*;\n" + >@@ -47651,7 +47727,32 @@ > " }\n" + > "}\n",//----------------------------------------------------------------------- > }, >- ""); >+ "----------\n" + >+ "1. WARNING in GenericTest.java (at line 5)\n" + >+ " Set testList = GenericTest.method1(new Class[] { ArrayList.class });\n" + >+ " ^^^\n" + >+ "Set is a raw type. References to generic type Set<E> should be parameterized\n" + >+ "----------\n" + >+ "2. WARNING in GenericTest.java (at line 5)\n" + >+ " Set testList = GenericTest.method1(new Class[] { ArrayList.class });\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type safety: Unchecked invocation method1(Class[]) of the generic method method1(Class<List>[]) of type GenericTest\n" + >+ "----------\n" + >+ "3. ERROR in GenericTest.java (at line 5)\n" + >+ " Set testList = GenericTest.method1(new Class[] { ArrayList.class });\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type mismatch: cannot convert from Object to Set\n" + >+ "----------\n" + >+ "4. WARNING in GenericTest.java (at line 5)\n" + >+ " Set testList = GenericTest.method1(new Class[] { ArrayList.class });\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type safety: The expression of type Class[] needs unchecked conversion to conform to Class<List>[]\n" + >+ "----------\n" + >+ "5. WARNING in GenericTest.java (at line 8)\n" + >+ " public static <I> I method1(Class<List>[] params) {\n" + >+ " ^^^^\n" + >+ "List is a raw type. References to generic type List<E> should be parameterized\n" + >+ "----------\n"); > } > public void test1407() { > this.runNegativeTest( >@@ -47659,41 +47760,29 @@ > "Foo.java", //----------------------------------------------------------------------- > "public class Foo {\n" + > " public static <I> I m1(Class<Foo> c) { return null; }\n" + >- " public static <I> I m2(Class<I> c) { return null; } \n" + > " void bar() {\n" + >- " Foo l1 = m1((Class)Foo.class); //ok - unchecked conversion from Class to Class<Foo> - I inferred to be Foo\n" + >- " Foo l2 = m2((Class)Foo.class); //unchecked call, erased return type and error because Object != Foo \n" + >+ " Foo l1 = m1((Class)Foo.class);\n" + > " }\n" + > "}\n",//----------------------------------------------------------------------- > }, > "----------\n" + >- "1. WARNING in Foo.java (at line 5)\n" + >- " Foo l1 = m1((Class)Foo.class); //ok - unchecked conversion from Class to Class<Foo> - I inferred to be Foo\n" + >- " ^^^^^^^^^^^^^^^^\n" + >- "Type safety: The expression of type Class needs unchecked conversion to conform to Class<Foo>\n" + >- "----------\n" + >- "2. WARNING in Foo.java (at line 5)\n" + >- " Foo l1 = m1((Class)Foo.class); //ok - unchecked conversion from Class to Class<Foo> - I inferred to be Foo\n" + >- " ^^^^^\n" + >- "Class is a raw type. References to generic type Class<T> should be parameterized\n" + >- "----------\n" + >- "3. WARNING in Foo.java (at line 6)\n" + >- " Foo l2 = m2((Class)Foo.class); //unchecked call, erased return type and error because Object != Foo \n" + >+ "1. WARNING in Foo.java (at line 4)\n" + >+ " Foo l1 = m1((Class)Foo.class);\n" + > " ^^^^^^^^^^^^^^^^^^^^\n" + >- "Type safety: Unchecked invocation m2(Class) of the generic method m2(Class<I>) of type Foo\n" + >+ "Type safety: Unchecked invocation m1(Class) of the generic method m1(Class<Foo>) of type Foo\n" + > "----------\n" + >- "4. ERROR in Foo.java (at line 6)\n" + >- " Foo l2 = m2((Class)Foo.class); //unchecked call, erased return type and error because Object != Foo \n" + >+ "2. ERROR in Foo.java (at line 4)\n" + >+ " Foo l1 = m1((Class)Foo.class);\n" + > " ^^^^^^^^^^^^^^^^^^^^\n" + > "Type mismatch: cannot convert from Object to Foo\n" + > "----------\n" + >- "5. WARNING in Foo.java (at line 6)\n" + >- " Foo l2 = m2((Class)Foo.class); //unchecked call, erased return type and error because Object != Foo \n" + >+ "3. WARNING in Foo.java (at line 4)\n" + >+ " Foo l1 = m1((Class)Foo.class);\n" + > " ^^^^^^^^^^^^^^^^\n" + >- "Type safety: The expression of type Class needs unchecked conversion to conform to Class<I>\n" + >+ "Type safety: The expression of type Class needs unchecked conversion to conform to Class<Foo>\n" + > "----------\n" + >- "6. WARNING in Foo.java (at line 6)\n" + >- " Foo l2 = m2((Class)Foo.class); //unchecked call, erased return type and error because Object != Foo \n" + >+ "4. WARNING in Foo.java (at line 4)\n" + >+ " Foo l1 = m1((Class)Foo.class);\n" + > " ^^^^^\n" + > "Class is a raw type. References to generic type Class<T> should be parameterized\n" + > "----------\n"); >@@ -48344,58 +48433,70 @@ > }, > ""); > } >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=258798 > public void test1429() { > this.runNegativeTest( > new String[] { > "X.java", //----------------------------------------------------------------------- > "class Foo<T> {}\n" + > "public class X {\n" + >- " public void test() {\n" + >- " m(new Foo<Foo<Integer>>(), new Foo());\n" + >- " }\n" + >- " public <T> void m(Foo<T> x, T t) {}\n" + >+ " public void test() {\n" + >+ " Integer i = m(new Foo<Foo<Integer>>(), new Foo());\n" + >+ " }\n" + >+ " public <T> T m(Foo<T> x, T t) {\n" + >+ " return t;\n" + >+ " }\n" + > "}\n",//----------------------------------------------------------------------- > }, > "----------\n" + > "1. WARNING in X.java (at line 4)\n" + >- " m(new Foo<Foo<Integer>>(), new Foo());\n" + >- " ^^^^^^^^^\n" + >+ " Integer i = m(new Foo<Foo<Integer>>(), new Foo());\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type safety: Unchecked invocation m(Foo<Foo<Integer>>, Foo) of the generic method m(Foo<T>, T) of type X\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 4)\n" + >+ " Integer i = m(new Foo<Foo<Integer>>(), new Foo());\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type mismatch: cannot convert from Object to Integer\n" + >+ "----------\n" + >+ "3. WARNING in X.java (at line 4)\n" + >+ " Integer i = m(new Foo<Foo<Integer>>(), new Foo());\n" + >+ " ^^^^^^^^^\n" + > "Type safety: The expression of type Foo needs unchecked conversion to conform to Foo<Integer>\n" + > "----------\n" + >- "2. WARNING in X.java (at line 4)\n" + >- " m(new Foo<Foo<Integer>>(), new Foo());\n" + >- " ^^^\n" + >+ "4. WARNING in X.java (at line 4)\n" + >+ " Integer i = m(new Foo<Foo<Integer>>(), new Foo());\n" + >+ " ^^^\n" + > "Foo is a raw type. References to generic type Foo<T> should be parameterized\n" + > "----------\n"); > } >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=258798 - variation > public void test1430() { > this.runNegativeTest( > new String[] { > "X.java", //----------------------------------------------------------------------- > "class Foo<T> {}\n" + > "public class X {\n" + >- " public void test() {\n" + >- " Integer i = m(new Foo<Foo<Integer>>(), new Foo());\n" + >- " }\n" + >- " public <T> T m(Foo<T> x, T t) {\n" + >- " return t;\n" + >- " }\n" + >+ " public void test() {\n" + >+ " m(new Foo<Foo<Integer>>(), new Foo());\n" + >+ " }\n" + >+ " public <T> void m(Foo<T> x, T t) {}\n" + > "}\n",//----------------------------------------------------------------------- > }, > "----------\n" + >- "1. ERROR in X.java (at line 4)\n" + >- " Integer i = m(new Foo<Foo<Integer>>(), new Foo());\n" + >- " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >- "Type mismatch: cannot convert from Foo<Integer> to Integer\n" + >+ "1. WARNING in X.java (at line 4)\n" + >+ " m(new Foo<Foo<Integer>>(), new Foo());\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type safety: Unchecked invocation m(Foo<Foo<Integer>>, Foo) of the generic method m(Foo<T>, T) of type X\n" + > "----------\n" + > "2. WARNING in X.java (at line 4)\n" + >- " Integer i = m(new Foo<Foo<Integer>>(), new Foo());\n" + >- " ^^^^^^^^^\n" + >+ " m(new Foo<Foo<Integer>>(), new Foo());\n" + >+ " ^^^^^^^^^\n" + > "Type safety: The expression of type Foo needs unchecked conversion to conform to Foo<Integer>\n" + > "----------\n" + > "3. WARNING in X.java (at line 4)\n" + >- " Integer i = m(new Foo<Foo<Integer>>(), new Foo());\n" + >- " ^^^\n" + >+ " m(new Foo<Foo<Integer>>(), new Foo());\n" + >+ " ^^^\n" + > "Foo is a raw type. References to generic type Foo<T> should be parameterized\n" + > "----------\n"); > } >@@ -48439,4 +48540,319 @@ > "----------\n" > ); > } >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=258798 - variation >+public void test1432() { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", //----------------------------------------------------------------------- >+ "class Foo<T> {\n" + >+ " T bar(Foo<T> ft, T t) {\n" + >+ " return t;\n" + >+ " }\n" + >+ "}\n" + >+ "public class X {\n" + >+ " public void test() {\n" + >+ " Foo<Foo<Integer>> ffi = new Foo<Foo<Integer>>();\n" + >+ " Integer j = ffi.bar(ffi, new Foo());\n" + >+ " }\n" + >+ "}\n",//----------------------------------------------------------------------- >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 9)\n" + >+ " Integer j = ffi.bar(ffi, new Foo());\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type mismatch: cannot convert from Foo<Integer> to Integer\n" + >+ "----------\n" + >+ "2. WARNING in X.java (at line 9)\n" + >+ " Integer j = ffi.bar(ffi, new Foo());\n" + >+ " ^^^^^^^^^\n" + >+ "Type safety: The expression of type Foo needs unchecked conversion to conform to Foo<Integer>\n" + >+ "----------\n" + >+ "3. WARNING in X.java (at line 9)\n" + >+ " Integer j = ffi.bar(ffi, new Foo());\n" + >+ " ^^^\n" + >+ "Foo is a raw type. References to generic type Foo<T> should be parameterized\n" + >+ "----------\n"); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=258798 - variation >+public void test1433() { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", //----------------------------------------------------------------------- >+ "import java.util.*;\n" + >+ "public class X<T> {\n" + >+ " Zork z;\n" + >+ " <U> void foo(X<U> xu) {}\n" + >+ " void bar(X x) {\n" + >+ " foo(x);\n" + >+ " }\n" + >+ "}\n",//----------------------------------------------------------------------- >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 3)\n" + >+ " Zork z;\n" + >+ " ^^^^\n" + >+ "Zork cannot be resolved to a type\n" + >+ "----------\n" + >+ "2. WARNING in X.java (at line 5)\n" + >+ " void bar(X x) {\n" + >+ " ^\n" + >+ "X is a raw type. References to generic type X<T> should be parameterized\n" + >+ "----------\n" + >+ "3. WARNING in X.java (at line 6)\n" + >+ " foo(x);\n" + >+ " ^^^^^^\n" + >+ "Type safety: Unchecked invocation foo(X) of the generic method foo(X<U>) of type X<T>\n" + >+ "----------\n" + >+ "4. WARNING in X.java (at line 6)\n" + >+ " foo(x);\n" + >+ " ^\n" + >+ "Type safety: The expression of type X needs unchecked conversion to conform to X<Object>\n" + >+ "----------\n"); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=258798 - variation >+public void test1434() { >+ this.runNegativeTest( >+ new String[] { >+ "Foo.java", //----------------------------------------------------------------------- >+ "public class Foo {\n" + >+ " public static <I> I m2(Class<I> c) { return null; } \n" + >+ " void bar() {\n" + >+ " Foo l2 = m2((Class)Foo.class);\n" + >+ " }\n" + >+ "}\n",//----------------------------------------------------------------------- >+ }, >+ "----------\n" + >+ "1. WARNING in Foo.java (at line 4)\n" + >+ " Foo l2 = m2((Class)Foo.class);\n" + >+ " ^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type safety: Unchecked invocation m2(Class) of the generic method m2(Class<I>) of type Foo\n" + >+ "----------\n" + >+ "2. ERROR in Foo.java (at line 4)\n" + >+ " Foo l2 = m2((Class)Foo.class);\n" + >+ " ^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type mismatch: cannot convert from Object to Foo\n" + >+ "----------\n" + >+ "3. WARNING in Foo.java (at line 4)\n" + >+ " Foo l2 = m2((Class)Foo.class);\n" + >+ " ^^^^^^^^^^^^^^^^\n" + >+ "Type safety: The expression of type Class needs unchecked conversion to conform to Class<Foo>\n" + >+ "----------\n" + >+ "4. WARNING in Foo.java (at line 4)\n" + >+ " Foo l2 = m2((Class)Foo.class);\n" + >+ " ^^^^^^^^^^^^^^^^\n" + >+ "Unnecessary cast from Class<Foo> to Class\n" + >+ "----------\n" + >+ "5. WARNING in Foo.java (at line 4)\n" + >+ " Foo l2 = m2((Class)Foo.class);\n" + >+ " ^^^^^\n" + >+ "Class is a raw type. References to generic type Class<T> should be parameterized\n" + >+ "----------\n"); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=258798 - variation >+public void test1435() { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", //----------------------------------------------------------------------- >+ "public class X {\n" + >+ " <T extends Comparable<T>> T min(T x, T y) { return x; }\n" + >+ " \n" + >+ " void foo(Foo f, Bar b) {\n" + >+ " min(f, f);\n" + >+ " min(b, b);\n" + >+ " }\n" + >+ "}\n" + >+ "abstract class Foo implements Comparable<Foo> {\n" + >+ "}\n" + >+ "abstract class Bar extends Foo {}\n",//----------------------------------------------------------------------- >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 6)\n" + >+ " min(b, b);\n" + >+ " ^^^\n" + >+ "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" + >+ "----------\n"); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=258798 - variation >+public void test1436() { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", //----------------------------------------------------------------------- >+ "import java.util.*;\n" + >+ "public class X {\n" + >+ " <U extends List<?>, T extends Throwable> void foo(List<U> lu, T t) throws T {\n" + >+ " if (lu.isEmpty()) throw t;\n" + >+ " }\n" + >+ " void bar(List l, IllegalArgumentException iae) {\n" + >+ " try {\n" + >+ " foo(l, iae);\n" + >+ " } catch (IllegalArgumentException e) {\n" + >+ " }\n" + >+ " }\n" + >+ "}\n",//----------------------------------------------------------------------- >+ }, >+ "----------\n" + >+ "1. WARNING in X.java (at line 6)\n" + >+ " void bar(List l, IllegalArgumentException iae) {\n" + >+ " ^^^^\n" + >+ "List is a raw type. References to generic type List<E> should be parameterized\n" + >+ "----------\n" + >+ "2. WARNING in X.java (at line 8)\n" + >+ " foo(l, iae);\n" + >+ " ^^^^^^^^^^^\n" + >+ "Type safety: Unchecked invocation foo(List, IllegalArgumentException) of the generic method foo(List<U>, T) of type X\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 8)\n" + >+ " foo(l, iae);\n" + >+ " ^^^^^^^^^^^\n" + >+ "Unhandled exception type Throwable\n" + >+ "----------\n" + >+ "4. WARNING in X.java (at line 8)\n" + >+ " foo(l, iae);\n" + >+ " ^\n" + >+ "Type safety: The expression of type List needs unchecked conversion to conform to List<List<?>>\n" + >+ "----------\n"); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=258798 - variation >+public void test1437() { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", //----------------------------------------------------------------------- >+ "import java.util.*;\n" + >+ "public class X {\n" + >+ " <U extends List<?>, T extends Throwable> X(List<U> lu, T t) throws T {\n" + >+ " if (lu.isEmpty()) throw t;\n" + >+ " }\n" + >+ " void bar(List l, IllegalArgumentException iae) {\n" + >+ " try {\n" + >+ " new X(l, iae);\n" + >+ " } catch (IllegalArgumentException e) {\n" + >+ " }\n" + >+ " }\n" + >+ "}\n",//----------------------------------------------------------------------- >+ }, >+ "----------\n" + >+ "1. WARNING in X.java (at line 6)\n" + >+ " void bar(List l, IllegalArgumentException iae) {\n" + >+ " ^^^^\n" + >+ "List is a raw type. References to generic type List<E> should be parameterized\n" + >+ "----------\n" + >+ "2. WARNING in X.java (at line 8)\n" + >+ " new X(l, iae);\n" + >+ " ^^^^^^^^^^^^^\n" + >+ "Type safety: Unchecked invocation X(List, IllegalArgumentException) of the generic constructor X(List<U>, T) of type X\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 8)\n" + >+ " new X(l, iae);\n" + >+ " ^^^^^^^^^^^^^\n" + >+ "Unhandled exception type Throwable\n" + >+ "----------\n" + >+ "4. WARNING in X.java (at line 8)\n" + >+ " new X(l, iae);\n" + >+ " ^\n" + >+ "Type safety: The expression of type List needs unchecked conversion to conform to List<List<?>>\n" + >+ "----------\n"); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=258798 - variation >+public void test1438() { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", //----------------------------------------------------------------------- >+ "import java.util.*;\n" + >+ "public class X {\n" + >+ " <U extends List<?>, T extends Throwable> X(List<U> lu, T t) throws T {\n" + >+ " if (lu.isEmpty()) throw t;\n" + >+ " }\n" + >+ " void bar(List l, IllegalArgumentException iae) {\n" + >+ " try {\n" + >+ " new X(l, iae){};\n" + >+ " } catch (IllegalArgumentException e) {\n" + >+ " }\n" + >+ " }\n" + >+ "}\n",//----------------------------------------------------------------------- >+ }, >+ "----------\n" + >+ "1. WARNING in X.java (at line 6)\n" + >+ " void bar(List l, IllegalArgumentException iae) {\n" + >+ " ^^^^\n" + >+ "List is a raw type. References to generic type List<E> should be parameterized\n" + >+ "----------\n" + >+ "2. WARNING in X.java (at line 8)\n" + >+ " new X(l, iae){};\n" + >+ " ^^^^^^^^^^^^^^^\n" + >+ "Type safety: Unchecked invocation X(List, IllegalArgumentException) of the generic constructor X(List<U>, T) of type X\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 8)\n" + >+ " new X(l, iae){};\n" + >+ " ^^^^^^^^^^^^^^^\n" + >+ "Unhandled exception type Throwable\n" + >+ "----------\n" + >+ "4. WARNING in X.java (at line 8)\n" + >+ " new X(l, iae){};\n" + >+ " ^\n" + >+ "Type safety: The expression of type List needs unchecked conversion to conform to List<List<?>>\n" + >+ "----------\n"); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=258798 - variation >+public void test1439() { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", //----------------------------------------------------------------------- >+ "import java.util.*;\n" + >+ "public class X {\n" + >+ " <U extends List<?>, T extends Throwable> X(List<U> lu, T t) throws T {\n" + >+ " if (lu.isEmpty()) throw t;\n" + >+ " }\n" + >+ " X() { \n" + >+ " this((List) null, null);\n" + >+ " }\n" + >+ "}\n" + >+ "class Y extends X {\n" + >+ " <U extends List<?>, T extends Throwable> Y(List<U> lu, T t) {\n" + >+ " super((List)lu, t);\n" + >+ " }\n" + >+ "}\n",//----------------------------------------------------------------------- >+ }, >+ "----------\n" + >+ "1. WARNING in X.java (at line 7)\n" + >+ " this((List) null, null);\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type safety: Unchecked invocation X(List, null) of the generic constructor X(List<U>, T) of type X\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 7)\n" + >+ " this((List) null, null);\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Unhandled exception type Throwable\n" + >+ "----------\n" + >+ "3. WARNING in X.java (at line 7)\n" + >+ " this((List) null, null);\n" + >+ " ^^^^^^^^^^^\n" + >+ "Type safety: The expression of type List needs unchecked conversion to conform to List<List<?>>\n" + >+ "----------\n" + >+ "4. WARNING in X.java (at line 7)\n" + >+ " this((List) null, null);\n" + >+ " ^^^^\n" + >+ "List is a raw type. References to generic type List<E> should be parameterized\n" + >+ "----------\n" + >+ "5. WARNING in X.java (at line 12)\n" + >+ " super((List)lu, t);\n" + >+ " ^^^^^^^^^^^^^^^^^^^\n" + >+ "Type safety: Unchecked invocation X(List, T) of the generic constructor X(List<U>, T) of type X\n" + >+ "----------\n" + >+ "6. ERROR in X.java (at line 12)\n" + >+ " super((List)lu, t);\n" + >+ " ^^^^^^^^^^^^^^^^^^^\n" + >+ "Unhandled exception type Throwable\n" + >+ "----------\n" + >+ "7. WARNING in X.java (at line 12)\n" + >+ " super((List)lu, t);\n" + >+ " ^^^^^^^^\n" + >+ "Type safety: The expression of type List needs unchecked conversion to conform to List<List<?>>\n" + >+ "----------\n" + >+ "8. WARNING in X.java (at line 12)\n" + >+ " super((List)lu, t);\n" + >+ " ^^^^\n" + >+ "List is a raw type. References to generic type List<E> should be parameterized\n" + >+ "----------\n"); >+} > } >\ No newline at end of file >Index: src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java,v >retrieving revision 1.172 >diff -u -r1.172 MethodVerifyTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java 21 Nov 2008 20:03:13 -0000 1.172 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java 8 Jan 2009 20:37:52 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -2981,22 +2981,27 @@ > " public static <T> void foo(List<T>... e) {}\n" + > "}\n" > }, >- "----------\n" + >- "1. WARNING in p\\X.java (at line 6)\n" + >- " public X() { foo(data.l); }\n" + >- " ^^^^^^^^^^^\n" + >- "Type safety: Unchecked invocation foo(List...) of the generic method foo(List<T>...) of type Z\n" + >- "----------\n" + >- "2. WARNING in p\\X.java (at line 6)\n" + >- " public X() { foo(data.l); }\n" + >- " ^^^^^^\n" + >- "Type safety: The expression of type List needs unchecked conversion to conform to List<T>\n" + >- "----------\n" + >- "----------\n" + >- "1. WARNING in p\\Y.java (at line 4)\n" + >- " List l = null;\n" + >- " ^^^^\n" + >- "List is a raw type. References to generic type List<E> should be parameterized\n" + >+ "----------\n" + >+ "1. WARNING in p\\X.java (at line 6)\n" + >+ " public X() { foo(data.l); }\n" + >+ " ^^^^^^^^^^^\n" + >+ "Type safety : A generic array of List<Object> is created for a varargs parameter\n" + >+ "----------\n" + >+ "2. WARNING in p\\X.java (at line 6)\n" + >+ " public X() { foo(data.l); }\n" + >+ " ^^^^^^^^^^^\n" + >+ "Type safety: Unchecked invocation foo(List) of the generic method foo(List<T>...) of type Z\n" + >+ "----------\n" + >+ "3. WARNING in p\\X.java (at line 6)\n" + >+ " public X() { foo(data.l); }\n" + >+ " ^^^^^^\n" + >+ "Type safety: The expression of type List needs unchecked conversion to conform to List<Object>\n" + >+ "----------\n" + >+ "----------\n" + >+ "1. WARNING in p\\Y.java (at line 4)\n" + >+ " List l = null;\n" + >+ " ^^^^\n" + >+ "List is a raw type. References to generic type List<E> should be parameterized\n" + > "----------\n" > // unchecked conversion warnings > ); >@@ -3021,22 +3026,27 @@ > " public static <T> void foo(List<T>... e) {}\n" + > "}\n" > }, >- "----------\n" + >- "1. WARNING in p\\X.java (at line 5)\n" + >- " public X() { foo(data.l); }\n" + >- " ^^^^^^^^^^^\n" + >- "Type safety: Unchecked invocation foo(List...) of the generic method foo(List<T>...) of type Y\n" + >- "----------\n" + >- "2. WARNING in p\\X.java (at line 5)\n" + >- " public X() { foo(data.l); }\n" + >- " ^^^^^^\n" + >- "Type safety: The expression of type List needs unchecked conversion to conform to List<T>\n" + >- "----------\n" + >- "----------\n" + >- "1. WARNING in p\\Y.java (at line 4)\n" + >- " List l = null;\n" + >- " ^^^^\n" + >- "List is a raw type. References to generic type List<E> should be parameterized\n" + >+ "----------\n" + >+ "1. WARNING in p\\X.java (at line 5)\n" + >+ " public X() { foo(data.l); }\n" + >+ " ^^^^^^^^^^^\n" + >+ "Type safety : A generic array of List<Object> is created for a varargs parameter\n" + >+ "----------\n" + >+ "2. WARNING in p\\X.java (at line 5)\n" + >+ " public X() { foo(data.l); }\n" + >+ " ^^^^^^^^^^^\n" + >+ "Type safety: Unchecked invocation foo(List) of the generic method foo(List<T>...) of type Y\n" + >+ "----------\n" + >+ "3. WARNING in p\\X.java (at line 5)\n" + >+ " public X() { foo(data.l); }\n" + >+ " ^^^^^^\n" + >+ "Type safety: The expression of type List needs unchecked conversion to conform to List<Object>\n" + >+ "----------\n" + >+ "----------\n" + >+ "1. WARNING in p\\Y.java (at line 4)\n" + >+ " List l = null;\n" + >+ " ^^^^\n" + >+ "List is a raw type. References to generic type List<E> should be parameterized\n" + > "----------\n" > // unchecked conversion warnings > ); >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/dom/BatchASTCreationTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/BatchASTCreationTests.java,v >retrieving revision 1.81 >diff -u -r1.81 BatchASTCreationTests.java >--- src/org/eclipse/jdt/core/tests/dom/BatchASTCreationTests.java 27 Jun 2008 16:02:37 -0000 1.81 >+++ src/org/eclipse/jdt/core/tests/dom/BatchASTCreationTests.java 8 Jan 2009 20:38:05 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2004, 2007 IBM Corporation and others. >+ * Copyright (c) 2004, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -1404,11 +1404,41 @@ > "class W<T> extends Z<T> {\n" + > "}", > }, >- "Lp1/X;.foo<T:Lp1/Y<-TT;>;>(Lp1/Z<TT;>;)V%<>" >+ "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;>;>;>" > ); > } > > /* >+ * Ensures that a raw method binding can be created using its key in batch creation. >+ * (regression test for bug 87749 different IMethodBindings of generic method have equal getKey()) >+ */ >+ public void test063a() throws CoreException { >+ assertRequestedBindingFound( >+ new String[] { >+ "/P/p1/X.java", >+ "package p1;\n" + >+ "public class X<U extends X<T>> {\n" + >+ " public void foo(Z<U> z) {\n" + >+ " }\n" + >+ " /**\n" + >+ " * @see #foo(Z)\n" + >+ " */\n" + >+ " static void bar(X x) {\n" + >+ " /*start*/x.foo(new W())/*end*/;\n" + >+ " }\n" + >+ "}\n" + >+ "class Y<T> {\n" + >+ "}\n" + >+ "class Z<T> {\n" + >+ "}\n" + >+ "class W<T> extends Z<T> {\n" + >+ "}", >+ }, >+ "Lp1/X<>;.foo(Lp1/Z;)V" >+ ); >+ } >+ >+ /* > * Ensures that a parameterized type binding with a capture binding in its arguments can be created using its key in batch creation. > * (regression test for bug 94092 ASTParser#createASTs(..) restores wrong bindings from capture keys) > */
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 258798
:
121819
|
121827
|
121927
|
121929
|
121969
| 122013