Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 339478 | Differences between
and this patch

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/core/compiler/IProblem.java (+2 lines)
Lines 1373-1378 Link Here
1373
	int InvalidDisjunctiveTypeReferenceSequence = Internal + TypeRelated + 873; 
1373
	int InvalidDisjunctiveTypeReferenceSequence = Internal + TypeRelated + 873; 
1374
	/** @since 3.7 */
1374
	/** @since 3.7 */
1375
	int AutoManagedResourceNotBelow17 = Syntax + Internal + 874;
1375
	int AutoManagedResourceNotBelow17 = Syntax + Internal + 874;
1376
	/** @since 3.7 */
1377
	int InvalidUsageOfDiamondConstruct = Syntax + TypeRelated + 875;
1376
	/**
1378
	/**
1377
	 * External problems -- These are problems defined by other plugins
1379
	 * External problems -- These are problems defined by other plugins
1378
	 */
1380
	 */
(-)compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java (-2 / +11 lines)
Lines 157-163 Link Here
157
	}
157
	}
158
158
159
	public void resolve(BlockScope scope) {
159
	public void resolve(BlockScope scope) {
160
160
		boolean isCompliant17 = scope.compilerOptions().originalSourceLevel >= ClassFileConstants.JDK1_7;
161
		// create a binding and add it to the scope
161
		// create a binding and add it to the scope
162
		TypeBinding variableType = this.type.resolveType(scope, true /* check bounds*/);
162
		TypeBinding variableType = this.type.resolveType(scope, true /* check bounds*/);
163
163
Lines 171-176 Link Here
171
				scope.problemReporter().variableTypeCannotBeVoidArray(this);
171
				scope.problemReporter().variableTypeCannotBeVoidArray(this);
172
				return;
172
				return;
173
			}
173
			}
174
			if (isCompliant17 && variableType.isParameterizedType() && (this.type.bits & ASTNode.IsDiamond) != 0) {
175
				scope.problemReporter().incorrectArityForParameterizedType(this.type, variableType.original(), ((ParameterizedTypeBinding)variableType).arguments);
176
				return;
177
			}
174
		}
178
		}
175
179
176
		Binding existingVariable = scope.getBinding(this.name, Binding.VARIABLE, this, false /*do not resolve hidden field*/);
180
		Binding existingVariable = scope.getBinding(this.name, Binding.VARIABLE, this, false /*do not resolve hidden field*/);
Lines 207-218 Link Here
207
				}
211
				}
208
			} else {
212
			} else {
209
			    this.initialization.setExpectedType(variableType);
213
			    this.initialization.setExpectedType(variableType);
214
			    boolean isDiamond = false;
210
				TypeBinding initializationType = this.initialization.resolveType(scope);
215
				TypeBinding initializationType = this.initialization.resolveType(scope);
216
				if (this.initialization instanceof AllocationExpression) {
217
					if (isCompliant17 && (((AllocationExpression) this.initialization).type.bits & ASTNode.IsDiamond) != 0)
218
						isDiamond = true;
219
				}
211
				if (initializationType != null) {
220
				if (initializationType != null) {
212
					if (variableType != initializationType) // must call before computeConversion() and typeMismatchError()
221
					if (variableType != initializationType) // must call before computeConversion() and typeMismatchError()
213
						scope.compilationUnitScope().recordTypeConversion(variableType, initializationType);
222
						scope.compilationUnitScope().recordTypeConversion(variableType, initializationType);
214
					if (this.initialization.isConstantValueOfTypeAssignableToType(initializationType, variableType)
223
					if (this.initialization.isConstantValueOfTypeAssignableToType(initializationType, variableType)
215
						|| initializationType.isCompatibleWith(variableType)) {
224
						|| initializationType.isCompatibleWith(variableType, isDiamond)) {
216
						this.initialization.computeConversion(scope, variableType, initializationType);
225
						this.initialization.computeConversion(scope, variableType, initializationType);
217
						if (initializationType.needsUncheckedConversion(variableType)) {
226
						if (initializationType.needsUncheckedConversion(variableType)) {
218
						    scope.problemReporter().unsafeTypeConversion(this.initialization, initializationType, variableType);
227
						    scope.problemReporter().unsafeTypeConversion(this.initialization, initializationType, variableType);
(-)compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java (-2 / +13 lines)
Lines 90-95 Link Here
90
     * No need to check for reference to raw type per construction
90
     * No need to check for reference to raw type per construction
91
     */
91
     */
92
	private TypeBinding internalResolveType(Scope scope, ReferenceBinding enclosingType, boolean checkBounds) {
92
	private TypeBinding internalResolveType(Scope scope, ReferenceBinding enclosingType, boolean checkBounds) {
93
		boolean isCompliant17 = scope.compilerOptions().originalSourceLevel >= ClassFileConstants.JDK1_7;
93
		// handle the error here
94
		// handle the error here
94
		this.constant = Constant.NotAConstant;
95
		this.constant = Constant.NotAConstant;
95
		if ((this.bits & ASTNode.DidResolve) != 0) { // is a shared type reference which was already resolved
96
		if ((this.bits & ASTNode.DidResolve) != 0) { // is a shared type reference which was already resolved
Lines 222-229 Link Here
222
			}
223
			}
223
			// if missing generic type, and compliance >= 1.5, then will rebuild a parameterized binding
224
			// if missing generic type, and compliance >= 1.5, then will rebuild a parameterized binding
224
		} else if (argLength != typeVariables.length) { // check arity
225
		} else if (argLength != typeVariables.length) { // check arity
225
			scope.problemReporter().incorrectArityForParameterizedType(this, currentType, argTypes);
226
			if(isCompliant17 && argLength == 0) {
226
			return null;
227
				if ((this.bits & ASTNode.IsDiamond) ==0) {
228
					scope.problemReporter().incorrectArityForParameterizedType(this, currentType, argTypes);
229
					return null;
230
				}
231
				// argLength = 0 ok if its the diamond case for compliance >= 1.7
232
				// also no need to check bounds for such a case
233
				checkBounds = false;
234
			} else {
235
				scope.problemReporter().incorrectArityForParameterizedType(this, currentType, argTypes);
236
				return null;
237
			}
227
		} else if (!currentType.isStatic()) {
238
		} else if (!currentType.isStatic()) {
228
			ReferenceBinding actualEnclosing = currentType.enclosingType();
239
			ReferenceBinding actualEnclosing = currentType.enclosingType();
229
			if (actualEnclosing != null && actualEnclosing.isRawType()){
240
			if (actualEnclosing != null && actualEnclosing.isRawType()){
(-)compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java (+5 lines)
Lines 272-277 Link Here
272
				receiverType = scope.enclosingSourceType();
272
				receiverType = scope.enclosingSourceType();
273
			} else {
273
			} else {
274
				receiverType = this.type.resolveType(scope, true /* check bounds*/);
274
				receiverType = this.type.resolveType(scope, true /* check bounds*/);
275
				boolean isCompliant17 = scope.compilerOptions().originalSourceLevel >= ClassFileConstants.JDK1_7;
276
				if (isCompliant17 && this.anonymousType != null && (this.type.bits & ASTNode.IsDiamond) != 0) {
277
					scope.problemReporter().invalidUsageOfDiamondConstruct(this.type);
278
					return null;
279
				}
275
				checkParameterizedAllocation: {
280
				checkParameterizedAllocation: {
276
					if (receiverType == null || !receiverType.isValidBinding()) break checkParameterizedAllocation;
281
					if (receiverType == null || !receiverType.isValidBinding()) break checkParameterizedAllocation;
277
					if (this.type instanceof ParameterizedQualifiedTypeReference) { // disallow new X<String>.Y<Integer>()
282
					if (this.type instanceof ParameterizedQualifiedTypeReference) { // disallow new X<String>.Y<Integer>()
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java (+12 lines)
Lines 1005-1010 Link Here
1005
 * In addition to improving performance, caching also ensures there is no infinite regression
1005
 * In addition to improving performance, caching also ensures there is no infinite regression
1006
 * since per nature, the compatibility check is recursive through parameterized type arguments (122775)
1006
 * since per nature, the compatibility check is recursive through parameterized type arguments (122775)
1007
 */
1007
 */
1008
public boolean isCompatibleWith(TypeBinding otherType, boolean isDiamondCase) {
1009
	if (isDiamondCase) {
1010
		if (this.erasure() == otherType.erasure())
1011
			return true;
1012
	}
1013
	return isCompatibleWith(otherType);
1014
}
1015
/**
1016
 * Answer true if the receiver type can be assigned to the argument type (right)
1017
 * In addition to improving performance, caching also ensures there is no infinite regression
1018
 * since per nature, the compatibility check is recursive through parameterized type arguments (122775)
1019
 */
1008
public boolean isCompatibleWith(TypeBinding otherType) {
1020
public boolean isCompatibleWith(TypeBinding otherType) {
1009
	if (otherType == this)
1021
	if (otherType == this)
1010
		return true;
1022
		return true;
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java (-1 / +5 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 1183-1186 Link Here
1183
public TypeVariableBinding[] typeVariables() {
1183
public TypeVariableBinding[] typeVariables() {
1184
	return Binding.NO_TYPE_VARIABLES;
1184
	return Binding.NO_TYPE_VARIABLES;
1185
}
1185
}
1186
1187
public boolean isCompatibleWith(TypeBinding variableType, boolean isDiamond){
1188
	return isCompatibleWith(variableType);
1189
}
1186
}
1190
}
(-)compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java (-1 / +2 lines)
Lines 8893-8899 Link Here
8893
			parameterizedSingleTypeReference.sourceEnd = this.endStatementPosition;
8893
			parameterizedSingleTypeReference.sourceEnd = this.endStatementPosition;
8894
		}
8894
		}
8895
		if (isDiamond) {
8895
		if (isDiamond) {
8896
			parameterizedSingleTypeReference.bits |= ASTNode.IsDiamond;
8896
			if (parameterizedSingleTypeReference.dimensions == 0)
8897
				parameterizedSingleTypeReference.bits |= ASTNode.IsDiamond;
8897
		}
8898
		}
8898
		return parameterizedSingleTypeReference;
8899
		return parameterizedSingleTypeReference;
8899
	} else {
8900
	} else {
(-)compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java (+9 lines)
Lines 3861-3866 Link Here
3861
		annotationTypeDeclaration.sourceStart,
3861
		annotationTypeDeclaration.sourceStart,
3862
		annotationTypeDeclaration.sourceEnd);
3862
		annotationTypeDeclaration.sourceEnd);
3863
}
3863
}
3864
public void invalidUsageOfDiamondConstruct(ASTNode typeRef) {
3865
	//int i = 1;
3866
	this.handle(
3867
		IProblem.InvalidUsageOfDiamondConstruct,
3868
		NoArgument,
3869
		NoArgument,
3870
		typeRef.sourceStart,
3871
		typeRef.sourceEnd);
3872
}
3864
public void invalidUsageOfEnumDeclarations(TypeDeclaration enumDeclaration) {
3873
public void invalidUsageOfEnumDeclarations(TypeDeclaration enumDeclaration) {
3865
	this.handle(
3874
	this.handle(
3866
		IProblem.InvalidUsageOfEnumDeclarations,
3875
		IProblem.InvalidUsageOfEnumDeclarations,
(-)compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties (+1 lines)
Lines 636-641 Link Here
636
872 = The resource {0} of a try-with-resources statement cannot be assigned
636
872 = The resource {0} of a try-with-resources statement cannot be assigned
637
873 = The exception {0} is already caught by the exception {1}
637
873 = The exception {0} is already caught by the exception {1}
638
874 = Resource specification not allowed here for source level below 1.7
638
874 = Resource specification not allowed here for source level below 1.7
639
875 = Empty type argument list cannot be used in anonymous class declaration
639
640
640
### ELABORATIONS
641
### ELABORATIONS
641
## Access restrictions
642
## Access restrictions
(-)src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java (-23 / +23 lines)
Lines 50-56 Link Here
50
  	// Only the highest compliance level is run; add the VM argument
50
  	// Only the highest compliance level is run; add the VM argument
51
  	// -Dcompliance=1.4 (for example) to lower it if needed
51
  	// -Dcompliance=1.4 (for example) to lower it if needed
52
  	static {
52
  	static {
53
//    	TESTS_NAMES = new String[] { "test003_task_tags_options" };
53
    	TESTS_NAMES = new String[] { "test012_compiler_problems_tuning" };
54
//    	TESTS_NUMBERS = new int[] { 1 };
54
//    	TESTS_NUMBERS = new int[] { 1 };
55
//    	TESTS_RANGE = new int[] { 1, -1 };
55
//    	TESTS_RANGE = new int[] { 1, -1 };
56
//  	TESTS_RANGE = new int[] { 1, 2049 };
56
//  	TESTS_RANGE = new int[] { 1, 2049 };
Lines 422-429 Link Here
422
		expectedProblemAttributes.put("DuplicateParameterizedMethods", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
422
		expectedProblemAttributes.put("DuplicateParameterizedMethods", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
423
		expectedProblemAttributes.put("DuplicateSuperInterface", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
423
		expectedProblemAttributes.put("DuplicateSuperInterface", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
424
		expectedProblemAttributes.put("DuplicateTargetInTargetAnnotation", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
424
		expectedProblemAttributes.put("DuplicateTargetInTargetAnnotation", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
425
		expectedProblemAttributes.put("DuplicateTypes", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
426
		expectedProblemAttributes.put("DuplicateTypeVariable", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
425
		expectedProblemAttributes.put("DuplicateTypeVariable", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
426
		expectedProblemAttributes.put("DuplicateTypes", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
427
		expectedProblemAttributes.put("EmptyControlFlowStatement", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
427
		expectedProblemAttributes.put("EmptyControlFlowStatement", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
428
		expectedProblemAttributes.put("EnclosingInstanceInConstructorCall", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
428
		expectedProblemAttributes.put("EnclosingInstanceInConstructorCall", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
429
		expectedProblemAttributes.put("EndOfSource", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
429
		expectedProblemAttributes.put("EndOfSource", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
Lines 452-460 Link Here
452
		expectedProblemAttributes.put("FieldTypeNotVisible", DEPRECATED);
452
		expectedProblemAttributes.put("FieldTypeNotVisible", DEPRECATED);
453
		expectedProblemAttributes.put("FinalBoundForTypeVariable", new ProblemAttributes(CategorizedProblem.CAT_CODE_STYLE));
453
		expectedProblemAttributes.put("FinalBoundForTypeVariable", new ProblemAttributes(CategorizedProblem.CAT_CODE_STYLE));
454
		expectedProblemAttributes.put("FinalFieldAssignment", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
454
		expectedProblemAttributes.put("FinalFieldAssignment", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
455
		expectedProblemAttributes.put("FinallyMustCompleteNormally", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
456
		expectedProblemAttributes.put("FinalMethodCannotBeOverridden", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
455
		expectedProblemAttributes.put("FinalMethodCannotBeOverridden", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
457
		expectedProblemAttributes.put("FinalOuterLocalAssignment", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
456
		expectedProblemAttributes.put("FinalOuterLocalAssignment", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
457
		expectedProblemAttributes.put("FinallyMustCompleteNormally", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
458
		expectedProblemAttributes.put("ForbiddenReference", new ProblemAttributes(CategorizedProblem.CAT_RESTRICTION));
458
		expectedProblemAttributes.put("ForbiddenReference", new ProblemAttributes(CategorizedProblem.CAT_RESTRICTION));
459
		expectedProblemAttributes.put("GenericConstructorTypeArgumentMismatch", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
459
		expectedProblemAttributes.put("GenericConstructorTypeArgumentMismatch", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
460
		expectedProblemAttributes.put("GenericMethodTypeArgumentMismatch", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
460
		expectedProblemAttributes.put("GenericMethodTypeArgumentMismatch", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
Lines 583-588 Link Here
583
		expectedProblemAttributes.put("InvalidUnicodeEscape", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
583
		expectedProblemAttributes.put("InvalidUnicodeEscape", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
584
		expectedProblemAttributes.put("InvalidUsageOfAnnotationDeclarations", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
584
		expectedProblemAttributes.put("InvalidUsageOfAnnotationDeclarations", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
585
		expectedProblemAttributes.put("InvalidUsageOfAnnotations", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
585
		expectedProblemAttributes.put("InvalidUsageOfAnnotations", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
586
		expectedProblemAttributes.put("InvalidUsageOfDiamondConstruct", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
586
		expectedProblemAttributes.put("InvalidUsageOfEnumDeclarations", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
587
		expectedProblemAttributes.put("InvalidUsageOfEnumDeclarations", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
587
		expectedProblemAttributes.put("InvalidUsageOfForeachStatements", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
588
		expectedProblemAttributes.put("InvalidUsageOfForeachStatements", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
588
		expectedProblemAttributes.put("InvalidUsageOfStaticImports", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
589
		expectedProblemAttributes.put("InvalidUsageOfStaticImports", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
Lines 646-654 Link Here
646
		expectedProblemAttributes.put("JavadocNotVisibleField", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC));
647
		expectedProblemAttributes.put("JavadocNotVisibleField", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC));
647
		expectedProblemAttributes.put("JavadocNotVisibleMethod", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC));
648
		expectedProblemAttributes.put("JavadocNotVisibleMethod", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC));
648
		expectedProblemAttributes.put("JavadocNotVisibleType", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC));
649
		expectedProblemAttributes.put("JavadocNotVisibleType", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC));
650
		expectedProblemAttributes.put("JavadocParameterMismatch", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC));
649
		expectedProblemAttributes.put("JavadocParameterizedConstructorArgumentTypeMismatch", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC));
651
		expectedProblemAttributes.put("JavadocParameterizedConstructorArgumentTypeMismatch", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC));
650
		expectedProblemAttributes.put("JavadocParameterizedMethodArgumentTypeMismatch", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC));
652
		expectedProblemAttributes.put("JavadocParameterizedMethodArgumentTypeMismatch", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC));
651
		expectedProblemAttributes.put("JavadocParameterMismatch", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC));
652
		expectedProblemAttributes.put("JavadocTypeArgumentsForRawGenericConstructor", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC));
653
		expectedProblemAttributes.put("JavadocTypeArgumentsForRawGenericConstructor", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC));
653
		expectedProblemAttributes.put("JavadocTypeArgumentsForRawGenericMethod", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC));
654
		expectedProblemAttributes.put("JavadocTypeArgumentsForRawGenericMethod", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC));
654
		expectedProblemAttributes.put("JavadocUndefinedConstructor", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC));
655
		expectedProblemAttributes.put("JavadocUndefinedConstructor", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC));
Lines 662-677 Link Here
662
		expectedProblemAttributes.put("JavadocUsingDeprecatedField", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC));
663
		expectedProblemAttributes.put("JavadocUsingDeprecatedField", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC));
663
		expectedProblemAttributes.put("JavadocUsingDeprecatedMethod", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC));
664
		expectedProblemAttributes.put("JavadocUsingDeprecatedMethod", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC));
664
		expectedProblemAttributes.put("JavadocUsingDeprecatedType", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC));
665
		expectedProblemAttributes.put("JavadocUsingDeprecatedType", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC));
665
		expectedProblemAttributes.put("LocalVariableCannotBeNull", DEPRECATED);
666
		expectedProblemAttributes.put("LocalVariableCanOnlyBeNull", DEPRECATED);
666
		expectedProblemAttributes.put("LocalVariableCanOnlyBeNull", DEPRECATED);
667
		expectedProblemAttributes.put("LocalVariableCannotBeNull", DEPRECATED);
667
		expectedProblemAttributes.put("LocalVariableHidingField", new ProblemAttributes(CategorizedProblem.CAT_NAME_SHADOWING_CONFLICT));
668
		expectedProblemAttributes.put("LocalVariableHidingField", new ProblemAttributes(CategorizedProblem.CAT_NAME_SHADOWING_CONFLICT));
668
		expectedProblemAttributes.put("LocalVariableHidingLocalVariable", new ProblemAttributes(CategorizedProblem.CAT_NAME_SHADOWING_CONFLICT));
669
		expectedProblemAttributes.put("LocalVariableHidingLocalVariable", new ProblemAttributes(CategorizedProblem.CAT_NAME_SHADOWING_CONFLICT));
669
		expectedProblemAttributes.put("LocalVariableIsNeverUsed", new ProblemAttributes(CategorizedProblem.CAT_UNNECESSARY_CODE));
670
		expectedProblemAttributes.put("LocalVariableIsNeverUsed", new ProblemAttributes(CategorizedProblem.CAT_UNNECESSARY_CODE));
670
		expectedProblemAttributes.put("LocalVariableMayBeNull", DEPRECATED);
671
		expectedProblemAttributes.put("LocalVariableMayBeNull", DEPRECATED);
671
		expectedProblemAttributes.put("MaskedCatch", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
672
		expectedProblemAttributes.put("MaskedCatch", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
672
		expectedProblemAttributes.put("MethodButWithConstructorName", new ProblemAttributes(CategorizedProblem.CAT_CODE_STYLE));
673
		expectedProblemAttributes.put("MethodButWithConstructorName", new ProblemAttributes(CategorizedProblem.CAT_CODE_STYLE));
673
		expectedProblemAttributes.put("MethodCanBeStatic", new ProblemAttributes(CategorizedProblem.CAT_CODE_STYLE));
674
		expectedProblemAttributes.put("MethodCanBePotentiallyStatic", new ProblemAttributes(CategorizedProblem.CAT_CODE_STYLE));
674
		expectedProblemAttributes.put("MethodCanBePotentiallyStatic", new ProblemAttributes(CategorizedProblem.CAT_CODE_STYLE));
675
		expectedProblemAttributes.put("MethodCanBeStatic", new ProblemAttributes(CategorizedProblem.CAT_CODE_STYLE));
675
		expectedProblemAttributes.put("MethodMissingDeprecatedAnnotation", new ProblemAttributes(CategorizedProblem.CAT_CODE_STYLE));
676
		expectedProblemAttributes.put("MethodMissingDeprecatedAnnotation", new ProblemAttributes(CategorizedProblem.CAT_CODE_STYLE));
676
		expectedProblemAttributes.put("MethodMustOverride", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
677
		expectedProblemAttributes.put("MethodMustOverride", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
677
		expectedProblemAttributes.put("MethodMustOverrideOrImplement", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
678
		expectedProblemAttributes.put("MethodMustOverrideOrImplement", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
Lines 739-747 Link Here
739
		expectedProblemAttributes.put("PackageCollidesWithType", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
740
		expectedProblemAttributes.put("PackageCollidesWithType", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
740
		expectedProblemAttributes.put("PackageIsNotExpectedPackage", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
741
		expectedProblemAttributes.put("PackageIsNotExpectedPackage", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
741
		expectedProblemAttributes.put("ParameterAssignment", new ProblemAttributes(CategorizedProblem.CAT_CODE_STYLE));
742
		expectedProblemAttributes.put("ParameterAssignment", new ProblemAttributes(CategorizedProblem.CAT_CODE_STYLE));
743
		expectedProblemAttributes.put("ParameterMismatch", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
742
		expectedProblemAttributes.put("ParameterizedConstructorArgumentTypeMismatch", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
744
		expectedProblemAttributes.put("ParameterizedConstructorArgumentTypeMismatch", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
743
		expectedProblemAttributes.put("ParameterizedMethodArgumentTypeMismatch", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
745
		expectedProblemAttributes.put("ParameterizedMethodArgumentTypeMismatch", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
744
		expectedProblemAttributes.put("ParameterMismatch", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
745
		expectedProblemAttributes.put("ParsingError", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
746
		expectedProblemAttributes.put("ParsingError", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
746
		expectedProblemAttributes.put("ParsingErrorDeleteToken", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
747
		expectedProblemAttributes.put("ParsingErrorDeleteToken", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
747
		expectedProblemAttributes.put("ParsingErrorDeleteTokens", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
748
		expectedProblemAttributes.put("ParsingErrorDeleteTokens", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
Lines 789-794 Link Here
789
		expectedProblemAttributes.put("StaticMemberOfParameterizedType", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
790
		expectedProblemAttributes.put("StaticMemberOfParameterizedType", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
790
		expectedProblemAttributes.put("StaticMethodRequested", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
791
		expectedProblemAttributes.put("StaticMethodRequested", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
791
		expectedProblemAttributes.put("StringConstantIsExceedingUtf8Limit", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
792
		expectedProblemAttributes.put("StringConstantIsExceedingUtf8Limit", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
793
		expectedProblemAttributes.put("SuperInterfaceMustBeAnInterface", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
794
		expectedProblemAttributes.put("SuperInterfacesCollide", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
795
		expectedProblemAttributes.put("SuperTypeUsingWildcard", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
792
		expectedProblemAttributes.put("SuperclassAmbiguous", DEPRECATED);
796
		expectedProblemAttributes.put("SuperclassAmbiguous", DEPRECATED);
793
		expectedProblemAttributes.put("SuperclassInheritedNameHidesEnclosingName", DEPRECATED);
797
		expectedProblemAttributes.put("SuperclassInheritedNameHidesEnclosingName", DEPRECATED);
794
		expectedProblemAttributes.put("SuperclassInternalNameProvided", DEPRECATED);
798
		expectedProblemAttributes.put("SuperclassInternalNameProvided", DEPRECATED);
Lines 796-804 Link Here
796
		expectedProblemAttributes.put("SuperclassNotFound", DEPRECATED);
800
		expectedProblemAttributes.put("SuperclassNotFound", DEPRECATED);
797
		expectedProblemAttributes.put("SuperclassNotVisible", DEPRECATED);
801
		expectedProblemAttributes.put("SuperclassNotVisible", DEPRECATED);
798
		expectedProblemAttributes.put("SuperfluousSemicolon", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
802
		expectedProblemAttributes.put("SuperfluousSemicolon", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
799
		expectedProblemAttributes.put("SuperInterfaceMustBeAnInterface", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
800
		expectedProblemAttributes.put("SuperInterfacesCollide", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
801
		expectedProblemAttributes.put("SuperTypeUsingWildcard", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
802
		expectedProblemAttributes.put("Task", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
803
		expectedProblemAttributes.put("Task", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
803
		expectedProblemAttributes.put("ThisInStaticContext", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
804
		expectedProblemAttributes.put("ThisInStaticContext", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
804
		expectedProblemAttributes.put("ThisSuperDuringConstructorInvocation", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
805
		expectedProblemAttributes.put("ThisSuperDuringConstructorInvocation", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
Lines 846-852 Link Here
846
		expectedProblemAttributes.put("UnnecessaryCast", new ProblemAttributes(CategorizedProblem.CAT_UNNECESSARY_CODE));
847
		expectedProblemAttributes.put("UnnecessaryCast", new ProblemAttributes(CategorizedProblem.CAT_UNNECESSARY_CODE));
847
		expectedProblemAttributes.put("UnnecessaryElse", new ProblemAttributes(CategorizedProblem.CAT_UNNECESSARY_CODE));
848
		expectedProblemAttributes.put("UnnecessaryElse", new ProblemAttributes(CategorizedProblem.CAT_UNNECESSARY_CODE));
848
		expectedProblemAttributes.put("UnnecessaryInstanceof", new ProblemAttributes(CategorizedProblem.CAT_UNNECESSARY_CODE));
849
		expectedProblemAttributes.put("UnnecessaryInstanceof", new ProblemAttributes(CategorizedProblem.CAT_UNNECESSARY_CODE));
849
		expectedProblemAttributes.put("UnnecessaryOperator", new ProblemAttributes(CategorizedProblem.CAT_UNNECESSARY_CODE));
850
		expectedProblemAttributes.put("UnnecessaryNLSTag", new ProblemAttributes(CategorizedProblem.CAT_NLS));
850
		expectedProblemAttributes.put("UnnecessaryNLSTag", new ProblemAttributes(CategorizedProblem.CAT_NLS));
851
		expectedProblemAttributes.put("UnqualifiedFieldAccess", new ProblemAttributes(CategorizedProblem.CAT_CODE_STYLE));
851
		expectedProblemAttributes.put("UnqualifiedFieldAccess", new ProblemAttributes(CategorizedProblem.CAT_CODE_STYLE));
852
		expectedProblemAttributes.put("UnreachableCatch", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
852
		expectedProblemAttributes.put("UnreachableCatch", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
Lines 1079-1086 Link Here
1079
		expectedProblemAttributes.put("DuplicateParameterizedMethods", SKIP);
1079
		expectedProblemAttributes.put("DuplicateParameterizedMethods", SKIP);
1080
		expectedProblemAttributes.put("DuplicateSuperInterface", SKIP);
1080
		expectedProblemAttributes.put("DuplicateSuperInterface", SKIP);
1081
		expectedProblemAttributes.put("DuplicateTargetInTargetAnnotation", SKIP);
1081
		expectedProblemAttributes.put("DuplicateTargetInTargetAnnotation", SKIP);
1082
		expectedProblemAttributes.put("DuplicateTypes", SKIP);
1083
		expectedProblemAttributes.put("DuplicateTypeVariable", SKIP);
1082
		expectedProblemAttributes.put("DuplicateTypeVariable", SKIP);
1083
		expectedProblemAttributes.put("DuplicateTypes", SKIP);
1084
		expectedProblemAttributes.put("EmptyControlFlowStatement", new ProblemAttributes(JavaCore.COMPILER_PB_EMPTY_STATEMENT));
1084
		expectedProblemAttributes.put("EmptyControlFlowStatement", new ProblemAttributes(JavaCore.COMPILER_PB_EMPTY_STATEMENT));
1085
		expectedProblemAttributes.put("EnclosingInstanceInConstructorCall", SKIP);
1085
		expectedProblemAttributes.put("EnclosingInstanceInConstructorCall", SKIP);
1086
		expectedProblemAttributes.put("EndOfSource", SKIP);
1086
		expectedProblemAttributes.put("EndOfSource", SKIP);
Lines 1109-1117 Link Here
1109
		expectedProblemAttributes.put("FieldTypeNotVisible", SKIP);
1109
		expectedProblemAttributes.put("FieldTypeNotVisible", SKIP);
1110
		expectedProblemAttributes.put("FinalBoundForTypeVariable", new ProblemAttributes(JavaCore.COMPILER_PB_FINAL_PARAMETER_BOUND));
1110
		expectedProblemAttributes.put("FinalBoundForTypeVariable", new ProblemAttributes(JavaCore.COMPILER_PB_FINAL_PARAMETER_BOUND));
1111
		expectedProblemAttributes.put("FinalFieldAssignment", SKIP);
1111
		expectedProblemAttributes.put("FinalFieldAssignment", SKIP);
1112
		expectedProblemAttributes.put("FinallyMustCompleteNormally", new ProblemAttributes(JavaCore.COMPILER_PB_FINALLY_BLOCK_NOT_COMPLETING));
1113
		expectedProblemAttributes.put("FinalMethodCannotBeOverridden", SKIP);
1112
		expectedProblemAttributes.put("FinalMethodCannotBeOverridden", SKIP);
1114
		expectedProblemAttributes.put("FinalOuterLocalAssignment", SKIP);
1113
		expectedProblemAttributes.put("FinalOuterLocalAssignment", SKIP);
1114
		expectedProblemAttributes.put("FinallyMustCompleteNormally", new ProblemAttributes(JavaCore.COMPILER_PB_FINALLY_BLOCK_NOT_COMPLETING));
1115
		expectedProblemAttributes.put("ForbiddenReference", new ProblemAttributes(JavaCore.COMPILER_PB_FORBIDDEN_REFERENCE));
1115
		expectedProblemAttributes.put("ForbiddenReference", new ProblemAttributes(JavaCore.COMPILER_PB_FORBIDDEN_REFERENCE));
1116
		expectedProblemAttributes.put("GenericConstructorTypeArgumentMismatch", SKIP);
1116
		expectedProblemAttributes.put("GenericConstructorTypeArgumentMismatch", SKIP);
1117
		expectedProblemAttributes.put("GenericMethodTypeArgumentMismatch", SKIP);
1117
		expectedProblemAttributes.put("GenericMethodTypeArgumentMismatch", SKIP);
Lines 1215-1221 Link Here
1215
		expectedProblemAttributes.put("InvalidContinue", SKIP);
1215
		expectedProblemAttributes.put("InvalidContinue", SKIP);
1216
		expectedProblemAttributes.put("InvalidDigit", SKIP);
1216
		expectedProblemAttributes.put("InvalidDigit", SKIP);
1217
		expectedProblemAttributes.put("InvalidDisjunctiveTypeReferenceSequence", SKIP);
1217
		expectedProblemAttributes.put("InvalidDisjunctiveTypeReferenceSequence", SKIP);
1218
		expectedProblemAttributes.put("InvalidEmptyExoticIdentifier", SKIP);
1219
		expectedProblemAttributes.put("InvalidEncoding", SKIP);
1218
		expectedProblemAttributes.put("InvalidEncoding", SKIP);
1220
		expectedProblemAttributes.put("InvalidEscape", SKIP);
1219
		expectedProblemAttributes.put("InvalidEscape", SKIP);
1221
		expectedProblemAttributes.put("InvalidExplicitConstructorCall", SKIP);
1220
		expectedProblemAttributes.put("InvalidExplicitConstructorCall", SKIP);
Lines 1241-1246 Link Here
1241
		expectedProblemAttributes.put("InvalidUnicodeEscape", SKIP);
1240
		expectedProblemAttributes.put("InvalidUnicodeEscape", SKIP);
1242
		expectedProblemAttributes.put("InvalidUsageOfAnnotationDeclarations", SKIP);
1241
		expectedProblemAttributes.put("InvalidUsageOfAnnotationDeclarations", SKIP);
1243
		expectedProblemAttributes.put("InvalidUsageOfAnnotations", SKIP);
1242
		expectedProblemAttributes.put("InvalidUsageOfAnnotations", SKIP);
1243
		expectedProblemAttributes.put("InvalidUsageOfDiamondConstruct", SKIP);
1244
		expectedProblemAttributes.put("InvalidUsageOfEnumDeclarations", SKIP);
1244
		expectedProblemAttributes.put("InvalidUsageOfEnumDeclarations", SKIP);
1245
		expectedProblemAttributes.put("InvalidUsageOfForeachStatements", SKIP);
1245
		expectedProblemAttributes.put("InvalidUsageOfForeachStatements", SKIP);
1246
		expectedProblemAttributes.put("InvalidUsageOfStaticImports", SKIP);
1246
		expectedProblemAttributes.put("InvalidUsageOfStaticImports", SKIP);
Lines 1304-1312 Link Here
1304
		expectedProblemAttributes.put("JavadocNotVisibleField", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC));
1304
		expectedProblemAttributes.put("JavadocNotVisibleField", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC));
1305
		expectedProblemAttributes.put("JavadocNotVisibleMethod", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC));
1305
		expectedProblemAttributes.put("JavadocNotVisibleMethod", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC));
1306
		expectedProblemAttributes.put("JavadocNotVisibleType", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC));
1306
		expectedProblemAttributes.put("JavadocNotVisibleType", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC));
1307
		expectedProblemAttributes.put("JavadocParameterMismatch", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC));
1307
		expectedProblemAttributes.put("JavadocParameterizedConstructorArgumentTypeMismatch", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC));
1308
		expectedProblemAttributes.put("JavadocParameterizedConstructorArgumentTypeMismatch", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC));
1308
		expectedProblemAttributes.put("JavadocParameterizedMethodArgumentTypeMismatch", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC));
1309
		expectedProblemAttributes.put("JavadocParameterizedMethodArgumentTypeMismatch", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC));
1309
		expectedProblemAttributes.put("JavadocParameterMismatch", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC));
1310
		expectedProblemAttributes.put("JavadocTypeArgumentsForRawGenericConstructor", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC));
1310
		expectedProblemAttributes.put("JavadocTypeArgumentsForRawGenericConstructor", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC));
1311
		expectedProblemAttributes.put("JavadocTypeArgumentsForRawGenericMethod", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC));
1311
		expectedProblemAttributes.put("JavadocTypeArgumentsForRawGenericMethod", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC));
1312
		expectedProblemAttributes.put("JavadocUndefinedConstructor", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC));
1312
		expectedProblemAttributes.put("JavadocUndefinedConstructor", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC));
Lines 1320-1335 Link Here
1320
		expectedProblemAttributes.put("JavadocUsingDeprecatedField", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC));
1320
		expectedProblemAttributes.put("JavadocUsingDeprecatedField", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC));
1321
		expectedProblemAttributes.put("JavadocUsingDeprecatedMethod", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC));
1321
		expectedProblemAttributes.put("JavadocUsingDeprecatedMethod", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC));
1322
		expectedProblemAttributes.put("JavadocUsingDeprecatedType", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC));
1322
		expectedProblemAttributes.put("JavadocUsingDeprecatedType", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC));
1323
		expectedProblemAttributes.put("LocalVariableCannotBeNull", SKIP);
1324
		expectedProblemAttributes.put("LocalVariableCanOnlyBeNull", SKIP);
1323
		expectedProblemAttributes.put("LocalVariableCanOnlyBeNull", SKIP);
1324
		expectedProblemAttributes.put("LocalVariableCannotBeNull", SKIP);
1325
		expectedProblemAttributes.put("LocalVariableHidingField", new ProblemAttributes(JavaCore.COMPILER_PB_LOCAL_VARIABLE_HIDING));
1325
		expectedProblemAttributes.put("LocalVariableHidingField", new ProblemAttributes(JavaCore.COMPILER_PB_LOCAL_VARIABLE_HIDING));
1326
		expectedProblemAttributes.put("LocalVariableHidingLocalVariable", new ProblemAttributes(JavaCore.COMPILER_PB_LOCAL_VARIABLE_HIDING));
1326
		expectedProblemAttributes.put("LocalVariableHidingLocalVariable", new ProblemAttributes(JavaCore.COMPILER_PB_LOCAL_VARIABLE_HIDING));
1327
		expectedProblemAttributes.put("LocalVariableIsNeverUsed", new ProblemAttributes(JavaCore.COMPILER_PB_UNUSED_LOCAL));
1327
		expectedProblemAttributes.put("LocalVariableIsNeverUsed", new ProblemAttributes(JavaCore.COMPILER_PB_UNUSED_LOCAL));
1328
		expectedProblemAttributes.put("LocalVariableMayBeNull", SKIP);
1328
		expectedProblemAttributes.put("LocalVariableMayBeNull", SKIP);
1329
		expectedProblemAttributes.put("MaskedCatch", new ProblemAttributes(JavaCore.COMPILER_PB_HIDDEN_CATCH_BLOCK));
1329
		expectedProblemAttributes.put("MaskedCatch", new ProblemAttributes(JavaCore.COMPILER_PB_HIDDEN_CATCH_BLOCK));
1330
		expectedProblemAttributes.put("MethodButWithConstructorName", new ProblemAttributes(JavaCore.COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME));
1330
		expectedProblemAttributes.put("MethodButWithConstructorName", new ProblemAttributes(JavaCore.COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME));
1331
		expectedProblemAttributes.put("MethodCanBeStatic", new ProblemAttributes(JavaCore.COMPILER_PB_MISSING_STATIC_ON_METHOD));
1332
		expectedProblemAttributes.put("MethodCanBePotentiallyStatic", new ProblemAttributes(JavaCore.COMPILER_PB_POTENTIALLY_MISSING_STATIC_ON_METHOD));
1331
		expectedProblemAttributes.put("MethodCanBePotentiallyStatic", new ProblemAttributes(JavaCore.COMPILER_PB_POTENTIALLY_MISSING_STATIC_ON_METHOD));
1332
		expectedProblemAttributes.put("MethodCanBeStatic", new ProblemAttributes(JavaCore.COMPILER_PB_MISSING_STATIC_ON_METHOD));
1333
		expectedProblemAttributes.put("MethodMissingDeprecatedAnnotation", new ProblemAttributes(JavaCore.COMPILER_PB_MISSING_DEPRECATED_ANNOTATION));
1333
		expectedProblemAttributes.put("MethodMissingDeprecatedAnnotation", new ProblemAttributes(JavaCore.COMPILER_PB_MISSING_DEPRECATED_ANNOTATION));
1334
		expectedProblemAttributes.put("MethodMustOverride", SKIP);
1334
		expectedProblemAttributes.put("MethodMustOverride", SKIP);
1335
		expectedProblemAttributes.put("MethodMustOverrideOrImplement", SKIP);
1335
		expectedProblemAttributes.put("MethodMustOverrideOrImplement", SKIP);
Lines 1343-1349 Link Here
1343
		expectedProblemAttributes.put("MissingEnclosingInstanceForConstructorCall", SKIP);
1343
		expectedProblemAttributes.put("MissingEnclosingInstanceForConstructorCall", SKIP);
1344
		expectedProblemAttributes.put("MissingEnumConstantCase", new ProblemAttributes(JavaCore.COMPILER_PB_INCOMPLETE_ENUM_SWITCH));
1344
		expectedProblemAttributes.put("MissingEnumConstantCase", new ProblemAttributes(JavaCore.COMPILER_PB_INCOMPLETE_ENUM_SWITCH));
1345
		expectedProblemAttributes.put("MissingOverrideAnnotation", new ProblemAttributes(JavaCore.COMPILER_PB_MISSING_OVERRIDE_ANNOTATION));
1345
		expectedProblemAttributes.put("MissingOverrideAnnotation", new ProblemAttributes(JavaCore.COMPILER_PB_MISSING_OVERRIDE_ANNOTATION));
1346
		expectedProblemAttributes.put("MissingOverrideAnnotationForInterfaceMethodImplementation", SKIP);
1346
		expectedProblemAttributes.put("MissingOverrideAnnotationForInterfaceMethodImplementation", new ProblemAttributes(JavaCore.COMPILER_PB_MISSING_OVERRIDE_ANNOTATION));
1347
		expectedProblemAttributes.put("MissingReturnType", SKIP);
1347
		expectedProblemAttributes.put("MissingReturnType", SKIP);
1348
		expectedProblemAttributes.put("MissingSemiColon", SKIP);
1348
		expectedProblemAttributes.put("MissingSemiColon", SKIP);
1349
		expectedProblemAttributes.put("MissingSerialVersion", new ProblemAttributes(JavaCore.COMPILER_PB_MISSING_SERIAL_VERSION));
1349
		expectedProblemAttributes.put("MissingSerialVersion", new ProblemAttributes(JavaCore.COMPILER_PB_MISSING_SERIAL_VERSION));
Lines 1397-1405 Link Here
1397
		expectedProblemAttributes.put("PackageCollidesWithType", SKIP);
1397
		expectedProblemAttributes.put("PackageCollidesWithType", SKIP);
1398
		expectedProblemAttributes.put("PackageIsNotExpectedPackage", SKIP);
1398
		expectedProblemAttributes.put("PackageIsNotExpectedPackage", SKIP);
1399
		expectedProblemAttributes.put("ParameterAssignment", new ProblemAttributes(JavaCore.COMPILER_PB_PARAMETER_ASSIGNMENT));
1399
		expectedProblemAttributes.put("ParameterAssignment", new ProblemAttributes(JavaCore.COMPILER_PB_PARAMETER_ASSIGNMENT));
1400
		expectedProblemAttributes.put("ParameterMismatch", SKIP);
1400
		expectedProblemAttributes.put("ParameterizedConstructorArgumentTypeMismatch", SKIP);
1401
		expectedProblemAttributes.put("ParameterizedConstructorArgumentTypeMismatch", SKIP);
1401
		expectedProblemAttributes.put("ParameterizedMethodArgumentTypeMismatch", SKIP);
1402
		expectedProblemAttributes.put("ParameterizedMethodArgumentTypeMismatch", SKIP);
1402
		expectedProblemAttributes.put("ParameterMismatch", SKIP);
1403
		expectedProblemAttributes.put("ParsingError", SKIP);
1403
		expectedProblemAttributes.put("ParsingError", SKIP);
1404
		expectedProblemAttributes.put("ParsingErrorDeleteToken", SKIP);
1404
		expectedProblemAttributes.put("ParsingErrorDeleteToken", SKIP);
1405
		expectedProblemAttributes.put("ParsingErrorDeleteTokens", SKIP);
1405
		expectedProblemAttributes.put("ParsingErrorDeleteTokens", SKIP);
Lines 1447-1462 Link Here
1447
		expectedProblemAttributes.put("StaticMemberOfParameterizedType", SKIP);
1447
		expectedProblemAttributes.put("StaticMemberOfParameterizedType", SKIP);
1448
		expectedProblemAttributes.put("StaticMethodRequested", SKIP);
1448
		expectedProblemAttributes.put("StaticMethodRequested", SKIP);
1449
		expectedProblemAttributes.put("StringConstantIsExceedingUtf8Limit", SKIP);
1449
		expectedProblemAttributes.put("StringConstantIsExceedingUtf8Limit", SKIP);
1450
		expectedProblemAttributes.put("SuperclassAmbiguous", SKIP);
1450
		expectedProblemAttributes.put("SuperInterfaceMustBeAnInterface", SKIP);
1451
		expectedProblemAttributes.put("SuperInterfacesCollide", SKIP);
1452
		expectedProblemAttributes.put("SuperTypeUsingWildcard", SKIP);
1453
		expectedProblemAttributes.put("SuperclassAmbiguous", new ProblemAttributes(JavaCore.COMPILER_PB_MISSING_HASHCODE_METHOD));
1451
		expectedProblemAttributes.put("SuperclassInheritedNameHidesEnclosingName", SKIP);
1454
		expectedProblemAttributes.put("SuperclassInheritedNameHidesEnclosingName", SKIP);
1452
		expectedProblemAttributes.put("SuperclassInternalNameProvided", SKIP);
1455
		expectedProblemAttributes.put("SuperclassInternalNameProvided", SKIP);
1453
		expectedProblemAttributes.put("SuperclassMustBeAClass", SKIP);
1456
		expectedProblemAttributes.put("SuperclassMustBeAClass", SKIP);
1454
		expectedProblemAttributes.put("SuperclassNotFound", SKIP);
1457
		expectedProblemAttributes.put("SuperclassNotFound", SKIP);
1455
		expectedProblemAttributes.put("SuperclassNotVisible", new ProblemAttributes(JavaCore.COMPILER_PB_REDUNDANT_SUPERINTERFACE));
1458
		expectedProblemAttributes.put("SuperclassNotVisible", new ProblemAttributes(JavaCore.COMPILER_PB_REDUNDANT_SUPERINTERFACE));
1456
		expectedProblemAttributes.put("SuperfluousSemicolon", new ProblemAttributes(JavaCore.COMPILER_PB_EMPTY_STATEMENT));
1459
		expectedProblemAttributes.put("SuperfluousSemicolon", new ProblemAttributes(JavaCore.COMPILER_PB_EMPTY_STATEMENT));
1457
		expectedProblemAttributes.put("SuperInterfaceMustBeAnInterface", SKIP);
1458
		expectedProblemAttributes.put("SuperInterfacesCollide", SKIP);
1459
		expectedProblemAttributes.put("SuperTypeUsingWildcard", SKIP);
1460
		expectedProblemAttributes.put("Task", SKIP);
1460
		expectedProblemAttributes.put("Task", SKIP);
1461
		expectedProblemAttributes.put("ThisInStaticContext", SKIP);
1461
		expectedProblemAttributes.put("ThisInStaticContext", SKIP);
1462
		expectedProblemAttributes.put("ThisSuperDuringConstructorInvocation", SKIP);
1462
		expectedProblemAttributes.put("ThisSuperDuringConstructorInvocation", SKIP);
(-)src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest.java (-1 / +39 lines)
Lines 27-33 Link Here
27
	// Static initializer to specify tests subset using TESTS_* static variables
27
	// Static initializer to specify tests subset using TESTS_* static variables
28
	// All specified tests which does not belong to the class are skipped...
28
	// All specified tests which does not belong to the class are skipped...
29
	static {
29
	static {
30
//		TESTS_NAMES = new String[] { "test322531j" };
30
//		TESTS_NAMES = new String[] { "test010" };
31
//		TESTS_NAMES = new String[] { "test1464" };
31
//		TESTS_NAMES = new String[] { "test1464" };
32
//		TESTS_NUMBERS = new int[] { 1465 };
32
//		TESTS_NUMBERS = new int[] { 1465 };
33
//		TESTS_RANGE = new int[] { 1097, -1 };
33
//		TESTS_RANGE = new int[] { 1097, -1 };
Lines 1350-1353 Link Here
1350
			"Cycle detected: the type A cannot extend/implement itself or one of its own member types\n" + 
1350
			"Cycle detected: the type A cannot extend/implement itself or one of its own member types\n" + 
1351
			"----------\n");
1351
			"----------\n");
1352
}
1352
}
1353
public void test339478a() {
1354
	this.runNegativeTest(
1355
		new String[] {
1356
			"X.java",
1357
			"public class X<T> {\n" + 
1358
			"	public static void main(String[] args) {\n" + 
1359
			"		X<String> x = new X<>();\n" + 
1360
			"		x.testFunction(\"SUCCESS\");\n" + 
1361
			"	}\n" +
1362
			"	public void testFunction(T param){\n" +
1363
			"		System.out.println(param);\n" +
1364
			"	}\n" + 
1365
			"}",
1366
		},
1367
		"----------\n" + 
1368
		"1. ERROR in X.java (at line 3)\n" + 
1369
		"	X<String> x = new X<>();\n" + 
1370
		"	                  ^\n" + 
1371
		"Incorrect number of arguments for type X<T>; it cannot be parameterized with arguments <>\n" + 
1372
		"----------\n");
1373
}
1374
public void test339478b() {
1375
	this.runNegativeTest(
1376
		new String[] {
1377
			"X.java",
1378
			"public class X<T> {\n" +
1379
			"	public static void main(String[] args) {\n" + 
1380
			"		X<> x1 = null;\n" +
1381
			"	}\n" +
1382
			"}",
1383
		},
1384
		"----------\n" + 
1385
		"1. ERROR in X.java (at line 3)\n" + 
1386
		"	X<> x1 = null;\n" + 
1387
		"	^\n" + 
1388
		"Incorrect number of arguments for type X<T>; it cannot be parameterized with arguments <>\n" + 
1389
		"----------\n");
1390
}
1353
}
1391
}
(-)src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_7.java (+255 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 IBM Corporation.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * This is an implementation of an early-draft specification developed under the Java
9
 * Community Process (JCP) and is made available for testing and evaluation purposes
10
 * only. The code is not compatible with any specification of the JCP.
11
 * 
12
 * Contributors:
13
 *     IBM Corporation - initial API and implementation
14
 *******************************************************************************/
15
package org.eclipse.jdt.core.tests.compiler.regression;
16
17
import junit.framework.Test;
18
public class GenericsRegressionTest_1_7 extends AbstractRegressionTest {
19
20
static {
21
//	TESTS_NAMES = new String[] { "test004" };
22
//	TESTS_NUMBERS = new int[] { 40, 41, 43, 45, 63, 64 };
23
//	TESTS_RANGE = new int[] { 11, -1 };
24
}
25
public GenericsRegressionTest_1_7(String name) {
26
	super(name);
27
}
28
public static Test suite() {
29
	return buildMinimalComplianceTestSuite(testClass(), F_1_7);
30
}
31
public void test001() {
32
	this.runConformTest(
33
		new String[] {
34
			"X.java",
35
			"public class X<T> {\n" + 
36
			"	public static void main(String[] args) {\n" + 
37
			"		X<String> x = new X<>();\n" + 
38
			"		x.testFunction(\"SUCCESS\");\n" + 
39
			"	}\n" +
40
			"	public void testFunction(T param){\n" +
41
			"		System.out.println(param);\n" +
42
			"	}\n" + 
43
			"}",
44
		},
45
		"SUCCESS");
46
}
47
public void test002() {
48
	this.runNegativeTest(
49
		new String[] {
50
			"X.java",
51
			"public class X<T> {\n" + 
52
			"	public static void main(String[] args) {\n" + 
53
			"		X x = new X<>();\n" + 
54
			"		x.testFunction(\"SUCCESS\");\n" + 
55
			"	}\n" +
56
			"	public void testFunction(T param){\n" +
57
			"		System.out.println(param);\n" +
58
			"	}\n" + 
59
			"}",
60
		},
61
		"----------\n" + 
62
		"1. WARNING in X.java (at line 3)\n" + 
63
		"	X x = new X<>();\n" + 
64
		"	^\n" + 
65
		"X is a raw type. References to generic type X<T> should be parameterized\n" + 
66
		"----------\n" + 
67
		"2. WARNING in X.java (at line 4)\n" + 
68
		"	x.testFunction(\"SUCCESS\");\n" + 
69
		"	^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
70
		"Type safety: The method testFunction(Object) belongs to the raw type X. References to generic type X<T> should be parameterized\n" + 
71
		"----------\n");
72
}
73
public void _test003() {
74
	this.runNegativeTest(
75
		new String[] {
76
			"X.java",
77
			"public class X<T> {\n" + 
78
			"	public static void main(String[] args) {\n" + 
79
			"		new X<>().testFunction(\"SUCCESS\");\n" + 
80
			"	}\n" +
81
			"	public void testFunction(T param){\n" +
82
			"		System.out.println(param);\n" +
83
			"	}\n" + 
84
			"}",
85
		},
86
		"SUCCESS");
87
}
88
public void test004() {
89
	this.runNegativeTest(
90
		new String[] {
91
			"X.java",
92
			"public class X<T> {\n" + 
93
			"	public static void main(String[] args) {\n" + 
94
			"		new X<>(){\n" +
95
			"			void newMethod(){\n" +
96
			"			}\n" +
97
			"		}.testFunction(\"SUCCESS\");\n" + 
98
			"	}\n" +
99
			"	public void testFunction(T param){\n" +
100
			"		System.out.println(param);\n" +
101
			"	}\n" + 
102
			"}",
103
		},
104
		"----------\n" + 
105
		"1. ERROR in X.java (at line 3)\n" + 
106
		"	new X<>(){\n" + 
107
		"	    ^\n" + 
108
		"Empty type argument list cannot be used in anonymous class declaration\n" + 
109
		"----------\n");
110
}
111
public void test005() {
112
	this.runNegativeTest(
113
		new String[] {
114
			"X.java",
115
			"public class X<T> {\n" + 
116
			"	public static void main(String[] args) {\n" + 
117
			"		X Test = new X<>(){\n" +
118
			"			void newMethod(){\n" +
119
			"			}\n" +
120
			"		}.testFunction(\"SUCCESS\");\n" + 
121
			"	}\n" +
122
			"	public void testFunction(T param){\n" +
123
			"		System.out.println(param);\n" +
124
			"	}\n" + 
125
			"}",
126
		},
127
		"----------\n" + 
128
		"1. WARNING in X.java (at line 3)\n" + 
129
		"	X Test = new X<>(){\n" + 
130
		"	^\n" + 
131
		"X is a raw type. References to generic type X<T> should be parameterized\n" + 
132
		"----------\n" + 
133
		"2. ERROR in X.java (at line 3)\n" + 
134
		"	X Test = new X<>(){\n" + 
135
		"	             ^\n" + 
136
		"Empty type argument list cannot be used in anonymous class declaration\n" + 
137
		"----------\n");
138
}
139
public void _test006() {
140
	this.runNegativeTest(
141
		new String[] {
142
			"X.java",
143
			"class X1<T> {\n" +
144
			"	int abc = 1;\n" +
145
			"}\n" +
146
			"public class X<T> extends X1<T> {\n" + 
147
			"	public static void main(String[] args) {\n" + 
148
			"		X1<String> x = new X<>();\n" + 
149
			"		x.testFunction(\"SUCCESS\");\n" + 
150
			"	}\n" +
151
			"	public void testFunction(T param){\n" +
152
			"		System.out.println(param);\n" +
153
			"	}\n" + 
154
			"}",
155
		},
156
		"----------\n" + 
157
		"1. WARNING in X.java (at line 3)\n" + 
158
		"	X x = new X<>();\n" + 
159
		"	^\n" + 
160
		"X is a raw type. References to generic type X<T> should be parameterized\n" + 
161
		"----------\n" + 
162
		"2. WARNING in X.java (at line 4)\n" + 
163
		"	x.testFunction(\"SUCCESS\");\n" + 
164
		"	^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
165
		"Type safety: The method testFunction(Object) belongs to the raw type X. References to generic type X<T> should be parameterized\n" + 
166
		"----------\n");
167
}
168
// shows the difference between using <> and the raw type - different semantics
169
public void _test007() {
170
	this.runConformTest(
171
		new String[] {
172
			"X.java",
173
			"public class X<T> {\n" +
174
			"	T field1;" +
175
			"	public X(T param){\n" +
176
			"		field1 = param;\n" +
177
			"	}\n" +
178
			"	public static void main(String[] args) {\n" + 
179
			"		X.testFunction(new X<>(\"hello\").getField());\n" + // prints 1
180
			"		X.testFunction(new X(\"hello\").getField());\n" + //prints 2
181
			"	}\n" +
182
			"	public static void testFunction(String param){\n" +
183
			"		System.out.println(1);\n" +
184
			"	}\n" +
185
			"	public static void testFunction(Object param){\n" +
186
			"		System.out.println(2);\n" +
187
			"	}\n" +
188
			"	public T getField(){\n" +
189
			"		return field1;" +
190
			"	}\n" + 
191
			"}",
192
		},
193
		"1\n" + 
194
		"2");
195
}
196
//shows the difference between using <> and the raw type - different semantics
197
public void _test008() {
198
	this.runConformTest(
199
		new String[] {
200
			"X.java",
201
			"public class X<T> {\n" +
202
			"	T field1;" +
203
			"	public X(T param){\n" +
204
			"		field1 = param;\n" +
205
			"	}\n" +
206
			"	public static void main(String[] args) {\n" + 
207
			"		X<?> x1 = new X(1).get(\"\");\n" + // ok - passing String where Object is expected
208
			"		X<?> x2 = new X<>(1).get(\"\");\n" + // bad - passing String where Integer is expected
209
			"	}\n" +
210
			"	public X<T> get(T t){\n" +
211
			"		return this;" +
212
			"	}\n" + 
213
			"}",
214
		},
215
		"1\n" + 
216
		"2");
217
}
218
public void test009() {
219
	this.runNegativeTest(
220
		new String[] {
221
			"X.java",
222
			"public class X<T> {\n" +
223
			"	public static void main(String[] args) {\n" + 
224
			"		X<>[] x1 = null;\n" +
225
			"	}\n" +
226
			"}",
227
		},
228
		"----------\n" + 
229
		"1. ERROR in X.java (at line 3)\n" + 
230
		"	X<>[] x1 = null;\n" + 
231
		"	^\n" + 
232
		"Incorrect number of arguments for type X<T>; it cannot be parameterized with arguments <>\n" + 
233
		"----------\n");
234
}
235
public void test010() {
236
	this.runNegativeTest(
237
		new String[] {
238
			"X.java",
239
			"public class X<T> {\n" +
240
			"	public static void main(String[] args) {\n" + 
241
			"		X<> x1 = null;\n" + // ok - passing String where Object is expected
242
			"	}\n" +
243
			"}",
244
		},
245
		"----------\n" + 
246
		"1. ERROR in X.java (at line 3)\n" + 
247
		"	X<> x1 = null;\n" + 
248
		"	^\n" + 
249
		"Incorrect number of arguments for type X<T>; it cannot be parameterized with arguments <>\n" + 
250
		"----------\n");
251
}
252
public static Class testClass() {
253
	return GenericsRegressionTest_1_7.class;
254
}
255
}

Return to bug 339478