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 191707 Details for
Bug 339478
[1.7][compiler] support for diamond case
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
proposed fix v2.1 + tests
patch339478_v2.txt (text/plain), 108.71 KB, created by
Ayushman Jain
on 2011-03-22 15:09:42 EDT
(
hide
)
Description:
proposed fix v2.1 + tests
Filename:
MIME Type:
Creator:
Ayushman Jain
Created:
2011-03-22 15:09:42 EDT
Size:
108.71 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: batch/org/eclipse/jdt/internal/compiler/batch/Main.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java,v >retrieving revision 1.360.2.1 >diff -u -r1.360.2.1 Main.java >--- batch/org/eclipse/jdt/internal/compiler/batch/Main.java 3 Mar 2011 14:01:06 -0000 1.360.2.1 >+++ batch/org/eclipse/jdt/internal/compiler/batch/Main.java 22 Mar 2011 19:04:52 -0000 >@@ -3495,6 +3495,9 @@ > } else if (token.equals("typeHiding")) { //$NON-NLS-1$ > setSeverity(CompilerOptions.OPTION_ReportTypeParameterHiding, severity, isEnabling); > return; >+ } else if (token.equals("typeArgRedundant") /*|| token.equals("redundantSuperinterface")*/) { //$NON-NLS-1$ >+ setSeverity(CompilerOptions.OPTION_ReportRedundantDeclarationOfTypeArguments, severity, isEnabling); >+ return; > } > break; > case 'u' : >@@ -3539,6 +3542,7 @@ > setSeverity(CompilerOptions.OPTION_ReportUnusedDeclaredThrownException, severity, isEnabling); > setSeverity(CompilerOptions.OPTION_ReportUnusedLabel, severity, isEnabling); > setSeverity(CompilerOptions.OPTION_ReportUnusedTypeArgumentsForMethodInvocation, severity, isEnabling); >+ setSeverity(CompilerOptions.OPTION_ReportRedundantDeclarationOfTypeArguments, severity, isEnabling); > return; > } else if (token.equals("unusedTypeArgs")) { //$NON-NLS-1$ > setSeverity(CompilerOptions.OPTION_ReportUnusedTypeArgumentsForMethodInvocation, severity, isEnabling); >Index: compiler/org/eclipse/jdt/core/compiler/IProblem.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java,v >retrieving revision 1.225.2.12 >diff -u -r1.225.2.12 IProblem.java >--- compiler/org/eclipse/jdt/core/compiler/IProblem.java 16 Mar 2011 15:26:19 -0000 1.225.2.12 >+++ compiler/org/eclipse/jdt/core/compiler/IProblem.java 22 Mar 2011 19:04:56 -0000 >@@ -1377,7 +1377,10 @@ > int MultiCatchNotBelow17 = Syntax + Internal + 875; > /** @since 3.7 */ > int PolymorphicMethodNotBelow17 = MethodRelated + 876; >- >+ /** @since 3.7 */ >+ int InvalidUsageOfDiamondConstruct = Syntax + TypeRelated + 877; >+ /** @since 3.7 */ >+ int RedundantDeclarationOfTypeArguments = FieldRelated + Internal + 878; > /** > * External problems -- These are problems defined by other plugins > */ >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.84.2.2 >diff -u -r1.84.2.2 AllocationExpression.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java 5 Mar 2011 18:12:56 -0000 1.84.2.2 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java 22 Mar 2011 19:04:58 -0000 >@@ -29,7 +29,8 @@ > public TypeReference[] typeArguments; > public TypeBinding[] genericTypeArguments; > public FieldDeclaration enumConstant; // for enum constant initializations >- >+ protected TypeBinding expectedType; >+ > public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) { > // check captured variables are initialized in current context (26134) > checkCapturedLocalInitializationIfNecessary((ReferenceBinding)this.binding.declaringClass.erasure(), currentScope, flowInfo); >@@ -255,7 +256,12 @@ > // initialization of an enum constant > this.resolvedType = scope.enclosingReceiverType(); > } else { >- this.resolvedType = this.type.resolveType(scope, true /* check bounds*/); >+ TypeBinding inferredArguments[] = null; >+ if ((scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK1_7) && (this.type.bits & ASTNode.IsDiamond) != 0) { >+ if (this.expectedType != null && this.expectedType.isParameterizedTypeWithActualArguments()) >+ inferredArguments = ((ParameterizedTypeBinding)this.expectedType).arguments; >+ } >+ this.resolvedType = this.type.resolveType(scope, true /* check bounds*/, inferredArguments); > checkParameterizedAllocation: { > if (this.type instanceof ParameterizedQualifiedTypeReference) { // disallow new X<String>.Y<Integer>() > ReferenceBinding currentType = (ReferenceBinding)this.resolvedType; >@@ -409,4 +415,11 @@ > } > visitor.endVisit(this, scope); > } >+/** >+ * @see org.eclipse.jdt.internal.compiler.ast.Expression#setExpectedType(org.eclipse.jdt.internal.compiler.lookup.TypeBinding) >+ */ >+public void setExpectedType(TypeBinding expectedType) { >+ this.expectedType = expectedType; >+} >+ > } >Index: compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java,v >retrieving revision 1.102 >diff -u -r1.102 FieldDeclaration.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java 5 Jan 2011 19:57:26 -0000 1.102 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java 22 Mar 2011 19:04:58 -0000 >@@ -214,9 +214,19 @@ > this.initialization.computeConversion(initializationScope, fieldType, initializationType); > } > } else if ((initializationType = this.initialization.resolveType(initializationScope)) != null) { >- >+ boolean isDiamond = false; >+ if (this.initialization instanceof AllocationExpression) { >+ AllocationExpression allocationExpression = (AllocationExpression) this.initialization; >+ if (initializationScope.compilerOptions().sourceLevel >= ClassFileConstants.JDK1_7 >+ && allocationExpression.type != null >+ && (allocationExpression.type.bits & ASTNode.IsDiamond) != 0) { >+ isDiamond = true; >+ } >+ } > if (fieldType != initializationType) // must call before computeConversion() and typeMismatchError() > initializationScope.compilationUnitScope().recordTypeConversion(fieldType, initializationType); >+ else if (!isDiamond && initializationType.isParameterizedTypeWithActualArguments()) >+ initializationScope.problemReporter().redundantDeclarationOfTypeArguments(this.initialization, ((ParameterizedTypeBinding)initializationType).arguments); > if (this.initialization.isConstantValueOfTypeAssignableToType(initializationType, fieldType) > || initializationType.isCompatibleWith(fieldType)) { > this.initialization.computeConversion(initializationScope, fieldType, initializationType); >Index: compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java,v >retrieving revision 1.77.2.3 >diff -u -r1.77.2.3 LocalDeclaration.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java 8 Mar 2011 17:20:09 -0000 1.77.2.3 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java 22 Mar 2011 19:04:59 -0000 >@@ -157,7 +157,7 @@ > } > > public void resolve(BlockScope scope) { >- >+ boolean isCompliant17 = scope.compilerOptions().originalSourceLevel >= ClassFileConstants.JDK1_7; > // create a binding and add it to the scope > TypeBinding variableType = this.type.resolveType(scope, true /* check bounds*/); > >@@ -171,6 +171,10 @@ > scope.problemReporter().variableTypeCannotBeVoidArray(this); > return; > } >+ if (isCompliant17 && variableType.isParameterizedType() && (this.type.bits & ASTNode.IsDiamond) != 0) { >+ scope.problemReporter().incorrectArityForParameterizedType(this.type, variableType.original(), ((ParameterizedTypeBinding)variableType).arguments); >+ return; >+ } > } > > Binding existingVariable = scope.getBinding(this.name, Binding.VARIABLE, this, false /*do not resolve hidden field*/); >@@ -207,12 +211,20 @@ > } > } else { > this.initialization.setExpectedType(variableType); >+ boolean isDiamond = false; > TypeBinding initializationType = this.initialization.resolveType(scope); >+ if (this.initialization instanceof AllocationExpression) { >+ if (isCompliant17 && (((AllocationExpression) this.initialization).type.bits & ASTNode.IsDiamond) != 0) >+ isDiamond = true; >+ } > if (initializationType != null) { > if (variableType != initializationType) // must call before computeConversion() and typeMismatchError() > scope.compilationUnitScope().recordTypeConversion(variableType, initializationType); >+ else if (!isDiamond && initializationType.isParameterizedTypeWithActualArguments()) { >+ scope.problemReporter().redundantDeclarationOfTypeArguments(this.initialization, ((ParameterizedTypeBinding)initializationType).arguments); >+ } > if (this.initialization.isConstantValueOfTypeAssignableToType(initializationType, variableType) >- || initializationType.isCompatibleWith(variableType)) { >+ || initializationType.isCompatibleWith(variableType, isDiamond)) { > this.initialization.computeConversion(scope, variableType, initializationType); > if (initializationType.needsUncheckedConversion(variableType)) { > scope.problemReporter().unsafeTypeConversion(this.initialization, initializationType, variableType); >Index: compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java,v >retrieving revision 1.63.2.1 >diff -u -r1.63.2.1 ParameterizedQualifiedTypeReference.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java 25 Jan 2011 20:33:00 -0000 1.63.2.1 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java 22 Mar 2011 19:04:59 -0000 >@@ -27,6 +27,7 @@ > public class ParameterizedQualifiedTypeReference extends ArrayQualifiedTypeReference { > > public TypeReference[][] typeArguments; >+ public TypeBinding[] inferredTypeArgs; > > /** > * @param tokens >@@ -37,6 +38,7 @@ > > super(tokens, dim, positions); > this.typeArguments = typeArguments; >+ this.inferredTypeArgs = null; > } > public void checkBounds(Scope scope) { > if (this.resolvedType == null) return; >@@ -68,6 +70,8 @@ > * @return char[][] > */ > public char [][] getParameterizedTypeName(){ >+ if ((this.bits & ASTNode.IsDiamond) != 0) >+ return this.getTypeName(); > int length = this.tokens.length; > char[][] qParamName = new char[length][]; > for (int i = 0; i < length; i++) { >@@ -222,6 +226,9 @@ > argTypes[j] = argType; > } > } >+ if (argLength == 0 && (this.bits & ASTNode.IsDiamond) != 0 && this.inferredTypeArgs != null) { >+ argTypes = this.inferredTypeArgs; >+ } > if (argHasError) { > return null; > } >@@ -247,8 +254,18 @@ > } > return this.resolvedType; > } else if (argLength != typeVariables.length) { // check arity >- scope.problemReporter().incorrectArityForParameterizedType(this, currentType, argTypes, i); >- return null; >+ if(scope.compilerOptions().originalSourceLevel >= ClassFileConstants.JDK1_7 && argLength == 0) { >+ if ((this.bits & ASTNode.IsDiamond) ==0) { >+ scope.problemReporter().incorrectArityForParameterizedType(this, currentType, argTypes); >+ return null; >+ } >+ // argLength = 0 ok if its the diamond case for compliance >= 1.7 >+ // also no need to check bounds for such a case >+ checkBounds = false; >+ } else { >+ scope.problemReporter().incorrectArityForParameterizedType(this, currentType, argTypes, i); >+ return null; >+ } > } > // check parameterizing non-static member type of raw type > if (typeIsConsistent && !currentType.isStatic()) { >@@ -343,7 +360,11 @@ > } > return output; > } >- >+ >+ public TypeBinding resolveType(BlockScope scope, boolean checkBounds, TypeBinding[] inferredArgs) { >+ this.inferredTypeArgs = inferredArgs; >+ return internalResolveType(scope, checkBounds); >+ } > public TypeBinding resolveType(BlockScope scope, boolean checkBounds) { > return internalResolveType(scope, checkBounds); > } >Index: compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java,v >retrieving revision 1.54.2.1 >diff -u -r1.54.2.1 ParameterizedSingleTypeReference.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java 25 Jan 2011 20:33:00 -0000 1.54.2.1 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java 22 Mar 2011 19:04:59 -0000 >@@ -27,11 +27,13 @@ > public class ParameterizedSingleTypeReference extends ArrayTypeReference { > > public TypeReference[] typeArguments; >+ public TypeBinding[] inferredTypeArgs; > > public ParameterizedSingleTypeReference(char[] name, TypeReference[] typeArguments, int dim, long pos){ > super(name, dim, pos); > this.originalSourceEnd = this.sourceEnd; > this.typeArguments = typeArguments; >+ this.inferredTypeArgs = null; > } > public void checkBounds(Scope scope) { > if (this.resolvedType == null) return; >@@ -57,6 +59,8 @@ > * @return char[][] > */ > public char [][] getParameterizedTypeName(){ >+ if ((this.bits & ASTNode.IsDiamond) != 0) >+ return this.getTypeName(); > StringBuffer buffer = new StringBuffer(5); > buffer.append(this.token).append('<'); > for (int i = 0, length = this.typeArguments.length; i < length; i++) { >@@ -90,6 +94,7 @@ > * No need to check for reference to raw type per construction > */ > private TypeBinding internalResolveType(Scope scope, ReferenceBinding enclosingType, boolean checkBounds) { >+ boolean isCompliant17 = scope.compilerOptions().originalSourceLevel >= ClassFileConstants.JDK1_7; > // handle the error here > this.constant = Constant.NotAConstant; > if ((this.bits & ASTNode.DidResolve) != 0) { // is a shared type reference which was already resolved >@@ -188,6 +193,9 @@ > argTypes[i] = argType; > } > } >+ if (argLength == 0 && (this.bits & ASTNode.IsDiamond) != 0 && this.inferredTypeArgs != null) { >+ argTypes = this.inferredTypeArgs; >+ } > if (argHasError) { > return null; > } >@@ -222,8 +230,18 @@ > } > // if missing generic type, and compliance >= 1.5, then will rebuild a parameterized binding > } else if (argLength != typeVariables.length) { // check arity >- scope.problemReporter().incorrectArityForParameterizedType(this, currentType, argTypes); >- return null; >+ if(isCompliant17 && argLength == 0) { >+ if ((this.bits & ASTNode.IsDiamond) ==0) { >+ scope.problemReporter().incorrectArityForParameterizedType(this, currentType, argTypes); >+ return null; >+ } >+ // argLength = 0 ok if its the diamond case for compliance >= 1.7 >+ // also no need to check bounds for such a case >+ checkBounds = false; >+ } else { >+ scope.problemReporter().incorrectArityForParameterizedType(this, currentType, argTypes); >+ return null; >+ } > } else if (!currentType.isStatic()) { > ReferenceBinding actualEnclosing = currentType.enclosingType(); > if (actualEnclosing != null && actualEnclosing.isRawType()){ >@@ -281,6 +299,11 @@ > return output; > } > >+ public TypeBinding resolveType(BlockScope scope, boolean checkBounds, TypeBinding[] inferredArgs) { >+ this.inferredTypeArgs = inferredArgs; >+ return internalResolveType(scope, null, checkBounds); >+ } >+ > public TypeBinding resolveType(BlockScope scope, boolean checkBounds) { > return internalResolveType(scope, null, checkBounds); > } >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.101.2.1 >diff -u -r1.101.2.1 QualifiedAllocationExpression.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java 5 Mar 2011 18:12:56 -0000 1.101.2.1 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java 22 Mar 2011 19:05:00 -0000 >@@ -236,7 +236,13 @@ > boolean hasError = false; > boolean enclosingInstanceContainsCast = false; > boolean argsContainCast = false; >- >+ >+ // don't allow diamond construct if this allocation expressions corresponds to an anonymous type being declared >+ boolean isCompliant17 = scope.compilerOptions().originalSourceLevel >= ClassFileConstants.JDK1_7; >+ if (isCompliant17 && this.anonymousType != null && (this.type.bits & ASTNode.IsDiamond) != 0) { >+ scope.problemReporter().invalidUsageOfDiamondConstruct(this.type); >+ return null; >+ } > if (this.enclosingInstance != null) { > if (this.enclosingInstance instanceof CastExpression) { > this.enclosingInstance.bits |= ASTNode.DisableUnnecessaryCastCheck; // will check later on >@@ -498,4 +504,13 @@ > } > visitor.endVisit(this, scope); > } >+ >+ /** >+ * @see org.eclipse.jdt.internal.compiler.ast.Expression#setExpectedType(org.eclipse.jdt.internal.compiler.lookup.TypeBinding) >+ */ >+ public void setExpectedType(TypeBinding expectedType) { >+ this.expectedType = expectedType; >+ if (this.expectedType != null && this.enclosingInstance != null) >+ this.enclosingInstance.setExpectedType(this.expectedType.enclosingType()); >+ } > } >Index: compiler/org/eclipse/jdt/internal/compiler/ast/TypeReference.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeReference.java,v >retrieving revision 1.44.4.1 >diff -u -r1.44.4.1 TypeReference.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/TypeReference.java 25 Jan 2011 20:33:00 -0000 1.44.4.1 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/TypeReference.java 22 Mar 2011 19:05:00 -0000 >@@ -208,6 +208,11 @@ > return internalResolveType(scope); > } > >+public TypeBinding resolveType(BlockScope scope, boolean checkBounds, TypeBinding[] inferredArgs) { >+ return internalResolveType(scope); >+} >+ >+ > public TypeBinding resolveType(ClassScope scope) { > return internalResolveType(scope); > } >Index: compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java,v >retrieving revision 1.241.2.3 >diff -u -r1.241.2.3 CompilerOptions.java >--- compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java 14 Feb 2011 14:08:01 -0000 1.241.2.3 >+++ compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java 22 Mar 2011 19:05:04 -0000 >@@ -136,6 +136,7 @@ > public static final String OPTION_IncludeNullInfoFromAsserts = "org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts"; //$NON-NLS-1$ > public static final String OPTION_ReportMethodCanBeStatic = "org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic"; //$NON-NLS-1$ > public static final String OPTION_ReportMethodCanBePotentiallyStatic = "org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic"; //$NON-NLS-1$ >+ public static final String OPTION_ReportRedundantDeclarationOfTypeArguments = "org.eclipse.jdt.core.compiler.problem.redundantDeclarationOfTypeArguments"; //$NON-NLS-1$ > /** > * Possible values for configurable options > */ >@@ -238,6 +239,7 @@ > public static final int UnusedObjectAllocation = IrritantSet.GROUP2 | ASTNode.Bit4; > public static final int MethodCanBeStatic = IrritantSet.GROUP2 | ASTNode.Bit5; > public static final int MethodCanBePotentiallyStatic = IrritantSet.GROUP2 | ASTNode.Bit6; >+ public static final int RedundantDeclarationOfTypeArguments = IrritantSet.GROUP2 | ASTNode.Bit7; > > // Severity level for handlers > /** >@@ -547,6 +549,8 @@ > return OPTION_ReportMethodCanBeStatic; > case MethodCanBePotentiallyStatic : > return OPTION_ReportMethodCanBePotentiallyStatic; >+ case RedundantDeclarationOfTypeArguments : >+ return OPTION_ReportRedundantDeclarationOfTypeArguments; > } > return null; > } >@@ -680,6 +684,7 @@ > OPTION_ReportPossibleAccidentalBooleanAssignment, > OPTION_ReportPotentialNullReference, > OPTION_ReportRawTypeReference, >+ OPTION_ReportRedundantDeclarationOfTypeArguments, > OPTION_ReportRedundantNullCheck, > OPTION_ReportRedundantSuperinterface, > OPTION_ReportSpecialParameterHidingField, >@@ -763,6 +768,7 @@ > case UnusedDeclaredThrownException : > case DeadCode : > case UnusedObjectAllocation : >+ case RedundantDeclarationOfTypeArguments : > return "unused"; //$NON-NLS-1$ > case DiscouragedReference : > case ForbiddenReference : >@@ -973,6 +979,7 @@ > optionsMap.put(OPTION_IncludeNullInfoFromAsserts, this.includeNullInfoFromAsserts ? ENABLED : DISABLED); > optionsMap.put(OPTION_ReportMethodCanBeStatic, getSeverityString(MethodCanBeStatic)); > optionsMap.put(OPTION_ReportMethodCanBePotentiallyStatic, getSeverityString(MethodCanBePotentiallyStatic)); >+ optionsMap.put(OPTION_ReportRedundantDeclarationOfTypeArguments, getSeverityString(RedundantDeclarationOfTypeArguments)); > return optionsMap; > } > >@@ -1402,6 +1409,7 @@ > if ((optionValue = optionsMap.get(OPTION_ReportUnusedObjectAllocation)) != null) updateSeverity(UnusedObjectAllocation, optionValue); > if ((optionValue = optionsMap.get(OPTION_ReportMethodCanBeStatic)) != null) updateSeverity(MethodCanBeStatic, optionValue); > if ((optionValue = optionsMap.get(OPTION_ReportMethodCanBePotentiallyStatic)) != null) updateSeverity(MethodCanBePotentiallyStatic, optionValue); >+ if ((optionValue = optionsMap.get(OPTION_ReportRedundantDeclarationOfTypeArguments)) != null) updateSeverity(RedundantDeclarationOfTypeArguments, optionValue); > > // Javadoc options > if ((optionValue = optionsMap.get(OPTION_DocCommentSupport)) != null) { >@@ -1616,6 +1624,7 @@ > buf.append("\n\t- unused object allocation: ").append(getSeverityString(UnusedObjectAllocation)); //$NON-NLS-1$ > buf.append("\n\t- method can be static: ").append(getSeverityString(MethodCanBeStatic)); //$NON-NLS-1$ > buf.append("\n\t- method can be potentially static: ").append(getSeverityString(MethodCanBePotentiallyStatic)); //$NON-NLS-1$ >+ buf.append("\n\t- redundant declaration of type arguments: ").append(getSeverityString(RedundantDeclarationOfTypeArguments)); //$NON-NLS-1$ > return buf.toString(); > } > >Index: compiler/org/eclipse/jdt/internal/compiler/impl/IrritantSet.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/IrritantSet.java,v >retrieving revision 1.13.2.1 >diff -u -r1.13.2.1 IrritantSet.java >--- compiler/org/eclipse/jdt/internal/compiler/impl/IrritantSet.java 11 Feb 2011 15:17:16 -0000 1.13.2.1 >+++ compiler/org/eclipse/jdt/internal/compiler/impl/IrritantSet.java 22 Mar 2011 19:05:04 -0000 >@@ -120,7 +120,8 @@ > .set(CompilerOptions.UnusedTypeArguments) > .set(CompilerOptions.RedundantSuperinterface) > .set(CompilerOptions.DeadCode) >- .set(CompilerOptions.UnusedObjectAllocation); >+ .set(CompilerOptions.UnusedObjectAllocation) >+ .set(CompilerOptions.RedundantDeclarationOfTypeArguments); > STATIC_METHOD > .set(CompilerOptions.MethodCanBePotentiallyStatic); > String suppressRawWhenUnchecked = System.getProperty("suppressRawWhenUnchecked"); //$NON-NLS-1$ >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java,v >retrieving revision 1.140.2.4 >diff -u -r1.140.2.4 ReferenceBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java 14 Feb 2011 06:33:10 -0000 1.140.2.4 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java 22 Mar 2011 19:05:05 -0000 >@@ -1005,6 +1005,18 @@ > * In addition to improving performance, caching also ensures there is no infinite regression > * since per nature, the compatibility check is recursive through parameterized type arguments (122775) > */ >+public boolean isCompatibleWith(TypeBinding otherType, boolean isDiamondCase) { >+ if (isDiamondCase) { >+ if (this.erasure() == otherType.erasure()) >+ return true; >+ } >+ return isCompatibleWith(otherType); >+} >+/** >+ * Answer true if the receiver type can be assigned to the argument type (right) >+ * In addition to improving performance, caching also ensures there is no infinite regression >+ * since per nature, the compatibility check is recursive through parameterized type arguments (122775) >+ */ > public boolean isCompatibleWith(TypeBinding otherType) { > if (otherType == this) > return true; >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java,v >retrieving revision 1.186.2.4 >diff -u -r1.186.2.4 SourceTypeBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java 15 Mar 2011 12:06:21 -0000 1.186.2.4 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java 22 Mar 2011 19:05:09 -0000 >@@ -1310,6 +1310,13 @@ > fieldDecl.binding = null; > return null; > } >+ if ((this.scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK1_7) && >+ fieldDecl.type != null && >+ ((fieldDecl.type.bits & ASTNode.IsDiamond) != 0)) { >+ this.scope.problemReporter().incorrectArityForParameterizedType(fieldDecl.type, fieldType, Binding.NO_TYPES); >+ fieldDecl.binding = null; >+ return null; >+ } > if (fieldType == TypeBinding.VOID) { > this.scope.problemReporter().variableTypeCannotBeVoid(fieldDecl); > fieldDecl.binding = null; >@@ -1390,6 +1397,7 @@ > final boolean reportUnavoidableGenericTypeProblems = this.scope.compilerOptions().reportUnavoidableGenericTypeProblems; > boolean foundArgProblem = false; > Argument[] arguments = methodDecl.arguments; >+ boolean isCompliant17 = this.scope.compilerOptions().originalSourceLevel >= ClassFileConstants.JDK1_7; > if (arguments != null) { > int size = arguments.length; > method.parameters = Binding.NO_PARAMETERS; >@@ -1415,6 +1423,10 @@ > > if (parameterType == null) { > foundArgProblem = true; >+ } else if (isCompliant17 && (arg.type.bits & ASTNode.IsDiamond) != 0) { >+ // a parameter type cannot use diamond construct >+ methodDecl.scope.problemReporter().incorrectArityForParameterizedType(arg.type, parameterType.original(), Binding.NO_TYPES); >+ foundArgProblem = true; > } else if (parameterType == TypeBinding.VOID) { > methodDecl.scope.problemReporter().argumentTypeCannotBeVoid(this, methodDecl, arg); > foundArgProblem = true; >@@ -1436,7 +1448,7 @@ > } > > // https://bugs.eclipse.org/bugs/show_bug.cgi?id=337799 >- if (this.scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK1_7) { >+ if (isCompliant17) { > if ((method.tagBits & TagBits.AnnotationSafeVarargs) != 0) { > if (!method.isVarargs()) { > methodDecl.scope.problemReporter().safeVarargsOnFixedArityMethod(method); >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.113 >diff -u -r1.113 TypeBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java 24 Nov 2010 04:51:11 -0000 1.113 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java 22 Mar 2011 19:05:09 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -1183,4 +1183,8 @@ > public TypeVariableBinding[] typeVariables() { > return Binding.NO_TYPE_VARIABLES; > } >+ >+public boolean isCompatibleWith(TypeBinding variableType, boolean isDiamond){ >+ return isCompatibleWith(variableType); >+} > } >Index: compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java,v >retrieving revision 1.422.2.18 >diff -u -r1.422.2.18 Parser.java >--- compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java 19 Mar 2011 16:00:05 -0000 1.422.2.18 >+++ compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java 22 Mar 2011 19:05:26 -0000 >@@ -3956,6 +3956,7 @@ > // zero type arguments == <> > pushOnGenericsLengthStack(-1); > concatGenericsLists(); >+ this.intPtr--; // no reference type to be consumed between < and > > } > protected void consumeImportDeclaration() { > // SingleTypeImportDeclaration ::= SingleTypeImportDeclarationName ';' >@@ -8912,8 +8913,9 @@ > if (dim != 0) { > parameterizedSingleTypeReference.sourceEnd = this.endStatementPosition; > } >- if (isDiamond) { >- parameterizedSingleTypeReference.bits |= ASTNode.IsDiamond; >+ if (isDiamond && (this.options.sourceLevel >= ClassFileConstants.JDK1_7)) { >+ if (parameterizedSingleTypeReference.dimensions == 0) >+ parameterizedSingleTypeReference.bits |= ASTNode.IsDiamond; > } > return parameterizedSingleTypeReference; > } else { >@@ -8954,7 +8956,7 @@ > if (dim != 0) { > parameterizedQualifiedTypeReference.sourceEnd = this.endStatementPosition; > } >- if (isDiamond) { >+ if (isDiamond && (this.options.sourceLevel >= ClassFileConstants.JDK1_7)) { > parameterizedQualifiedTypeReference.bits |= ASTNode.IsDiamond; > } > return parameterizedQualifiedTypeReference; >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.430.2.16 >diff -u -r1.430.2.16 ProblemReporter.java >--- compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java 19 Mar 2011 16:00:06 -0000 1.430.2.16 >+++ compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java 22 Mar 2011 19:05:39 -0000 >@@ -430,6 +430,9 @@ > > case IProblem.MethodCanBePotentiallyStatic: > return CompilerOptions.MethodCanBePotentiallyStatic; >+ >+ case IProblem.RedundantDeclarationOfTypeArguments: >+ return CompilerOptions.RedundantDeclarationOfTypeArguments; > } > return 0; > } >@@ -503,6 +506,7 @@ > case CompilerOptions.UnusedWarningToken : > case CompilerOptions.UnusedLabel : > case CompilerOptions.RedundantSuperinterface : >+ case CompilerOptions.RedundantDeclarationOfTypeArguments : > return CategorizedProblem.CAT_UNNECESSARY_CODE; > > case CompilerOptions.UsingDeprecatedAPI : >@@ -3877,6 +3881,15 @@ > annotationTypeDeclaration.sourceStart, > annotationTypeDeclaration.sourceEnd); > } >+public void invalidUsageOfDiamondConstruct(ASTNode typeRef) { >+ //int i = 1; >+ this.handle( >+ IProblem.InvalidUsageOfDiamondConstruct, >+ NoArgument, >+ NoArgument, >+ typeRef.sourceStart, >+ typeRef.sourceEnd); >+} > public void invalidUsageOfEnumDeclarations(TypeDeclaration enumDeclaration) { > this.handle( > IProblem.InvalidUsageOfEnumDeclarations, >@@ -6177,6 +6190,18 @@ > localDecl.sourceStart, > localDecl.sourceEnd); > } >+public void redundantDeclarationOfTypeArguments(ASTNode location, TypeBinding[] argumentTypes) { >+ int severity = computeSeverity(IProblem.RedundantDeclarationOfTypeArguments); >+ if (severity != ProblemSeverities.Ignore) { >+ this.handle( >+ IProblem.RedundantDeclarationOfTypeArguments, >+ new String[] {typesAsString(false, argumentTypes, false)}, >+ new String[] {typesAsString(false, argumentTypes, true)}, >+ severity, >+ location.sourceStart, >+ nodeSourceEnd(null, location)); >+ } >+} > public void redundantSuperInterface(SourceTypeBinding type, TypeReference reference, ReferenceBinding superinterface, ReferenceBinding declaringType) { > int severity = computeSeverity(IProblem.RedundantSuperinterface); > if (severity != ProblemSeverities.Ignore) { >Index: compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties,v >retrieving revision 1.262.2.14 >diff -u -r1.262.2.14 messages.properties >--- compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties 16 Mar 2011 15:26:19 -0000 1.262.2.14 >+++ compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties 22 Mar 2011 19:05:40 -0000 >@@ -638,6 +638,8 @@ > 874 = Resource specification not allowed here for source level below 1.7 > 875 = Multi-catch parameters are not allowed for source level below 1.7 > 876 = Invocation of polymorphic methods not allowed for source level below 1.7 >+877 = Empty type argument list cannot be used in anonymous class declaration >+878 = Redundant declaration of type arguments <{0}> > > ### ELABORATIONS > ## Access restrictions >Index: model/org/eclipse/jdt/core/JavaCore.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java,v >retrieving revision 1.659 >diff -u -r1.659 JavaCore.java >--- model/org/eclipse/jdt/core/JavaCore.java 16 Jan 2011 22:43:21 -0000 1.659 >+++ model/org/eclipse/jdt/core/JavaCore.java 22 Mar 2011 19:05:51 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -1619,6 +1619,20 @@ > */ > public static final String COMPILER_PB_REDUNDANT_SUPERINTERFACE = PLUGIN_ID + ".compiler.problem.redundantSuperinterface"; //$NON-NLS-1$ > /** >+ * Compiler option ID: Reporting Redundant Declaration of Type Arguments. >+ * <p>When enabled, the compiler will issue an error or a warning if type arguments are specified >+ * in a class instantiation expression where the diamond semantics "<>" are sufficient for the >+ * compiler to infer the type arguments. >+ * <dl> >+ * <dt>Option id:</dt><dd><code>"org.eclipse.jdt.core.compiler.problem.redundantDeclarationOfTypeArguments"</code></dd> >+ * <dt>Possible values:</dt><dd><code>{ "error", "warning", "ignore" }</code></dd> >+ * <dt>Default:</dt><dd><code>"warning"</code></dd> >+ * </dl> >+ * @since 3.7 >+ * @category CompilerOptionID >+ */ >+ public static final String COMPILER_PB_REDUNDANT_DECLARATION_OF_TYPE_ARGS = PLUGIN_ID + ".compiler.problem.redundantDeclarationOfTypeArguments"; //$NON-NLS-1$ >+ /** > * Compiler option ID: Reporting Comparison of Identical Expressions. > * <p>When enabled, the compiler will issue an error or a warning if a comparison > * is involving identical operands (e.g <code>'x == x'</code>). >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java,v >retrieving revision 1.224.2.1 >diff -u -r1.224.2.1 BatchCompilerTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 2 Mar 2011 14:34:57 -0000 1.224.2.1 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 22 Mar 2011 19:06:09 -0000 >@@ -1781,142 +1781,143 @@ > true); > String logContents = Util.fileContent(logFileName); > String expectedLogContents = >- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + >- "<!DOCTYPE compiler PUBLIC \"-//Eclipse.org//DTD Eclipse JDT 3.2.004 Compiler//EN\" \"http://www.eclipse.org/jdt/core/compiler_32_004.dtd\">\n" + >- "<compiler copyright=\"{2}\" name=\"{1}\" version=\"{3}\">\n" + >- " <command_line>\n" + >- " <argument value=\"---OUTPUT_DIR_PLACEHOLDER---{0}X.java\"/>\n" + >- " <argument value=\"-1.5\"/>\n" + >- " <argument value=\"-proceedOnError\"/>\n" + >- " <argument value=\"-log\"/>\n" + >- " <argument value=\"---OUTPUT_DIR_PLACEHOLDER---{0}log.xml\"/>\n" + >- " <argument value=\"-d\"/>\n" + >- " <argument value=\"---OUTPUT_DIR_PLACEHOLDER---\"/>\n" + >- " </command_line>\n" + >- " <options>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode\" value=\"disabled\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.codegen.targetPlatform\" value=\"1.5\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.codegen.unusedLocal\" value=\"optimize out\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.compliance\" value=\"1.5\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.debug.lineNumber\" value=\"generate\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.debug.localVariable\" value=\"do not generate\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.debug.sourceFile\" value=\"generate\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.doc.comment.support\" value=\"disabled\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.generateClassFiles\" value=\"enabled\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.maxProblemPerUnit\" value=\"100\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.annotationSuperInterface\" value=\"warning\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.assertIdentifier\" value=\"warning\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.autoboxing\" value=\"ignore\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.comparingIdentical\" value=\"warning\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.deadCode\" value=\"warning\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.deadCodeInTrivialIfStatement\" value=\"disabled\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.deprecation\" value=\"warning\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode\" value=\"disabled\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod\" value=\"disabled\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.discouragedReference\" value=\"warning\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.emptyStatement\" value=\"ignore\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.enumIdentifier\" value=\"warning\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.fallthroughCase\" value=\"ignore\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.fatalOptionalError\" value=\"disabled\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.fieldHiding\" value=\"ignore\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.finalParameterBound\" value=\"warning\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally\" value=\"warning\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.forbiddenReference\" value=\"warning\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock\" value=\"warning\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts\" value=\"disabled\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod\" value=\"warning\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch\" value=\"ignore\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.indirectStaticAccess\" value=\"ignore\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.invalidJavadoc\" value=\"ignore\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.invalidJavadocTags\" value=\"disabled\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef\" value=\"disabled\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef\" value=\"disabled\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility\" value=\"public\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.localVariableHiding\" value=\"ignore\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.methodWithConstructorName\" value=\"warning\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation\" value=\"ignore\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod\" value=\"ignore\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.missingJavadocComments\" value=\"ignore\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding\" value=\"disabled\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility\" value=\"public\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription\" value=\"return_tag\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.missingJavadocTags\" value=\"ignore\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters\" value=\"disabled\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding\" value=\"disabled\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility\" value=\"public\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation\" value=\"ignore\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation\" value=\"enabled\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.missingSerialVersion\" value=\"warning\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod\" value=\"ignore\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.noEffectAssignment\" value=\"warning\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion\" value=\"warning\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral\" value=\"ignore\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.nullReference\" value=\"warning\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.overridingMethodWithoutSuperInvocation\" value=\"ignore\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod\" value=\"warning\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.parameterAssignment\" value=\"ignore\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment\" value=\"ignore\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.potentialNullReference\" value=\"ignore\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.rawTypeReference\" value=\"warning\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.redundantNullCheck\" value=\"ignore\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.redundantSuperinterface\" value=\"ignore\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic\" value=\"ignore\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic\" value=\"ignore\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.specialParameterHidingField\" value=\"disabled\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.staticAccessReceiver\" value=\"warning\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors\" value=\"disabled\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.suppressWarnings\" value=\"enabled\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation\" value=\"ignore\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.tasks\" value=\"warning\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.typeParameterHiding\" value=\"warning\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems\" value=\"enabled\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation\" value=\"warning\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock\" value=\"ignore\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.unhandledWarningToken\" value=\"warning\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.unnecessaryElse\" value=\"ignore\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck\" value=\"ignore\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess\" value=\"ignore\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException\" value=\"ignore\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable\" value=\"enabled\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference\" value=\"enabled\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding\" value=\"disabled\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.unusedImport\" value=\"warning\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.unusedLabel\" value=\"warning\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.unusedLocal\" value=\"warning\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation\" value=\"ignore\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.unusedParameter\" value=\"ignore\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference\" value=\"enabled\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract\" value=\"disabled\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete\" value=\"disabled\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.unusedPrivateMember\" value=\"warning\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.unusedTypeArgumentsForMethodInvocation\" value=\"warning\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.unusedWarningToken\" value=\"warning\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast\" value=\"warning\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.processAnnotations\" value=\"disabled\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.source\" value=\"1.5\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.taskCaseSensitive\" value=\"enabled\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.taskPriorities\" value=\"\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.taskTags\" value=\"\"/>\n" + >- " </options>\n" + >- " <classpaths>NORMALIZED SECTION</classpaths>\n" + >- " <sources>\n" + >- " <source output=\"---OUTPUT_DIR_PLACEHOLDER---\" path=\"---OUTPUT_DIR_PLACEHOLDER---" + File.separator + "X.java\">\n" + >- " <problems errors=\"1\" problems=\"1\" warnings=\"0\">\n" + >- " <problem categoryID=\"40\" charEnd=\"28\" charStart=\"25\" id=\"UndefinedType\" line=\"3\" problemID=\"16777218\" severity=\"ERROR\">\n" + >- " <message value=\"Zork cannot be resolved to a type\"/>\n" + >- " <source_context sourceEnd=\"3\" sourceStart=\"0\" value=\"Zork z;\"/>\n" + >- " <arguments>\n" + >- " <argument value=\"Zork\"/>\n" + >- " </arguments>\n" + >- " </problem>\n" + >- " </problems>\n" + >- " <classfile path=\"---OUTPUT_DIR_PLACEHOLDER---{0}X.class\"/>\n" + >- " </source>\n" + >- " </sources>\n" + >- " <stats>\n" + >- " <problem_summary errors=\"1\" problems=\"1\" tasks=\"0\" warnings=\"0\"/>\n" + >- " </stats>\n" + >- "</compiler>\n"; >+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + >+ "<!DOCTYPE compiler PUBLIC \"-//Eclipse.org//DTD Eclipse JDT 3.2.004 Compiler//EN\" \"http://www.eclipse.org/jdt/core/compiler_32_004.dtd\">\n" + >+ "<compiler copyright=\"{2}\" name=\"{1}\" version=\"{3}\">\n" + >+ " <command_line>\n" + >+ " <argument value=\"---OUTPUT_DIR_PLACEHOLDER---{0}X.java\"/>\n" + >+ " <argument value=\"-1.5\"/>\n" + >+ " <argument value=\"-proceedOnError\"/>\n" + >+ " <argument value=\"-log\"/>\n" + >+ " <argument value=\"---OUTPUT_DIR_PLACEHOLDER---{0}log.xml\"/>\n" + >+ " <argument value=\"-d\"/>\n" + >+ " <argument value=\"---OUTPUT_DIR_PLACEHOLDER---\"/>\n" + >+ " </command_line>\n" + >+ " <options>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode\" value=\"disabled\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.codegen.targetPlatform\" value=\"1.5\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.codegen.unusedLocal\" value=\"optimize out\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.compliance\" value=\"1.5\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.debug.lineNumber\" value=\"generate\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.debug.localVariable\" value=\"do not generate\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.debug.sourceFile\" value=\"generate\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.doc.comment.support\" value=\"disabled\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.generateClassFiles\" value=\"enabled\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.maxProblemPerUnit\" value=\"100\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.annotationSuperInterface\" value=\"warning\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.assertIdentifier\" value=\"warning\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.autoboxing\" value=\"ignore\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.comparingIdentical\" value=\"warning\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.deadCode\" value=\"warning\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.deadCodeInTrivialIfStatement\" value=\"disabled\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.deprecation\" value=\"warning\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode\" value=\"disabled\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod\" value=\"disabled\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.discouragedReference\" value=\"warning\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.emptyStatement\" value=\"ignore\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.enumIdentifier\" value=\"warning\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.fallthroughCase\" value=\"ignore\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.fatalOptionalError\" value=\"disabled\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.fieldHiding\" value=\"ignore\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.finalParameterBound\" value=\"warning\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally\" value=\"warning\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.forbiddenReference\" value=\"warning\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock\" value=\"warning\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts\" value=\"disabled\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod\" value=\"warning\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch\" value=\"ignore\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.indirectStaticAccess\" value=\"ignore\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.invalidJavadoc\" value=\"ignore\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.invalidJavadocTags\" value=\"disabled\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef\" value=\"disabled\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef\" value=\"disabled\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility\" value=\"public\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.localVariableHiding\" value=\"ignore\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.methodWithConstructorName\" value=\"warning\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation\" value=\"ignore\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod\" value=\"ignore\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.missingJavadocComments\" value=\"ignore\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding\" value=\"disabled\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility\" value=\"public\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription\" value=\"return_tag\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.missingJavadocTags\" value=\"ignore\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters\" value=\"disabled\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding\" value=\"disabled\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility\" value=\"public\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation\" value=\"ignore\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation\" value=\"enabled\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.missingSerialVersion\" value=\"warning\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod\" value=\"ignore\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.noEffectAssignment\" value=\"warning\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion\" value=\"warning\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral\" value=\"ignore\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.nullReference\" value=\"warning\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.overridingMethodWithoutSuperInvocation\" value=\"ignore\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod\" value=\"warning\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.parameterAssignment\" value=\"ignore\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment\" value=\"ignore\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.potentialNullReference\" value=\"ignore\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.rawTypeReference\" value=\"warning\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.redundantDeclarationOfTypeArguments\" value=\"ignore\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.redundantNullCheck\" value=\"ignore\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.redundantSuperinterface\" value=\"ignore\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic\" value=\"ignore\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic\" value=\"ignore\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.specialParameterHidingField\" value=\"disabled\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.staticAccessReceiver\" value=\"warning\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors\" value=\"disabled\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.suppressWarnings\" value=\"enabled\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation\" value=\"ignore\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.tasks\" value=\"warning\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.typeParameterHiding\" value=\"warning\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems\" value=\"enabled\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation\" value=\"warning\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock\" value=\"ignore\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.unhandledWarningToken\" value=\"warning\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.unnecessaryElse\" value=\"ignore\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck\" value=\"ignore\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess\" value=\"ignore\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException\" value=\"ignore\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable\" value=\"enabled\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference\" value=\"enabled\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding\" value=\"disabled\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.unusedImport\" value=\"warning\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.unusedLabel\" value=\"warning\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.unusedLocal\" value=\"warning\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation\" value=\"ignore\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.unusedParameter\" value=\"ignore\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference\" value=\"enabled\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract\" value=\"disabled\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete\" value=\"disabled\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.unusedPrivateMember\" value=\"warning\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.unusedTypeArgumentsForMethodInvocation\" value=\"warning\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.unusedWarningToken\" value=\"warning\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast\" value=\"warning\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.processAnnotations\" value=\"disabled\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.source\" value=\"1.5\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.taskCaseSensitive\" value=\"enabled\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.taskPriorities\" value=\"\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.taskTags\" value=\"\"/>\n" + >+ " </options>\n" + >+ " <classpaths>NORMALIZED SECTION</classpaths>\n" + >+ " <sources>\n" + >+ " <source output=\"---OUTPUT_DIR_PLACEHOLDER---\" path=\"---OUTPUT_DIR_PLACEHOLDER---\\X.java\">\n" + >+ " <problems errors=\"1\" problems=\"1\" warnings=\"0\">\n" + >+ " <problem categoryID=\"40\" charEnd=\"28\" charStart=\"25\" id=\"UndefinedType\" line=\"3\" problemID=\"16777218\" severity=\"ERROR\">\n" + >+ " <message value=\"Zork cannot be resolved to a type\"/>\n" + >+ " <source_context sourceEnd=\"3\" sourceStart=\"0\" value=\"Zork z;\"/>\n" + >+ " <arguments>\n" + >+ " <argument value=\"Zork\"/>\n" + >+ " </arguments>\n" + >+ " </problem>\n" + >+ " </problems>\n" + >+ " <classfile path=\"---OUTPUT_DIR_PLACEHOLDER---\\X.class\"/>\n" + >+ " </source>\n" + >+ " </sources>\n" + >+ " <stats>\n" + >+ " <problem_summary errors=\"1\" problems=\"1\" tasks=\"0\" warnings=\"0\"/>\n" + >+ " </stats>\n" + >+ "</compiler>\n"; > String normalizedExpectedLogContents = > MessageFormat.format( > expectedLogContents, >Index: src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java,v >retrieving revision 1.40.2.8 >diff -u -r1.40.2.8 CompilerInvocationTests.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java 16 Mar 2011 19:09:39 -0000 1.40.2.8 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java 22 Mar 2011 19:06:17 -0000 >@@ -422,8 +422,8 @@ > expectedProblemAttributes.put("DuplicateParameterizedMethods", new ProblemAttributes(CategorizedProblem.CAT_MEMBER)); > expectedProblemAttributes.put("DuplicateSuperInterface", new ProblemAttributes(CategorizedProblem.CAT_TYPE)); > expectedProblemAttributes.put("DuplicateTargetInTargetAnnotation", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL)); >- expectedProblemAttributes.put("DuplicateTypes", new ProblemAttributes(CategorizedProblem.CAT_TYPE)); > expectedProblemAttributes.put("DuplicateTypeVariable", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL)); >+ expectedProblemAttributes.put("DuplicateTypes", new ProblemAttributes(CategorizedProblem.CAT_TYPE)); > expectedProblemAttributes.put("EmptyControlFlowStatement", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM)); > expectedProblemAttributes.put("EnclosingInstanceInConstructorCall", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL)); > expectedProblemAttributes.put("EndOfSource", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); >@@ -452,9 +452,9 @@ > expectedProblemAttributes.put("FieldTypeNotVisible", DEPRECATED); > expectedProblemAttributes.put("FinalBoundForTypeVariable", new ProblemAttributes(CategorizedProblem.CAT_CODE_STYLE)); > expectedProblemAttributes.put("FinalFieldAssignment", new ProblemAttributes(CategorizedProblem.CAT_MEMBER)); >- expectedProblemAttributes.put("FinallyMustCompleteNormally", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM)); > expectedProblemAttributes.put("FinalMethodCannotBeOverridden", new ProblemAttributes(CategorizedProblem.CAT_MEMBER)); > expectedProblemAttributes.put("FinalOuterLocalAssignment", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL)); >+ expectedProblemAttributes.put("FinallyMustCompleteNormally", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM)); > expectedProblemAttributes.put("ForbiddenReference", new ProblemAttributes(CategorizedProblem.CAT_RESTRICTION)); > expectedProblemAttributes.put("GenericConstructorTypeArgumentMismatch", new ProblemAttributes(CategorizedProblem.CAT_TYPE)); > expectedProblemAttributes.put("GenericMethodTypeArgumentMismatch", new ProblemAttributes(CategorizedProblem.CAT_TYPE)); >@@ -583,6 +583,7 @@ > expectedProblemAttributes.put("InvalidUnicodeEscape", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); > expectedProblemAttributes.put("InvalidUsageOfAnnotationDeclarations", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); > expectedProblemAttributes.put("InvalidUsageOfAnnotations", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); >+ expectedProblemAttributes.put("InvalidUsageOfDiamondConstruct", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); > expectedProblemAttributes.put("InvalidUsageOfEnumDeclarations", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); > expectedProblemAttributes.put("InvalidUsageOfForeachStatements", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); > expectedProblemAttributes.put("InvalidUsageOfStaticImports", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); >@@ -646,9 +647,9 @@ > expectedProblemAttributes.put("JavadocNotVisibleField", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC)); > expectedProblemAttributes.put("JavadocNotVisibleMethod", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC)); > expectedProblemAttributes.put("JavadocNotVisibleType", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC)); >+ expectedProblemAttributes.put("JavadocParameterMismatch", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC)); > expectedProblemAttributes.put("JavadocParameterizedConstructorArgumentTypeMismatch", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC)); > expectedProblemAttributes.put("JavadocParameterizedMethodArgumentTypeMismatch", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC)); >- expectedProblemAttributes.put("JavadocParameterMismatch", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC)); > expectedProblemAttributes.put("JavadocTypeArgumentsForRawGenericConstructor", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC)); > expectedProblemAttributes.put("JavadocTypeArgumentsForRawGenericMethod", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC)); > expectedProblemAttributes.put("JavadocUndefinedConstructor", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC)); >@@ -662,16 +663,16 @@ > expectedProblemAttributes.put("JavadocUsingDeprecatedField", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC)); > expectedProblemAttributes.put("JavadocUsingDeprecatedMethod", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC)); > expectedProblemAttributes.put("JavadocUsingDeprecatedType", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC)); >- expectedProblemAttributes.put("LocalVariableCannotBeNull", DEPRECATED); > expectedProblemAttributes.put("LocalVariableCanOnlyBeNull", DEPRECATED); >+ expectedProblemAttributes.put("LocalVariableCannotBeNull", DEPRECATED); > expectedProblemAttributes.put("LocalVariableHidingField", new ProblemAttributes(CategorizedProblem.CAT_NAME_SHADOWING_CONFLICT)); > expectedProblemAttributes.put("LocalVariableHidingLocalVariable", new ProblemAttributes(CategorizedProblem.CAT_NAME_SHADOWING_CONFLICT)); > expectedProblemAttributes.put("LocalVariableIsNeverUsed", new ProblemAttributes(CategorizedProblem.CAT_UNNECESSARY_CODE)); > expectedProblemAttributes.put("LocalVariableMayBeNull", DEPRECATED); > expectedProblemAttributes.put("MaskedCatch", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM)); > expectedProblemAttributes.put("MethodButWithConstructorName", new ProblemAttributes(CategorizedProblem.CAT_CODE_STYLE)); >- expectedProblemAttributes.put("MethodCanBeStatic", new ProblemAttributes(CategorizedProblem.CAT_CODE_STYLE)); > expectedProblemAttributes.put("MethodCanBePotentiallyStatic", new ProblemAttributes(CategorizedProblem.CAT_CODE_STYLE)); >+ expectedProblemAttributes.put("MethodCanBeStatic", new ProblemAttributes(CategorizedProblem.CAT_CODE_STYLE)); > expectedProblemAttributes.put("MethodMissingDeprecatedAnnotation", new ProblemAttributes(CategorizedProblem.CAT_CODE_STYLE)); > expectedProblemAttributes.put("MethodMustOverride", new ProblemAttributes(CategorizedProblem.CAT_MEMBER)); > expectedProblemAttributes.put("MethodMustOverrideOrImplement", new ProblemAttributes(CategorizedProblem.CAT_MEMBER)); >@@ -740,9 +741,9 @@ > expectedProblemAttributes.put("PackageCollidesWithType", new ProblemAttributes(CategorizedProblem.CAT_TYPE)); > expectedProblemAttributes.put("PackageIsNotExpectedPackage", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL)); > expectedProblemAttributes.put("ParameterAssignment", new ProblemAttributes(CategorizedProblem.CAT_CODE_STYLE)); >+ expectedProblemAttributes.put("ParameterMismatch", new ProblemAttributes(CategorizedProblem.CAT_MEMBER)); > expectedProblemAttributes.put("ParameterizedConstructorArgumentTypeMismatch", new ProblemAttributes(CategorizedProblem.CAT_TYPE)); > expectedProblemAttributes.put("ParameterizedMethodArgumentTypeMismatch", new ProblemAttributes(CategorizedProblem.CAT_TYPE)); >- expectedProblemAttributes.put("ParameterMismatch", new ProblemAttributes(CategorizedProblem.CAT_MEMBER)); > expectedProblemAttributes.put("ParsingError", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); > expectedProblemAttributes.put("ParsingErrorDeleteToken", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); > expectedProblemAttributes.put("ParsingErrorDeleteTokens", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); >@@ -760,7 +761,8 @@ > expectedProblemAttributes.put("ParsingErrorOnKeywordNoSuggestion", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); > expectedProblemAttributes.put("ParsingErrorReplaceTokens", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); > expectedProblemAttributes.put("ParsingErrorUnexpectedEOF", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX)); >- expectedProblemAttributes.put("PolymorphicMethodNotBelow17", new ProblemAttributes(CategorizedProblem.CAT_MEMBER)); expectedProblemAttributes.put("PossibleAccidentalBooleanAssignment", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM)); >+ expectedProblemAttributes.put("PolymorphicMethodNotBelow17", new ProblemAttributes(CategorizedProblem.CAT_MEMBER)); >+ expectedProblemAttributes.put("PossibleAccidentalBooleanAssignment", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM)); > expectedProblemAttributes.put("PotentialHeapPollutionFromVararg", new ProblemAttributes(CategorizedProblem.CAT_UNCHECKED_RAW)); > expectedProblemAttributes.put("PotentialNullLocalVariableReference", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM)); > expectedProblemAttributes.put("PublicClassMustMatchFileName", new ProblemAttributes(CategorizedProblem.CAT_TYPE)); >@@ -769,6 +771,7 @@ > expectedProblemAttributes.put("RecursiveConstructorInvocation", new ProblemAttributes(CategorizedProblem.CAT_MEMBER)); > expectedProblemAttributes.put("RedefinedArgument", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL)); > expectedProblemAttributes.put("RedefinedLocal", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL)); >+ expectedProblemAttributes.put("RedundantDeclarationOfTypeArguments", new ProblemAttributes(CategorizedProblem.CAT_UNNECESSARY_CODE)); > expectedProblemAttributes.put("RedundantLocalVariableNullAssignment", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM)); > expectedProblemAttributes.put("RedundantNullCheckOnNonNullLocalVariable", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM)); > expectedProblemAttributes.put("RedundantNullCheckOnNullLocalVariable", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM)); >@@ -790,6 +793,9 @@ > expectedProblemAttributes.put("StaticMemberOfParameterizedType", new ProblemAttributes(CategorizedProblem.CAT_TYPE)); > expectedProblemAttributes.put("StaticMethodRequested", new ProblemAttributes(CategorizedProblem.CAT_MEMBER)); > expectedProblemAttributes.put("StringConstantIsExceedingUtf8Limit", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL)); >+ expectedProblemAttributes.put("SuperInterfaceMustBeAnInterface", new ProblemAttributes(CategorizedProblem.CAT_TYPE)); >+ expectedProblemAttributes.put("SuperInterfacesCollide", new ProblemAttributes(CategorizedProblem.CAT_TYPE)); >+ expectedProblemAttributes.put("SuperTypeUsingWildcard", new ProblemAttributes(CategorizedProblem.CAT_TYPE)); > expectedProblemAttributes.put("SuperclassAmbiguous", DEPRECATED); > expectedProblemAttributes.put("SuperclassInheritedNameHidesEnclosingName", DEPRECATED); > expectedProblemAttributes.put("SuperclassInternalNameProvided", DEPRECATED); >@@ -797,9 +803,6 @@ > expectedProblemAttributes.put("SuperclassNotFound", DEPRECATED); > expectedProblemAttributes.put("SuperclassNotVisible", DEPRECATED); > expectedProblemAttributes.put("SuperfluousSemicolon", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM)); >- expectedProblemAttributes.put("SuperInterfaceMustBeAnInterface", new ProblemAttributes(CategorizedProblem.CAT_TYPE)); >- expectedProblemAttributes.put("SuperInterfacesCollide", new ProblemAttributes(CategorizedProblem.CAT_TYPE)); >- expectedProblemAttributes.put("SuperTypeUsingWildcard", new ProblemAttributes(CategorizedProblem.CAT_TYPE)); > expectedProblemAttributes.put("Task", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL)); > expectedProblemAttributes.put("ThisInStaticContext", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL)); > expectedProblemAttributes.put("ThisSuperDuringConstructorInvocation", new ProblemAttributes(CategorizedProblem.CAT_MEMBER)); >@@ -847,7 +850,6 @@ > expectedProblemAttributes.put("UnnecessaryCast", new ProblemAttributes(CategorizedProblem.CAT_UNNECESSARY_CODE)); > expectedProblemAttributes.put("UnnecessaryElse", new ProblemAttributes(CategorizedProblem.CAT_UNNECESSARY_CODE)); > expectedProblemAttributes.put("UnnecessaryInstanceof", new ProblemAttributes(CategorizedProblem.CAT_UNNECESSARY_CODE)); >- expectedProblemAttributes.put("UnnecessaryOperator", new ProblemAttributes(CategorizedProblem.CAT_UNNECESSARY_CODE)); > expectedProblemAttributes.put("UnnecessaryNLSTag", new ProblemAttributes(CategorizedProblem.CAT_NLS)); > expectedProblemAttributes.put("UnqualifiedFieldAccess", new ProblemAttributes(CategorizedProblem.CAT_CODE_STYLE)); > expectedProblemAttributes.put("UnreachableCatch", new ProblemAttributes(CategorizedProblem.CAT_TYPE)); >@@ -1080,8 +1082,8 @@ > expectedProblemAttributes.put("DuplicateParameterizedMethods", SKIP); > expectedProblemAttributes.put("DuplicateSuperInterface", SKIP); > expectedProblemAttributes.put("DuplicateTargetInTargetAnnotation", SKIP); >- expectedProblemAttributes.put("DuplicateTypes", SKIP); > expectedProblemAttributes.put("DuplicateTypeVariable", SKIP); >+ expectedProblemAttributes.put("DuplicateTypes", SKIP); > expectedProblemAttributes.put("EmptyControlFlowStatement", new ProblemAttributes(JavaCore.COMPILER_PB_EMPTY_STATEMENT)); > expectedProblemAttributes.put("EnclosingInstanceInConstructorCall", SKIP); > expectedProblemAttributes.put("EndOfSource", SKIP); >@@ -1110,9 +1112,9 @@ > expectedProblemAttributes.put("FieldTypeNotVisible", SKIP); > expectedProblemAttributes.put("FinalBoundForTypeVariable", new ProblemAttributes(JavaCore.COMPILER_PB_FINAL_PARAMETER_BOUND)); > expectedProblemAttributes.put("FinalFieldAssignment", SKIP); >- expectedProblemAttributes.put("FinallyMustCompleteNormally", new ProblemAttributes(JavaCore.COMPILER_PB_FINALLY_BLOCK_NOT_COMPLETING)); > expectedProblemAttributes.put("FinalMethodCannotBeOverridden", SKIP); > expectedProblemAttributes.put("FinalOuterLocalAssignment", SKIP); >+ expectedProblemAttributes.put("FinallyMustCompleteNormally", new ProblemAttributes(JavaCore.COMPILER_PB_FINALLY_BLOCK_NOT_COMPLETING)); > expectedProblemAttributes.put("ForbiddenReference", new ProblemAttributes(JavaCore.COMPILER_PB_FORBIDDEN_REFERENCE)); > expectedProblemAttributes.put("GenericConstructorTypeArgumentMismatch", SKIP); > expectedProblemAttributes.put("GenericMethodTypeArgumentMismatch", SKIP); >@@ -1216,7 +1218,6 @@ > expectedProblemAttributes.put("InvalidContinue", SKIP); > expectedProblemAttributes.put("InvalidDigit", SKIP); > expectedProblemAttributes.put("InvalidDisjunctiveTypeReferenceSequence", SKIP); >- expectedProblemAttributes.put("InvalidEmptyExoticIdentifier", SKIP); > expectedProblemAttributes.put("InvalidEncoding", SKIP); > expectedProblemAttributes.put("InvalidEscape", SKIP); > expectedProblemAttributes.put("InvalidExplicitConstructorCall", SKIP); >@@ -1242,6 +1243,7 @@ > expectedProblemAttributes.put("InvalidUnicodeEscape", SKIP); > expectedProblemAttributes.put("InvalidUsageOfAnnotationDeclarations", SKIP); > expectedProblemAttributes.put("InvalidUsageOfAnnotations", SKIP); >+ expectedProblemAttributes.put("InvalidUsageOfDiamondConstruct", SKIP); > expectedProblemAttributes.put("InvalidUsageOfEnumDeclarations", SKIP); > expectedProblemAttributes.put("InvalidUsageOfForeachStatements", SKIP); > expectedProblemAttributes.put("InvalidUsageOfStaticImports", SKIP); >@@ -1305,9 +1307,9 @@ > expectedProblemAttributes.put("JavadocNotVisibleField", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC)); > expectedProblemAttributes.put("JavadocNotVisibleMethod", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC)); > expectedProblemAttributes.put("JavadocNotVisibleType", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC)); >+ expectedProblemAttributes.put("JavadocParameterMismatch", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC)); > expectedProblemAttributes.put("JavadocParameterizedConstructorArgumentTypeMismatch", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC)); > expectedProblemAttributes.put("JavadocParameterizedMethodArgumentTypeMismatch", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC)); >- expectedProblemAttributes.put("JavadocParameterMismatch", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC)); > expectedProblemAttributes.put("JavadocTypeArgumentsForRawGenericConstructor", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC)); > expectedProblemAttributes.put("JavadocTypeArgumentsForRawGenericMethod", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC)); > expectedProblemAttributes.put("JavadocUndefinedConstructor", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC)); >@@ -1321,16 +1323,16 @@ > expectedProblemAttributes.put("JavadocUsingDeprecatedField", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC)); > expectedProblemAttributes.put("JavadocUsingDeprecatedMethod", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC)); > expectedProblemAttributes.put("JavadocUsingDeprecatedType", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC)); >- expectedProblemAttributes.put("LocalVariableCannotBeNull", SKIP); > expectedProblemAttributes.put("LocalVariableCanOnlyBeNull", SKIP); >+ expectedProblemAttributes.put("LocalVariableCannotBeNull", SKIP); > expectedProblemAttributes.put("LocalVariableHidingField", new ProblemAttributes(JavaCore.COMPILER_PB_LOCAL_VARIABLE_HIDING)); > expectedProblemAttributes.put("LocalVariableHidingLocalVariable", new ProblemAttributes(JavaCore.COMPILER_PB_LOCAL_VARIABLE_HIDING)); > expectedProblemAttributes.put("LocalVariableIsNeverUsed", new ProblemAttributes(JavaCore.COMPILER_PB_UNUSED_LOCAL)); > expectedProblemAttributes.put("LocalVariableMayBeNull", SKIP); > expectedProblemAttributes.put("MaskedCatch", new ProblemAttributes(JavaCore.COMPILER_PB_HIDDEN_CATCH_BLOCK)); > expectedProblemAttributes.put("MethodButWithConstructorName", new ProblemAttributes(JavaCore.COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME)); >- expectedProblemAttributes.put("MethodCanBeStatic", new ProblemAttributes(JavaCore.COMPILER_PB_MISSING_STATIC_ON_METHOD)); > expectedProblemAttributes.put("MethodCanBePotentiallyStatic", new ProblemAttributes(JavaCore.COMPILER_PB_POTENTIALLY_MISSING_STATIC_ON_METHOD)); >+ expectedProblemAttributes.put("MethodCanBeStatic", new ProblemAttributes(JavaCore.COMPILER_PB_MISSING_STATIC_ON_METHOD)); > expectedProblemAttributes.put("MethodMissingDeprecatedAnnotation", new ProblemAttributes(JavaCore.COMPILER_PB_MISSING_DEPRECATED_ANNOTATION)); > expectedProblemAttributes.put("MethodMustOverride", SKIP); > expectedProblemAttributes.put("MethodMustOverrideOrImplement", SKIP); >@@ -1344,7 +1346,7 @@ > expectedProblemAttributes.put("MissingEnclosingInstanceForConstructorCall", SKIP); > expectedProblemAttributes.put("MissingEnumConstantCase", new ProblemAttributes(JavaCore.COMPILER_PB_INCOMPLETE_ENUM_SWITCH)); > expectedProblemAttributes.put("MissingOverrideAnnotation", new ProblemAttributes(JavaCore.COMPILER_PB_MISSING_OVERRIDE_ANNOTATION)); >- expectedProblemAttributes.put("MissingOverrideAnnotationForInterfaceMethodImplementation", SKIP); >+ expectedProblemAttributes.put("MissingOverrideAnnotationForInterfaceMethodImplementation", new ProblemAttributes(JavaCore.COMPILER_PB_MISSING_OVERRIDE_ANNOTATION)); > expectedProblemAttributes.put("MissingReturnType", SKIP); > expectedProblemAttributes.put("MissingSemiColon", SKIP); > expectedProblemAttributes.put("MissingSerialVersion", new ProblemAttributes(JavaCore.COMPILER_PB_MISSING_SERIAL_VERSION)); >@@ -1399,9 +1401,9 @@ > expectedProblemAttributes.put("PackageCollidesWithType", SKIP); > expectedProblemAttributes.put("PackageIsNotExpectedPackage", SKIP); > expectedProblemAttributes.put("ParameterAssignment", new ProblemAttributes(JavaCore.COMPILER_PB_PARAMETER_ASSIGNMENT)); >+ expectedProblemAttributes.put("ParameterMismatch", SKIP); > expectedProblemAttributes.put("ParameterizedConstructorArgumentTypeMismatch", SKIP); > expectedProblemAttributes.put("ParameterizedMethodArgumentTypeMismatch", SKIP); >- expectedProblemAttributes.put("ParameterMismatch", SKIP); > expectedProblemAttributes.put("ParsingError", SKIP); > expectedProblemAttributes.put("ParsingErrorDeleteToken", SKIP); > expectedProblemAttributes.put("ParsingErrorDeleteTokens", SKIP); >@@ -1429,6 +1431,7 @@ > expectedProblemAttributes.put("RecursiveConstructorInvocation", SKIP); > expectedProblemAttributes.put("RedefinedArgument", SKIP); > expectedProblemAttributes.put("RedefinedLocal", SKIP); >+ expectedProblemAttributes.put("RedundantDeclarationOfTypeArguments", new ProblemAttributes(JavaCore.COMPILER_PB_REDUNDANT_DECLARATION_OF_TYPE_ARGS)); > expectedProblemAttributes.put("RedundantLocalVariableNullAssignment", new ProblemAttributes(JavaCore.COMPILER_PB_REDUNDANT_NULL_CHECK)); > expectedProblemAttributes.put("RedundantNullCheckOnNonNullLocalVariable", new ProblemAttributes(JavaCore.COMPILER_PB_REDUNDANT_NULL_CHECK)); > expectedProblemAttributes.put("RedundantNullCheckOnNullLocalVariable", new ProblemAttributes(JavaCore.COMPILER_PB_REDUNDANT_NULL_CHECK)); >@@ -1450,16 +1453,16 @@ > expectedProblemAttributes.put("StaticMemberOfParameterizedType", SKIP); > expectedProblemAttributes.put("StaticMethodRequested", SKIP); > expectedProblemAttributes.put("StringConstantIsExceedingUtf8Limit", SKIP); >- expectedProblemAttributes.put("SuperclassAmbiguous", SKIP); >+ expectedProblemAttributes.put("SuperInterfaceMustBeAnInterface", SKIP); >+ expectedProblemAttributes.put("SuperInterfacesCollide", SKIP); >+ expectedProblemAttributes.put("SuperTypeUsingWildcard", SKIP); >+ expectedProblemAttributes.put("SuperclassAmbiguous", new ProblemAttributes(JavaCore.COMPILER_PB_MISSING_HASHCODE_METHOD)); > expectedProblemAttributes.put("SuperclassInheritedNameHidesEnclosingName", SKIP); > expectedProblemAttributes.put("SuperclassInternalNameProvided", SKIP); > expectedProblemAttributes.put("SuperclassMustBeAClass", SKIP); > expectedProblemAttributes.put("SuperclassNotFound", SKIP); > expectedProblemAttributes.put("SuperclassNotVisible", new ProblemAttributes(JavaCore.COMPILER_PB_REDUNDANT_SUPERINTERFACE)); > expectedProblemAttributes.put("SuperfluousSemicolon", new ProblemAttributes(JavaCore.COMPILER_PB_EMPTY_STATEMENT)); >- expectedProblemAttributes.put("SuperInterfaceMustBeAnInterface", SKIP); >- expectedProblemAttributes.put("SuperInterfacesCollide", SKIP); >- expectedProblemAttributes.put("SuperTypeUsingWildcard", SKIP); > expectedProblemAttributes.put("Task", SKIP); > expectedProblemAttributes.put("ThisInStaticContext", SKIP); > expectedProblemAttributes.put("ThisSuperDuringConstructorInvocation", SKIP); >Index: src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest.java,v >retrieving revision 1.5.2.4 >diff -u -r1.5.2.4 GenericsRegressionTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest.java 15 Mar 2011 12:06:25 -0000 1.5.2.4 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest.java 22 Mar 2011 19:06:20 -0000 >@@ -1740,4 +1740,48 @@ > compilerOptions15, > null); > } >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=339478 >+// To verify that diamond construct is not allowed in source level 1.6 or below >+public void test339478a() { >+ if (this.complianceLevel >= ClassFileConstants.JDK1_7) >+ return; >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X<T> {\n" + >+ " public static void main(String[] args) {\n" + >+ " X<String> x = new X<>();\n" + >+ " x.testFunction(\"SUCCESS\");\n" + >+ " }\n" + >+ " public void testFunction(T param){\n" + >+ " System.out.println(param);\n" + >+ " }\n" + >+ "}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 3)\n" + >+ " X<String> x = new X<>();\n" + >+ " ^\n" + >+ "Incorrect number of arguments for type X<T>; it cannot be parameterized with arguments <>\n" + >+ "----------\n"); >+} >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=339478 >+// To verify that diamond construct is not allowed in source level 1.6 or below >+public void test339478b() { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X<T> {\n" + >+ " public static void main(String[] args) {\n" + >+ " X<> x1 = null;\n" + >+ " }\n" + >+ "}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 3)\n" + >+ " X<> x1 = null;\n" + >+ " ^\n" + >+ "Incorrect number of arguments for type X<T>; it cannot be parameterized with arguments <>\n" + >+ "----------\n"); >+} > } >\ No newline at end of file >Index: src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_7.java >=================================================================== >RCS file: src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_7.java >diff -N src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_7.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_7.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,683 @@ >+/******************************************************************************* >+ * Copyright (c) 2011 IBM Corporation. >+ * 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jdt.core.tests.compiler.regression; >+ >+import java.util.Map; >+ >+import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; >+ >+import junit.framework.Test; >+public class GenericsRegressionTest_1_7 extends AbstractRegressionTest { >+ >+static { >+// TESTS_NAMES = new String[] { "test0014" }; >+// TESTS_NUMBERS = new int[] { 40, 41, 43, 45, 63, 64 }; >+// TESTS_RANGE = new int[] { 11, -1 }; >+} >+public GenericsRegressionTest_1_7(String name) { >+ super(name); >+} >+public static Test suite() { >+ return buildMinimalComplianceTestSuite(testClass(), F_1_7); >+} >+public void test001() { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "public class X<T> {\n" + >+ " public static void main(String[] args) {\n" + >+ " X<String> x = new X<>();\n" + >+ " x.testFunction(\"SUCCESS\");\n" + >+ " }\n" + >+ " public void testFunction(T param){\n" + >+ " System.out.println(param);\n" + >+ " }\n" + >+ "}", >+ }, >+ "SUCCESS"); >+} >+public void test001a() { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X<T> {\n" + >+ " public static void main(String[] args) {\n" + >+ " X<String> x = new X<>();\n" + >+ " x.testFunction(1);\n" + >+ " }\n" + >+ " public void testFunction(T param){\n" + >+ " System.out.println(param);\n" + >+ " }\n" + >+ "}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 4)\n" + >+ " x.testFunction(1);\n" + >+ " ^^^^^^^^^^^^\n" + >+ "The method testFunction(String) in the type X<String> is not applicable for the arguments (int)\n" + >+ "----------\n"); >+} >+public void test001b() { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "public class X<T> {\n" + >+ " public static void main(String[] args) {\n" + >+ " java.util.ArrayList<String> x = new java.util.ArrayList<>();\n" + >+ " x.add(\"\");\n" + >+ " System.out.println(\"SUCCESS\");\n" + >+ " }\n" + >+ "}", >+ }, >+ "SUCCESS"); >+} >+public void test001c() { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X<T> {\n" + >+ " public static void main(String[] args) {\n" + >+ " java.util.ArrayList<String> x = new java.util.ArrayList<>();\n" + >+ " x.add(1);\n" + >+ " System.out.println(\"SUCCESS\");\n" + >+ " }\n" + >+ "}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 4)\n" + >+ " x.add(1);\n" + >+ " ^^^\n" + >+ "The method add(int, String) in the type ArrayList<String> is not applicable for the arguments (int)\n" + >+ "----------\n"); >+} >+public void _test001d() { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "import java.util.ArrayList;\n" + >+ "public class X<T> {" + >+ " public void ab(ArrayList<String> al){\n" + >+ " System.out.println(\"SUCCESS\");\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " X<String> x = new X<>();\n" + >+ " x.ab(new ArrayList<>());\n" + >+ " }\n" + >+ "}", >+ }, >+ "SUCCESS"); >+} >+public void _test001e() { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "import java.util.ArrayList;\n" + >+ "public class X<T> {" + >+ " public void ab(ArrayList<T> al){\n" + >+ " System.out.println(\"SUCCESS\");\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " X<String> x = new X<>();\n" + >+ " x.ab(new ArrayList<>());\n" + >+ " }\n" + >+ "}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 7)\n" + >+ " x.ab(new ArrayList<Integer>());\n" + >+ " ^^\n" + >+ "The method ab(ArrayList<String>) in the type X<String> is not applicable for the arguments (ArrayList<Integer>)\n" + >+ "----------\n"); >+} >+public void test001f() { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "public class X<T> {\n" + >+ " class X2<T>{\n" + >+ " void methodx(T param){\n" + >+ " System.out.println(param);\n" + >+ " }\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " X<String>.X2<String> x = new X<>().new X2<>();\n" + >+ " x.methodx(\"SUCCESS\");\n" + >+ " }\n" + >+ "}", >+ }, >+ "SUCCESS"); >+} >+public void test001g() { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "public class X<T> {\n" + >+ " class X2<K>{\n" + >+ " void methodx(T param, K param2){\n" + >+ " System.out.println(param);\n" + >+ " System.out.println(param2);\n" + >+ " }\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " X<String>.X2<Integer> x = new X<>().new X2<>();\n" + >+ " x.methodx(\"SUCCESS\",1);\n" + >+ " }\n" + >+ "}", >+ }, >+ "SUCCESS\n1"); >+} >+public void test001h() { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X<T> {\n" + >+ " class X2<T>{\n" + >+ " void methodx(T param){\n" + >+ " System.out.println(param);\n" + >+ " }\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " X<String>.X2<String> x = new X<>().new X2<>();\n" + >+ " x.methodx(1);\n" + >+ " }\n" + >+ "}", >+ }, >+ "----------\n" + >+ "1. WARNING in X.java (at line 2)\n" + >+ " class X2<T>{\n" + >+ " ^\n" + >+ "The type parameter T is hiding the type T\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 9)\n" + >+ " x.methodx(1);\n" + >+ " ^^^^^^^\n" + >+ "The method methodx(String) in the type X<String>.X2<String> is not applicable for the arguments (int)\n" + >+ "----------\n"); >+} >+public void test001i() { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "public class X<T> {\n" + >+ " class X2<K>{\n" + >+ " class X22<I>{\n" + >+ " void methodx(T param, K param2, I param3){\n" + >+ " System.out.println(param);\n" + >+ " }\n" + >+ " }\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " X<String> test = new X<>();" + >+ " X<String>.X2<Integer>.X22<X<String>> x = new X<>().new X2<>().new X22<>();\n" + >+ " x.methodx(\"SUCCESS\", 1, test);\n" + >+ " }\n" + >+ "}", >+ }, >+ "SUCCESS"); >+} >+public void test002() { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X<T> {\n" + >+ " public static void main(String[] args) {\n" + >+ " X x = new X<>();\n" + >+ " x.testFunction(\"SUCCESS\");\n" + >+ " }\n" + >+ " public void testFunction(T param){\n" + >+ " System.out.println(param);\n" + >+ " }\n" + >+ "}", >+ }, >+ "----------\n" + >+ "1. WARNING in X.java (at line 3)\n" + >+ " X x = new X<>();\n" + >+ " ^\n" + >+ "X is a raw type. References to generic type X<T> should be parameterized\n" + >+ "----------\n" + >+ "2. WARNING in X.java (at line 4)\n" + >+ " x.testFunction(\"SUCCESS\");\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type safety: The method testFunction(Object) belongs to the raw type X. References to generic type X<T> should be parameterized\n" + >+ "----------\n"); >+} >+public void _test003() { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X<T> {\n" + >+ " public static void main(String[] args) {\n" + >+ " new X<>().testFunction(\"SUCCESS\");\n" + >+ " }\n" + >+ " public void testFunction(T param){\n" + >+ " System.out.println(param);\n" + >+ " }\n" + >+ "}", >+ }, >+ "SUCCESS"); >+} >+public void test004() { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X<T> {\n" + >+ " public static void main(String[] args) {\n" + >+ " new X<>(){\n" + >+ " void newMethod(){\n" + >+ " }\n" + >+ " }.testFunction(\"SUCCESS\");\n" + >+ " }\n" + >+ " public void testFunction(T param){\n" + >+ " System.out.println(param);\n" + >+ " }\n" + >+ "}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 3)\n" + >+ " new X<>(){\n" + >+ " ^\n" + >+ "Empty type argument list cannot be used in anonymous class declaration\n" + >+ "----------\n"); >+} >+public void test004b() { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X<T> {\n" + >+ " class X2<U> {\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " new X<>().new X2<>(){\n" + >+ " void newMethod(){\n" + >+ " }\n" + >+ " };\n" + >+ " }\n" + >+ "}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 5)\n" + >+ " new X<>().new X2<>(){\n" + >+ " ^^\n" + >+ "Empty type argument list cannot be used in anonymous class declaration\n" + >+ "----------\n"); >+} >+public void test004c() { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "public class X<T> {\n" + >+ " class X2<U> {\n" + >+ " U f1;" + >+ " public void setF(U a){\n" + >+ " this.f1 = a;" + >+ " System.out.println(this.f1);\n" + >+ " }\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " new X<>().new X2<Integer>(){\n" + >+ " void newMethod(){\n" + >+ " }\n" + >+ " }.setF(1);\n" + >+ " }\n" + >+ "}", >+ }, >+ "1"); >+} >+public void test005() { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X<T> {\n" + >+ " public static void main(String[] args) {\n" + >+ " X Test = new X<>(){\n" + >+ " void newMethod(){\n" + >+ " }\n" + >+ " }.testFunction(\"SUCCESS\");\n" + >+ " }\n" + >+ " public void testFunction(T param){\n" + >+ " System.out.println(param);\n" + >+ " }\n" + >+ "}", >+ }, >+ "----------\n" + >+ "1. WARNING in X.java (at line 3)\n" + >+ " X Test = new X<>(){\n" + >+ " ^\n" + >+ "X is a raw type. References to generic type X<T> should be parameterized\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 3)\n" + >+ " X Test = new X<>(){\n" + >+ " ^\n" + >+ "Empty type argument list cannot be used in anonymous class declaration\n" + >+ "----------\n"); >+} >+public void test006() { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "class X1<T> {\n" + >+ " int abc = 1;\n" + >+ " public void testFunction(T param){\n" + >+ " System.out.println(param + \"X1\");\n" + >+ " }\n" + >+ "}\n" + >+ "public class X<T> extends X1<T> {\n" + >+ " public static void main(String[] args) {\n" + >+ " X1<String> x = new X<>();\n" + >+ " x.testFunction(\"SUCCESS\");\n" + >+ " }\n" + >+ " public void testFunction(T param){\n" + >+ " System.out.println(param);\n" + >+ " }\n" + >+ "}", >+ }, >+ "SUCCESS"); >+} >+// shows the difference between using <> and the raw type - different semantics >+public void _test007() { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "public class X<T> {\n" + >+ " T field1;" + >+ " public X(T param){\n" + >+ " field1 = param;\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " X.testFunction(new X<>(\"hello\").getField());\n" + // prints 1 >+ " X.testFunction(new X(\"hello\").getField());\n" + //prints 2 >+ " }\n" + >+ " public static void testFunction(String param){\n" + >+ " System.out.println(1);\n" + >+ " }\n" + >+ " public static void testFunction(Object param){\n" + >+ " System.out.println(2);\n" + >+ " }\n" + >+ " public T getField(){\n" + >+ " return field1;" + >+ " }\n" + >+ "}", >+ }, >+ "1\n" + >+ "2"); >+} >+// to verify if diamond works inside an allocation expression in a method invocation >+public void _test007a() { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "public class X<T> {\n" + >+ " public X(){\n" + >+ " }\n" + >+ " public X(T param){\n" + >+ " System.out.println(param);\n" + >+ " }\n" + >+ " public static void testFunction(X<String> param){\n" + >+ " System.out.println(\"SUCCESS\");\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " X.testFunction(new X<>());\n" + >+ " X.testFunction(new X(\"hello\"));\n" + >+ " }\n" + >+ "}", >+ }, >+ "1\n" + >+ "2"); >+} >+//shows the difference between using <> and the raw type - different semantics >+public void _test008() { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "public class X<T> {\n" + >+ " T field1;" + >+ " public X(T param){\n" + >+ " field1 = param;\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " X<?> x1 = new X(1).get(\"\");\n" + // ok - passing String where Object is expected >+ " X<?> x2 = new X<>(1).get(\"\");\n" + // bad - passing String where Integer is expected >+ " }\n" + >+ " public X<T> get(T t){\n" + >+ " return this;" + >+ " }\n" + >+ "}", >+ }, >+ "1\n" + >+ "2"); >+} >+public void test009() { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X<T> {\n" + >+ " public static void main(String[] args) {\n" + >+ " X<>[] x1 = null;\n" + >+ " }\n" + >+ "}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 3)\n" + >+ " X<>[] x1 = null;\n" + >+ " ^\n" + >+ "Incorrect number of arguments for type X<T>; it cannot be parameterized with arguments <>\n" + >+ "----------\n"); >+} >+public void test010() { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X<T> {\n" + >+ " public static void main(String[] args) {\n" + >+ " X<> x1 = null;\n" + >+ " }\n" + >+ "}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 3)\n" + >+ " X<> x1 = null;\n" + >+ " ^\n" + >+ "Incorrect number of arguments for type X<T>; it cannot be parameterized with arguments <>\n" + >+ "----------\n"); >+} >+public void test011() { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X<T> {\n" + >+ " public void foo(X<> args) {\n" + >+ " }\n" + >+ "}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 2)\n" + >+ " public void foo(X<> args) {\n" + >+ " ^\n" + >+ "Incorrect number of arguments for type X<T>; it cannot be parameterized with arguments <>\n" + >+ "----------\n"); >+} >+public void test012() { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X<T> {\n" + >+ " X<> f1 = null;\n" + >+ "}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 2)\n" + >+ " X<> f1 = null;\n" + >+ " ^\n" + >+ "Incorrect number of arguments for type X<>; it cannot be parameterized with arguments <>\n" + >+ "----------\n"); >+} >+public void test013() { >+ Map options = getCompilerOptions(); >+ options.put(CompilerOptions.OPTION_ReportRedundantDeclarationOfTypeArguments, CompilerOptions.ERROR); >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X<T> {\n" + >+ " X<String> f1 = new X<String>();\n" + >+ " public void foo() {\n" + >+ " X<Integer> i1 = new X<Integer>();\n" + >+ " }\n" + >+ "}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 2)\n" + >+ " X<String> f1 = new X<String>();\n" + >+ " ^^^^^^^^^^^^^^^\n" + >+ "Redundant declaration of type arguments <String>\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 4)\n" + >+ " X<Integer> i1 = new X<Integer>();\n" + >+ " ^^^^^^^^^^^^^^^^\n" + >+ "Redundant declaration of type arguments <Integer>\n" + >+ "----------\n", >+ null, >+ true, >+ options); >+} >+public void test013a() { >+ Map options = getCompilerOptions(); >+ options.put(CompilerOptions.OPTION_ReportRedundantDeclarationOfTypeArguments, CompilerOptions.ERROR); >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "public class X<T> {\n" + >+ " class Y<U>{}\n" + >+ " Y<String> f1 = new Y();\n" + >+ " public static void main(String[] args) {\n" + >+ " X<Integer> i1 = new X<>();\n" + >+ " System.out.println(\"SUCCESS\");\n" + >+ " }\n" + >+ "}", >+ }, >+ "SUCCESS", >+ null, >+ true, >+ null, >+ options, >+ null); >+} >+public void test0014() { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "public class X<J,K> {\n" + >+ " public static void main(String[] args) {\n" + >+ " X<String,Integer> x = new X<>();\n" + >+ " x.testFunction(\"SUCCESS\", 123);\n" + >+ " }\n" + >+ " public void testFunction(J param, K param2){\n" + >+ " System.out.println(param);\n" + >+ " System.out.println(param2);\n" + >+ " }\n" + >+ "}", >+ }, >+ "SUCCESS\n" + >+ "123"); >+} >+public void test0014a() { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X<J,K> {\n" + >+ " public static void main(String[] args) {\n" + >+ " X<String,Integer> x = new X<>();\n" + >+ " x.testFunction(123, \"SUCCESS\");\n" + >+ " }\n" + >+ " public void testFunction(J param, K param2){\n" + >+ " System.out.println(param);\n" + >+ " System.out.println(param2);\n" + >+ " }\n" + >+ "}", >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 4)\n" + >+ " x.testFunction(123, \"SUCCESS\");\n" + >+ " ^^^^^^^^^^^^\n" + >+ "The method testFunction(String, Integer) in the type X<String,Integer> is not applicable for the arguments (int, String)\n" + >+ "----------\n"); >+} >+public void test0015() { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "public class X<T> {\n" + >+ " X(){\n" + >+ " System.out.println(\"const.1\");\n" + >+ " }\n" + >+ " X (T t) {\n" + >+ " System.out.println(\"const.2\");\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " X<String> x = new X<>();\n" + >+ " X<String> x2 = new X<>(\"\");\n" + >+ " }\n" + >+ "}", >+ }, >+ "const.1\nconst.2"); >+} >+// To verify that a parameterized invocation of a generic constructor works even if <> is used >+// to elide class type parameters. >+public void test0016() { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "public class X<T> {\n" + >+ " <E> X(){\n" + >+ " System.out.println(\"const.1\");\n" + >+ " }\n" + >+ " <K,J> X (Integer i) {\n" + >+ " System.out.println(\"const.2\");\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " X<String> x = new <String>X<>();\n" + >+ " X<String> x2 = new <String, Integer>X<>(1);\n" + >+ " }\n" + >+ "}", >+ }, >+ "const.1\nconst.2"); >+} >+// To verify that a parameterized invocation of a non-generic constructor works even if <> is used >+// to elide class type parameters. >+// This was not allowed in java 1.6 and 1.5 (https://bugs.eclipse.org/bugs/show_bug.cgi?id=168230) >+public void test0017() { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "public class X<T> {\n" + >+ " X(int i){\n" + >+ " System.out.println(\"const.1\");\n" + >+ " }\n" + >+ " <K,J> X (Integer i) {\n" + >+ " System.out.println(\"const.2\");\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " X<String> x = new X<>(1);\n" + >+ " X<String> x2 = new <String, Integer>X<>(1);\n" + >+ " Integer i = 1;\n" + >+ " X<String> x3 = new <String, Integer>X<>(i);\n" + >+ " }\n" + >+ "}", >+ }, >+ "const.1\nconst.1\nconst.2"); >+} >+public static Class testClass() { >+ return GenericsRegressionTest_1_7.class; >+} >+} >Index: src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java,v >retrieving revision 1.90.2.3 >diff -u -r1.90.2.3 TestAll.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java 9 Feb 2011 15:14:35 -0000 1.90.2.3 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java 22 Mar 2011 19:06:23 -0000 >@@ -172,6 +172,7 @@ > tests_1_7.add(UnderscoresInLiteralsTest.class); > tests_1_7.add(TryStatement17Test.class); > tests_1_7.add(TryWithResourcesStatementTest.class); >+ tests_1_7.add(GenericsRegressionTest_1_7.class); > // Reset forgotten subsets tests > TestCase.TESTS_PREFIX = null; > TestCase.TESTS_NAMES = null;
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 339478
:
190845
|
191332
|
191458
|
191707
|
191785
|
191891
|
191902
|
191946
|
191947
|
191984
|
192058
|
193887
|
193901
|
193918
|
193951
|
193962
|
193963