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 340747 | Differences between
and this patch

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/core/compiler/IProblem.java (+2 lines)
Lines 1394-1399 Link Here
1394
	int UnhandledExceptionOnAutoClose =  TypeRelated + 882;
1394
	int UnhandledExceptionOnAutoClose =  TypeRelated + 882;
1395
	/** @since 3.7 */
1395
	/** @since 3.7 */
1396
	int DiamondNotBelow17 =  TypeRelated + 883;
1396
	int DiamondNotBelow17 =  TypeRelated + 883;
1397
	/** @since 3.7 */
1398
	int RedundantDeclarationOfTypeArguments = TypeRelated + 884;
1397
	/**
1399
	/**
1398
	 * External problems -- These are problems defined by other plugins
1400
	 * External problems -- These are problems defined by other plugins
1399
	 */
1401
	 */
(-)compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java (+60 lines)
Lines 17-28 Link Here
17
 *******************************************************************************/
17
 *******************************************************************************/
18
package org.eclipse.jdt.internal.compiler.ast;
18
package org.eclipse.jdt.internal.compiler.ast;
19
19
20
//import org.eclipse.jdt.core.compiler.IProblem;
20
import org.eclipse.jdt.internal.compiler.ASTVisitor;
21
import org.eclipse.jdt.internal.compiler.ASTVisitor;
21
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
22
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
22
import org.eclipse.jdt.internal.compiler.codegen.*;
23
import org.eclipse.jdt.internal.compiler.codegen.*;
23
import org.eclipse.jdt.internal.compiler.flow.*;
24
import org.eclipse.jdt.internal.compiler.flow.*;
24
import org.eclipse.jdt.internal.compiler.impl.Constant;
25
import org.eclipse.jdt.internal.compiler.impl.Constant;
25
import org.eclipse.jdt.internal.compiler.lookup.*;
26
import org.eclipse.jdt.internal.compiler.lookup.*;
27
import org.eclipse.jdt.internal.compiler.problem.ProblemReporter;
28
//import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities;
26
29
27
public class AllocationExpression extends Expression implements InvocationSite {
30
public class AllocationExpression extends Expression implements InvocationSite {
28
31
Lines 402-407 Link Here
402
	if (this.typeArguments != null && this.binding.original().typeVariables == Binding.NO_TYPE_VARIABLES) {
405
	if (this.typeArguments != null && this.binding.original().typeVariables == Binding.NO_TYPE_VARIABLES) {
403
		scope.problemReporter().unnecessaryTypeArgumentsForMethodInvocation(this.binding, this.genericTypeArguments, this.typeArguments);
406
		scope.problemReporter().unnecessaryTypeArgumentsForMethodInvocation(this.binding, this.genericTypeArguments, this.typeArguments);
404
	}
407
	}
408
	if (!isDiamond && this.resolvedType.isParameterizedTypeWithActualArguments()) {
409
 		checkTypeParameterRequired((ParameterizedTypeBinding) this.resolvedType, null, argumentTypes, scope);
410
 	}
405
	return allocationType;
411
	return allocationType;
406
}
412
}
407
413
Lines 418-423 Link Here
418
	return null;
424
	return null;
419
}
425
}
420
426
427
public void checkTypeParameterRequired(ParameterizedTypeBinding allocationType, ReferenceBinding enclosingType, TypeBinding[] argumentTypes, final BlockScope scope) {
428
	ProblemReporter reporter = scope.problemReporter();
429
	//if ((reporter.computeSeverity(IProblem.RedundantDeclarationOfTypeArguments) == ProblemSeverities.Ignore) || scope.compilerOptions().sourceLevel < ClassFileConstants.JDK1_7) return;
430
	if (allocationType.arguments == null) return;  // raw binding
431
	if (this.genericTypeArguments != null) return; // diamond can't occur with explicit type args for constructor
432
	if (argumentTypes != Binding.NO_PARAMETERS) {  // check if any parameter type is one of the class's type vars
433
		if (this.typeExpected != null) {
434
			MethodBinding originalMethod = this.binding.original();
435
			TypeBinding[] methodParams = originalMethod.parameters;
436
			TypeVariableBinding[] classVariables = originalMethod.declaringClass.typeVariables();
437
			int i;
438
			boolean flag = false;
439
			for (i = 0; i < methodParams.length && !flag; i++) {
440
				if (methodParams[i] instanceof TypeVariableBinding) {
441
					for (int j = 0; j < classVariables.length; j++) {
442
						if (methodParams[i] == classVariables[j]) {
443
							flag = true;
444
							break;
445
						}
446
					}
447
				}
448
			}
449
			if (!flag) {
450
				reporter.redundantDeclarationOfTypeArguments(this.type, allocationType.arguments);
451
				return;
452
			}
453
		}
454
	} else if (this.typeExpected instanceof ParameterizedTypeBinding
455
			&& ((ParameterizedTypeBinding) this.typeExpected).arguments != null
456
			&& allocationType.arguments.length == ((ParameterizedTypeBinding) this.typeExpected).arguments.length) {
457
		// check the case when no ctor takes no params and inference uses the expected type directly
458
		// eg. X<String> x = new X<String>()
459
		int i;
460
		for (i = 0; i < allocationType.arguments.length; i++) {
461
			if (allocationType.arguments[i] != ((ParameterizedTypeBinding) this.typeExpected).arguments[i])
462
				break;
463
		}
464
		if (i == allocationType.arguments.length) {
465
			reporter.redundantDeclarationOfTypeArguments(this.type, allocationType.arguments);
466
			return;
467
		}
468
	}
469
	ParameterizedTypeBinding allocTypeWithDiamond = new ParameterizedTypeBinding(allocationType.genericType(), Binding.NO_PARAMETERS, enclosingType, scope.environment());
470
	TypeBinding [] inferredTypes = inferElidedTypes(allocTypeWithDiamond.genericType(), enclosingType, argumentTypes, scope);
471
	if (inferredTypes == null) {
472
		return;
473
	}
474
	for (int i = 0; i < inferredTypes.length; i++) {
475
		if (inferredTypes[i] != allocationType.arguments[i])
476
			return;
477
	}
478
	reporter.redundantDeclarationOfTypeArguments(this.type, allocationType.arguments);
479
}
480
421
public void setActualReceiverType(ReferenceBinding receiverType) {
481
public void setActualReceiverType(ReferenceBinding receiverType) {
422
	// ignored
482
	// ignored
423
}
483
}
(-)compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java (+3 lines)
Lines 431-436 Link Here
431
			if ((this.binding.tagBits & TagBits.HasMissingType) != 0) {
431
			if ((this.binding.tagBits & TagBits.HasMissingType) != 0) {
432
				scope.problemReporter().missingTypeInConstructor(this, this.binding);
432
				scope.problemReporter().missingTypeInConstructor(this, this.binding);
433
			}
433
			}
434
			if (!isDiamond && receiverType.isParameterizedTypeWithActualArguments()) {
435
		 		checkTypeParameterRequired((ParameterizedTypeBinding)receiverType, receiverType.enclosingType(), argumentTypes , scope);
436
		 	}
434
			// The enclosing instance must be compatible with the innermost enclosing type
437
			// The enclosing instance must be compatible with the innermost enclosing type
435
			ReferenceBinding expectedType = this.binding.declaringClass.enclosingType();
438
			ReferenceBinding expectedType = this.binding.declaringClass.enclosingType();
436
			if (expectedType != enclosingInstanceType) // must call before computeConversion() and typeMismatchError()
439
			if (expectedType != enclosingInstanceType) // must call before computeConversion() and typeMismatchError()
(-)compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java (+9 lines)
Lines 136-141 Link Here
136
	public static final String OPTION_IncludeNullInfoFromAsserts = "org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts";  //$NON-NLS-1$
136
	public static final String OPTION_IncludeNullInfoFromAsserts = "org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts";  //$NON-NLS-1$
137
	public static final String OPTION_ReportMethodCanBeStatic = "org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic";  //$NON-NLS-1$
137
	public static final String OPTION_ReportMethodCanBeStatic = "org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic";  //$NON-NLS-1$
138
	public static final String OPTION_ReportMethodCanBePotentiallyStatic = "org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic";  //$NON-NLS-1$
138
	public static final String OPTION_ReportMethodCanBePotentiallyStatic = "org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic";  //$NON-NLS-1$
139
	public static final String OPTION_ReportRedundantDeclarationOfTypeArguments =  "org.eclipse.jdt.core.compiler.problem.redundantDeclarationOfTypeArguments"; //$NON-NLS-1$
139
	/**
140
	/**
140
	 * Possible values for configurable options
141
	 * Possible values for configurable options
141
	 */
142
	 */
Lines 238-243 Link Here
238
	public static final int UnusedObjectAllocation = IrritantSet.GROUP2 | ASTNode.Bit4;
239
	public static final int UnusedObjectAllocation = IrritantSet.GROUP2 | ASTNode.Bit4;
239
	public static final int MethodCanBeStatic = IrritantSet.GROUP2 | ASTNode.Bit5;
240
	public static final int MethodCanBeStatic = IrritantSet.GROUP2 | ASTNode.Bit5;
240
	public static final int MethodCanBePotentiallyStatic = IrritantSet.GROUP2 | ASTNode.Bit6;
241
	public static final int MethodCanBePotentiallyStatic = IrritantSet.GROUP2 | ASTNode.Bit6;
242
	public static final int RedundantDeclarationOfTypeArguments = IrritantSet.GROUP2 | ASTNode.Bit7;
241
243
242
	// Severity level for handlers
244
	// Severity level for handlers
243
	/** 
245
	/** 
Lines 547-552 Link Here
547
				return OPTION_ReportMethodCanBeStatic;
549
				return OPTION_ReportMethodCanBeStatic;
548
			case MethodCanBePotentiallyStatic :
550
			case MethodCanBePotentiallyStatic :
549
				return OPTION_ReportMethodCanBePotentiallyStatic;
551
				return OPTION_ReportMethodCanBePotentiallyStatic;
552
			case RedundantDeclarationOfTypeArguments :
553
				return OPTION_ReportRedundantDeclarationOfTypeArguments;
550
		}
554
		}
551
		return null;
555
		return null;
552
	}
556
	}
Lines 682-687 Link Here
682
			OPTION_ReportRawTypeReference,
686
			OPTION_ReportRawTypeReference,
683
			OPTION_ReportRedundantNullCheck,
687
			OPTION_ReportRedundantNullCheck,
684
			OPTION_ReportRedundantSuperinterface,
688
			OPTION_ReportRedundantSuperinterface,
689
			OPTION_ReportRedundantDeclarationOfTypeArguments,
685
			OPTION_ReportSpecialParameterHidingField,
690
			OPTION_ReportSpecialParameterHidingField,
686
			OPTION_ReportSyntheticAccessEmulation,
691
			OPTION_ReportSyntheticAccessEmulation,
687
			OPTION_ReportTasks,
692
			OPTION_ReportTasks,
Lines 763-768 Link Here
763
			case UnusedDeclaredThrownException :
768
			case UnusedDeclaredThrownException :
764
			case DeadCode :
769
			case DeadCode :
765
			case UnusedObjectAllocation :
770
			case UnusedObjectAllocation :
771
			case RedundantDeclarationOfTypeArguments :
766
				return "unused"; //$NON-NLS-1$
772
				return "unused"; //$NON-NLS-1$
767
			case DiscouragedReference :
773
			case DiscouragedReference :
768
			case ForbiddenReference :
774
			case ForbiddenReference :
Lines 973-978 Link Here
973
		optionsMap.put(OPTION_IncludeNullInfoFromAsserts, this.includeNullInfoFromAsserts ? ENABLED : DISABLED);
979
		optionsMap.put(OPTION_IncludeNullInfoFromAsserts, this.includeNullInfoFromAsserts ? ENABLED : DISABLED);
974
		optionsMap.put(OPTION_ReportMethodCanBeStatic, getSeverityString(MethodCanBeStatic));
980
		optionsMap.put(OPTION_ReportMethodCanBeStatic, getSeverityString(MethodCanBeStatic));
975
		optionsMap.put(OPTION_ReportMethodCanBePotentiallyStatic, getSeverityString(MethodCanBePotentiallyStatic));
981
		optionsMap.put(OPTION_ReportMethodCanBePotentiallyStatic, getSeverityString(MethodCanBePotentiallyStatic));
982
		optionsMap.put(OPTION_ReportRedundantDeclarationOfTypeArguments, getSeverityString(RedundantDeclarationOfTypeArguments));
976
		return optionsMap;
983
		return optionsMap;
977
	}
984
	}
978
985
Lines 1402-1407 Link Here
1402
		if ((optionValue = optionsMap.get(OPTION_ReportUnusedObjectAllocation)) != null) updateSeverity(UnusedObjectAllocation, optionValue);
1409
		if ((optionValue = optionsMap.get(OPTION_ReportUnusedObjectAllocation)) != null) updateSeverity(UnusedObjectAllocation, optionValue);
1403
		if ((optionValue = optionsMap.get(OPTION_ReportMethodCanBeStatic)) != null) updateSeverity(MethodCanBeStatic, optionValue);
1410
		if ((optionValue = optionsMap.get(OPTION_ReportMethodCanBeStatic)) != null) updateSeverity(MethodCanBeStatic, optionValue);
1404
		if ((optionValue = optionsMap.get(OPTION_ReportMethodCanBePotentiallyStatic)) != null) updateSeverity(MethodCanBePotentiallyStatic, optionValue);
1411
		if ((optionValue = optionsMap.get(OPTION_ReportMethodCanBePotentiallyStatic)) != null) updateSeverity(MethodCanBePotentiallyStatic, optionValue);
1412
		if ((optionValue = optionsMap.get(OPTION_ReportRedundantDeclarationOfTypeArguments)) != null) updateSeverity(RedundantDeclarationOfTypeArguments, optionValue);
1405
1413
1406
		// Javadoc options
1414
		// Javadoc options
1407
		if ((optionValue = optionsMap.get(OPTION_DocCommentSupport)) != null) {
1415
		if ((optionValue = optionsMap.get(OPTION_DocCommentSupport)) != null) {
Lines 1616-1621 Link Here
1616
		buf.append("\n\t- unused object allocation: ").append(getSeverityString(UnusedObjectAllocation)); //$NON-NLS-1$
1624
		buf.append("\n\t- unused object allocation: ").append(getSeverityString(UnusedObjectAllocation)); //$NON-NLS-1$
1617
		buf.append("\n\t- method can be static: ").append(getSeverityString(MethodCanBeStatic)); //$NON-NLS-1$
1625
		buf.append("\n\t- method can be static: ").append(getSeverityString(MethodCanBeStatic)); //$NON-NLS-1$
1618
		buf.append("\n\t- method can be potentially static: ").append(getSeverityString(MethodCanBePotentiallyStatic)); //$NON-NLS-1$
1626
		buf.append("\n\t- method can be potentially static: ").append(getSeverityString(MethodCanBePotentiallyStatic)); //$NON-NLS-1$
1627
		buf.append("\n\t- redundant declaration of type arguments: ").append(getSeverityString(RedundantDeclarationOfTypeArguments)); //$NON-NLS-1$
1619
		return buf.toString();
1628
		return buf.toString();
1620
	}
1629
	}
1621
	
1630
	
(-)compiler/org/eclipse/jdt/internal/compiler/impl/IrritantSet.java (-1 / +2 lines)
Lines 120-126 Link Here
120
			.set(CompilerOptions.UnusedTypeArguments)
120
			.set(CompilerOptions.UnusedTypeArguments)
121
			.set(CompilerOptions.RedundantSuperinterface)
121
			.set(CompilerOptions.RedundantSuperinterface)
122
			.set(CompilerOptions.DeadCode)
122
			.set(CompilerOptions.DeadCode)
123
			.set(CompilerOptions.UnusedObjectAllocation);
123
			.set(CompilerOptions.UnusedObjectAllocation)
124
			.set(CompilerOptions.RedundantDeclarationOfTypeArguments);
124
		STATIC_METHOD
125
		STATIC_METHOD
125
		    .set(CompilerOptions.MethodCanBePotentiallyStatic);
126
		    .set(CompilerOptions.MethodCanBePotentiallyStatic);
126
		String suppressRawWhenUnchecked = System.getProperty("suppressRawWhenUnchecked"); //$NON-NLS-1$
127
		String suppressRawWhenUnchecked = System.getProperty("suppressRawWhenUnchecked"); //$NON-NLS-1$
(-)compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java (-1 / +21 lines)
Lines 430-435 Link Here
430
			
430
			
431
		case IProblem.MethodCanBePotentiallyStatic:
431
		case IProblem.MethodCanBePotentiallyStatic:
432
			return CompilerOptions.MethodCanBePotentiallyStatic;
432
			return CompilerOptions.MethodCanBePotentiallyStatic;
433
				
434
		case IProblem.RedundantDeclarationOfTypeArguments:
435
			return CompilerOptions.RedundantDeclarationOfTypeArguments;
433
	}
436
	}
434
	return 0;
437
	return 0;
435
}
438
}
Lines 502-508 Link Here
502
			case CompilerOptions.UnhandledWarningToken :
505
			case CompilerOptions.UnhandledWarningToken :
503
			case CompilerOptions.UnusedWarningToken :
506
			case CompilerOptions.UnusedWarningToken :
504
			case CompilerOptions.UnusedLabel :
507
			case CompilerOptions.UnusedLabel :
505
			case CompilerOptions.RedundantSuperinterface :	
508
			case CompilerOptions.RedundantSuperinterface :
509
			case CompilerOptions.RedundantDeclarationOfTypeArguments :
506
				return CategorizedProblem.CAT_UNNECESSARY_CODE;
510
				return CategorizedProblem.CAT_UNNECESSARY_CODE;
507
511
508
			case CompilerOptions.UsingDeprecatedAPI :
512
			case CompilerOptions.UsingDeprecatedAPI :
Lines 7884-7887 Link Here
7884
			type.sourceStart, 
7888
			type.sourceStart, 
7885
			type.sourceEnd);
7889
			type.sourceEnd);
7886
}
7890
}
7891
public void redundantDeclarationOfTypeArguments(ASTNode location, TypeBinding[] argumentTypes) {
7892
	int severity = computeSeverity(IProblem.RedundantDeclarationOfTypeArguments);
7893
	int sourceStart = -1;
7894
	if (location instanceof QualifiedTypeReference) {
7895
		sourceStart = (int) (((QualifiedTypeReference)location).sourcePositions[((QualifiedTypeReference)location).sourcePositions.length - 1] >> 32);
7896
	}
7897
    if (severity != ProblemSeverities.Ignore) {
7898
		this.handle(
7899
			IProblem.RedundantDeclarationOfTypeArguments,
7900
			new String[] {typesAsString(argumentTypes, false)},
7901
			new String[] {typesAsString(argumentTypes, true)},
7902
			severity,
7903
			sourceStart == -1? location.sourceStart : sourceStart,
7904
			location.sourceEnd);
7905
    }
7906
}
7887
}
7907
}
(-)compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties (+1 lines)
Lines 646-651 Link Here
646
881 = Cannot switch on a value of type String for source level below 1.7. Only convertible int values or enum constants are permitted
646
881 = Cannot switch on a value of type String for source level below 1.7. Only convertible int values or enum constants are permitted
647
882 = Unhandled exception type {0} thrown by automatic close() invocation on {1}
647
882 = Unhandled exception type {0} thrown by automatic close() invocation on {1}
648
883 = '<>' operator is not allowed for source level below 1.7
648
883 = '<>' operator is not allowed for source level below 1.7
649
884 = Redundant declaration of type arguments <{0}>
649
650
650
### ELABORATIONS
651
### ELABORATIONS
651
## Access restrictions
652
## Access restrictions
(-)model/org/eclipse/jdt/core/JavaCore.java (+14 lines)
Lines 1658-1663 Link Here
1658
	 */
1658
	 */
1659
	public static final String COMPILER_PB_UNUSED_OBJECT_ALLOCATION = PLUGIN_ID + ".compiler.problem.unusedObjectAllocation";  //$NON-NLS-1$
1659
	public static final String COMPILER_PB_UNUSED_OBJECT_ALLOCATION = PLUGIN_ID + ".compiler.problem.unusedObjectAllocation";  //$NON-NLS-1$
1660
	/**
1660
	/**
1661
	 * Compiler option ID: Reporting redundant declaration of type arguments in class instance creation expressions.
1662
	 * <p>When enabled, the compiler will issue an error or a warning if type arguments are used in a class instance creation,
1663
	 * when the '<>' operator can be used instead.
1664
	 * <p>This option only has an effect if the compiler compliance is 1.7 or greater.</p>
1665
	 * <dl>
1666
	 * <dt>Option id:</dt><dd><code>"org.eclipse.jdt.core.compiler.problem.redundantDeclarationOfTypeArguments"</code></dd>
1667
	 * <dt>Possible values:</dt><dd><code>{ "error", "warning", "ignore" }</code></dd>
1668
	 * <dt>Default:</dt><dd><code>"ignore"</code></dd>
1669
	 * </dl>
1670
	 * @since 3.7
1671
	 * @category CompilerOptionID
1672
	 */
1673
	public static final String COMPILER_PB_REDUNDANT_TYPE_ARGUMENTS = PLUGIN_ID + ".compiler.problem.redundantDeclarationOfTypeArguments";  //$NON-NLS-1$
1674
	/**
1661
	 * Core option ID: Computing Project Build Order.
1675
	 * Core option ID: Computing Project Build Order.
1662
	 * <p>Indicate whether JavaCore should enforce the project build order to be based on
1676
	 * <p>Indicate whether JavaCore should enforce the project build order to be based on
1663
	 *    the classpath prerequisite chain. When requesting to compute, this takes over
1677
	 *    the classpath prerequisite chain. When requesting to compute, this takes over
(-)src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java (-1 / +2 lines)
Lines 1857-1863 Link Here
1857
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.parameterAssignment\" value=\"ignore\"/>\n" + 
1857
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.parameterAssignment\" value=\"ignore\"/>\n" + 
1858
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment\" value=\"ignore\"/>\n" + 
1858
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment\" value=\"ignore\"/>\n" + 
1859
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.potentialNullReference\" value=\"ignore\"/>\n" + 
1859
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.potentialNullReference\" value=\"ignore\"/>\n" + 
1860
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.rawTypeReference\" value=\"warning\"/>\n" + 
1860
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.rawTypeReference\" value=\"warning\"/>\n" +
1861
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.redundantDeclarationOfTypeArguments\" value=\"ignore\"/>\n" + 
1861
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.redundantNullCheck\" value=\"ignore\"/>\n" + 
1862
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.redundantNullCheck\" value=\"ignore\"/>\n" + 
1862
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.redundantSuperinterface\" value=\"ignore\"/>\n" + 
1863
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.redundantSuperinterface\" value=\"ignore\"/>\n" + 
1863
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic\" value=\"ignore\"/>\n" + 
1864
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic\" value=\"ignore\"/>\n" + 
(-)src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java (+2 lines)
Lines 775-780 Link Here
775
		expectedProblemAttributes.put("RecursiveConstructorInvocation", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
775
		expectedProblemAttributes.put("RecursiveConstructorInvocation", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
776
		expectedProblemAttributes.put("RedefinedArgument", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
776
		expectedProblemAttributes.put("RedefinedArgument", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
777
		expectedProblemAttributes.put("RedefinedLocal", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
777
		expectedProblemAttributes.put("RedefinedLocal", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
778
		expectedProblemAttributes.put("RedundantDeclarationOfTypeArguments", new ProblemAttributes(CategorizedProblem.CAT_UNNECESSARY_CODE));
778
		expectedProblemAttributes.put("RedundantLocalVariableNullAssignment", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
779
		expectedProblemAttributes.put("RedundantLocalVariableNullAssignment", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
779
		expectedProblemAttributes.put("RedundantNullCheckOnNonNullLocalVariable", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
780
		expectedProblemAttributes.put("RedundantNullCheckOnNonNullLocalVariable", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
780
		expectedProblemAttributes.put("RedundantNullCheckOnNullLocalVariable", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
781
		expectedProblemAttributes.put("RedundantNullCheckOnNullLocalVariable", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
Lines 1441-1446 Link Here
1441
		expectedProblemAttributes.put("RecursiveConstructorInvocation", SKIP);
1442
		expectedProblemAttributes.put("RecursiveConstructorInvocation", SKIP);
1442
		expectedProblemAttributes.put("RedefinedArgument", SKIP);
1443
		expectedProblemAttributes.put("RedefinedArgument", SKIP);
1443
		expectedProblemAttributes.put("RedefinedLocal", SKIP);
1444
		expectedProblemAttributes.put("RedefinedLocal", SKIP);
1445
		expectedProblemAttributes.put("RedundantDeclarationOfTypeArguments", new ProblemAttributes(JavaCore.COMPILER_PB_REDUNDANT_TYPE_ARGUMENTS));
1444
		expectedProblemAttributes.put("RedundantLocalVariableNullAssignment", new ProblemAttributes(JavaCore.COMPILER_PB_REDUNDANT_NULL_CHECK));
1446
		expectedProblemAttributes.put("RedundantLocalVariableNullAssignment", new ProblemAttributes(JavaCore.COMPILER_PB_REDUNDANT_NULL_CHECK));
1445
		expectedProblemAttributes.put("RedundantNullCheckOnNonNullLocalVariable", new ProblemAttributes(JavaCore.COMPILER_PB_REDUNDANT_NULL_CHECK));
1447
		expectedProblemAttributes.put("RedundantNullCheckOnNonNullLocalVariable", new ProblemAttributes(JavaCore.COMPILER_PB_REDUNDANT_NULL_CHECK));
1446
		expectedProblemAttributes.put("RedundantNullCheckOnNullLocalVariable", new ProblemAttributes(JavaCore.COMPILER_PB_REDUNDANT_NULL_CHECK));
1448
		expectedProblemAttributes.put("RedundantNullCheckOnNullLocalVariable", new ProblemAttributes(JavaCore.COMPILER_PB_REDUNDANT_NULL_CHECK));
(-)src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_7.java (+386 lines)
Lines 14-19 Link Here
14
 *******************************************************************************/
14
 *******************************************************************************/
15
package org.eclipse.jdt.core.tests.compiler.regression;
15
package org.eclipse.jdt.core.tests.compiler.regression;
16
16
17
import java.util.Map;
18
19
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
20
17
import junit.framework.Test;
21
import junit.framework.Test;
18
public class GenericsRegressionTest_1_7 extends AbstractRegressionTest {
22
public class GenericsRegressionTest_1_7 extends AbstractRegressionTest {
19
23
Lines 1811-1816 Link Here
1811
		},
1815
		},
1812
		"");
1816
		"");
1813
}
1817
}
1818
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=340747
1819
public void test0052() {
1820
	Map customOptions = getCompilerOptions();
1821
	customOptions.put(CompilerOptions.OPTION_ReportRedundantDeclarationOfTypeArguments, CompilerOptions.ERROR);	
1822
	customOptions.put(CompilerOptions.OPTION_ReportRawTypeReference, CompilerOptions.IGNORE);	
1823
	this.runNegativeTest(
1824
		new String[] {
1825
			"X.java",
1826
			"public class X<E> {\n" +
1827
			"    X(E e) {}\n" +
1828
			"    X() {}\n" +
1829
			"    public static void main(String[] args) {\n" +
1830
			"        X<Number> x = new X<Number>(1);\n" +
1831
			"        X<String> x2 = new X<String>(\"SUCCESS\");\n" +
1832
			"        X<Integer> x3 = new X<Integer>(1);\n" +
1833
			"        X<AX> x4 = new X<AX>(new AX());\n" +
1834
			"		 X<? extends AX> x5 = new X<AX<String>>(new AX<String>());\n" +
1835
			"		 X<?> x6 = new X<AX<String>>(new AX<String>());\n" +
1836
			"		 X<Class<? extends Object>> x7 = new X<Class<? extends Object>>();\n" +
1837
			"	}\n" +
1838
			"}\n" +
1839
			"class AX<T>{}\n"
1840
		},
1841
		"----------\n" + 
1842
		"1. ERROR in X.java (at line 6)\n" + 
1843
		"	X<String> x2 = new X<String>(\"SUCCESS\");\n" + 
1844
		"	                   ^\n" + 
1845
		"Redundant declaration of type arguments <String>\n" + 
1846
		"----------\n" + 
1847
		"2. ERROR in X.java (at line 7)\n" + 
1848
		"	X<Integer> x3 = new X<Integer>(1);\n" + 
1849
		"	                    ^\n" + 
1850
		"Redundant declaration of type arguments <Integer>\n" + 
1851
		"----------\n" + 
1852
		"3. ERROR in X.java (at line 8)\n" + 
1853
		"	X<AX> x4 = new X<AX>(new AX());\n" + 
1854
		"	               ^\n" + 
1855
		"Redundant declaration of type arguments <AX>\n" + 
1856
		"----------\n" + 
1857
		"4. ERROR in X.java (at line 9)\n" + 
1858
		"	X<? extends AX> x5 = new X<AX<String>>(new AX<String>());\n" + 
1859
		"	                         ^\n" + 
1860
		"Redundant declaration of type arguments <AX<String>>\n" + 
1861
		"----------\n" + 
1862
		"5. ERROR in X.java (at line 10)\n" + 
1863
		"	X<?> x6 = new X<AX<String>>(new AX<String>());\n" + 
1864
		"	              ^\n" + 
1865
		"Redundant declaration of type arguments <AX<String>>\n" + 
1866
		"----------\n" + 
1867
		"6. ERROR in X.java (at line 11)\n" + 
1868
		"	X<Class<? extends Object>> x7 = new X<Class<? extends Object>>();\n" + 
1869
		"	                                    ^\n" + 
1870
		"Redundant declaration of type arguments <Class<? extends Object>>\n" + 
1871
		"----------\n",
1872
		null,
1873
		false,
1874
		customOptions);
1875
}
1876
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=340747
1877
public void test0052b() {
1878
	Map customOptions = getCompilerOptions();
1879
	customOptions.put(CompilerOptions.OPTION_ReportRedundantDeclarationOfTypeArguments, CompilerOptions.ERROR);	
1880
	customOptions.put(CompilerOptions.OPTION_ReportRawTypeReference, CompilerOptions.IGNORE);	
1881
	this.runNegativeTest(
1882
		new String[] {
1883
			"X.java",
1884
			"public class X<E> {\n" +
1885
			"	 E eField;\n" +
1886
			"	 E get() { return this.eField; }\n" +
1887
			"    X(E e) {}\n" +
1888
			"    X(int e, String e2) {}\n" +
1889
			"    public static void main(String[] args) {\n" +
1890
			"        X<Number> x = new X<Number>(1);\n" +
1891
			"        X<String> x2 = new X<String>(\"SUCCESS\");\n" +
1892
			"        X<String> x22 = new X<String>(1,\"SUCCESS\");\n" +
1893
			"        X<Integer> x3 = new X<Integer>(1);\n" +
1894
			"        String s = foo(new X<String>(\"aaa\"));\n" +
1895
			"        String s2 = foo(new X<String>(1,\"aaa\"));\n" +
1896
			"	}\n" +
1897
			"    static String foo(X<String> x) {\n" +
1898
			"		return x.get();\n" +
1899
			"    }\n" +
1900
			"}\n"
1901
		},
1902
		"----------\n" + 
1903
		"1. ERROR in X.java (at line 8)\n" + 
1904
		"	X<String> x2 = new X<String>(\"SUCCESS\");\n" + 
1905
		"	                   ^\n" + 
1906
		"Redundant declaration of type arguments <String>\n" + 
1907
		"----------\n" + 
1908
		"2. ERROR in X.java (at line 9)\n" + 
1909
		"	X<String> x22 = new X<String>(1,\"SUCCESS\");\n" + 
1910
		"	                    ^\n" + 
1911
		"Redundant declaration of type arguments <String>\n" + 
1912
		"----------\n" + 
1913
		"3. ERROR in X.java (at line 10)\n" + 
1914
		"	X<Integer> x3 = new X<Integer>(1);\n" + 
1915
		"	                    ^\n" + 
1916
		"Redundant declaration of type arguments <Integer>\n" + 
1917
		"----------\n" + 
1918
		"4. ERROR in X.java (at line 11)\n" + 
1919
		"	String s = foo(new X<String>(\"aaa\"));\n" + 
1920
		"	                   ^\n" + 
1921
		"Redundant declaration of type arguments <String>\n" + 
1922
		"----------\n",
1923
		null,
1924
		false,
1925
		customOptions);
1926
}
1927
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=340747
1928
public void test0052c() {
1929
	Map customOptions = getCompilerOptions();
1930
	customOptions.put(CompilerOptions.OPTION_ReportRedundantDeclarationOfTypeArguments, CompilerOptions.ERROR);	
1931
	customOptions.put(CompilerOptions.OPTION_ReportRawTypeReference, CompilerOptions.IGNORE);	
1932
	this.runNegativeTest(
1933
		new String[] {
1934
			"X.java",
1935
			"public class X<E> {\n" +
1936
			"	X(String abc, String def) {}\n" +
1937
			"	void foo() {\n" +
1938
			"		X<Integer> x = new X<Integer>(\"\",\"\");\n" +
1939
			"		foo3(new X<Integer>(\"\",\"\"));\n" +
1940
			"	}\n" +
1941
			"	X<Integer> foo2() {\n" +
1942
			"		return new X<Integer>(\"\",\"\");\n" +
1943
			"	}\n" +
1944
			"	void foo3(X<Integer> x) {}\n" +
1945
			"}"
1946
		},
1947
		"----------\n" + 
1948
		"1. ERROR in X.java (at line 4)\n" + 
1949
		"	X<Integer> x = new X<Integer>(\"\",\"\");\n" + 
1950
		"	                   ^\n" + 
1951
		"Redundant declaration of type arguments <Integer>\n" + 
1952
		"----------\n" + 
1953
		"2. ERROR in X.java (at line 8)\n" + 
1954
		"	return new X<Integer>(\"\",\"\");\n" + 
1955
		"	           ^\n" + 
1956
		"Redundant declaration of type arguments <Integer>\n" + 
1957
		"----------\n",
1958
		null,
1959
		false,
1960
		customOptions);
1961
}
1962
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=340747
1963
public void test0053() {
1964
	Map customOptions = getCompilerOptions();
1965
	customOptions.put(CompilerOptions.OPTION_ReportRedundantDeclarationOfTypeArguments, CompilerOptions.ERROR);	
1966
	customOptions.put(CompilerOptions.OPTION_ReportRawTypeReference, CompilerOptions.IGNORE);	
1967
	this.runNegativeTest(
1968
		new String[] {
1969
			"Z.java",
1970
			"public class Z <T extends ZB> { \n" +
1971
			"    public static void main(String[] args) {\n" +
1972
			"        foo(new Z<ZB>());\n" +
1973
			"    }\n" +
1974
			"    static void foo(Z<ZB> z) {\n" +
1975
			"    }\n" +
1976
			"}\n" +
1977
			"class ZB {\n" +
1978
			"}"
1979
		},
1980
		"----------\n" + 
1981
		"1. ERROR in Z.java (at line 3)\n" + 
1982
		"	foo(new Z<ZB>());\n" + 
1983
		"	        ^\n" + 
1984
		"Redundant declaration of type arguments <ZB>\n" + 
1985
		"----------\n",
1986
		null,
1987
		false,
1988
		customOptions);
1989
}
1990
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=340747
1991
public void test0054() {
1992
	Map customOptions = getCompilerOptions();
1993
	customOptions.put(CompilerOptions.OPTION_ReportRedundantDeclarationOfTypeArguments, CompilerOptions.ERROR);	
1994
	customOptions.put(CompilerOptions.OPTION_ReportRawTypeReference, CompilerOptions.IGNORE);	
1995
	this.runNegativeTest(
1996
		new String[] {
1997
			"Y.java",
1998
			"public class Y<V> {\n" +
1999
			"  public static <W extends ABC> Y<W> make(Class<W> clazz) {\n" +
2000
			"    return new Y<W>();\n" +
2001
			"  }\n" +
2002
			"}\n" +
2003
			"class ABC{}\n"
2004
		},
2005
		"----------\n" + 
2006
		"1. ERROR in Y.java (at line 3)\n" + 
2007
		"	return new Y<W>();\n" + 
2008
		"	           ^\n" + 
2009
		"Redundant declaration of type arguments <W>\n" + 
2010
		"----------\n",
2011
		null,
2012
		false,
2013
		customOptions);
2014
}
2015
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=340747
2016
public void test0055() {
2017
	Map customOptions = getCompilerOptions();
2018
	customOptions.put(CompilerOptions.OPTION_ReportRedundantDeclarationOfTypeArguments, CompilerOptions.ERROR);	
2019
	customOptions.put(CompilerOptions.OPTION_ReportRawTypeReference, CompilerOptions.IGNORE);	
2020
	this.runNegativeTest(
2021
		new String[] {
2022
			"X.java",
2023
			"public class X<A> {\n" +
2024
			"  class Inner<B> { }\n" +
2025
			"  static class Inner2<C> { }\n" +
2026
			"\n" +
2027
			"  void method() {\n" +
2028
			"    X<String>.Inner<Integer> a= new X<String>().new Inner<Integer>();\n" +
2029
			"    Inner<Integer> b= new X<A>().new Inner<Integer>();\n" +
2030
			"    Inner<Integer> c= new Inner<Integer>();\n" +
2031
			"    X<A>.Inner<Integer> e= new X<A>().new Inner<Integer>();\n" +
2032
			"    X<A>.Inner<Integer> f= new Inner<Integer>();\n" +
2033
			"    X.Inner2<Integer> d3 = new X.Inner2<Integer>();\n" +
2034
			"  }\n" +
2035
			"}\n",
2036
		},
2037
		"----------\n" + 
2038
		"1. ERROR in X.java (at line 6)\n" + 
2039
		"	X<String>.Inner<Integer> a= new X<String>().new Inner<Integer>();\n" + 
2040
		"	                                                ^^^^^\n" + 
2041
		"Redundant declaration of type arguments <Integer>\n" + 
2042
		"----------\n" + 
2043
		"2. ERROR in X.java (at line 7)\n" + 
2044
		"	Inner<Integer> b= new X<A>().new Inner<Integer>();\n" + 
2045
		"	                                 ^^^^^\n" + 
2046
		"Redundant declaration of type arguments <Integer>\n" + 
2047
		"----------\n" + 
2048
		"3. ERROR in X.java (at line 8)\n" + 
2049
		"	Inner<Integer> c= new Inner<Integer>();\n" + 
2050
		"	                      ^^^^^\n" + 
2051
		"Redundant declaration of type arguments <Integer>\n" + 
2052
		"----------\n" + 
2053
		"4. ERROR in X.java (at line 9)\n" + 
2054
		"	X<A>.Inner<Integer> e= new X<A>().new Inner<Integer>();\n" + 
2055
		"	                                      ^^^^^\n" + 
2056
		"Redundant declaration of type arguments <Integer>\n" + 
2057
		"----------\n" + 
2058
		"5. ERROR in X.java (at line 10)\n" + 
2059
		"	X<A>.Inner<Integer> f= new Inner<Integer>();\n" + 
2060
		"	                           ^^^^^\n" + 
2061
		"Redundant declaration of type arguments <Integer>\n" + 
2062
		"----------\n" + 
2063
		"6. ERROR in X.java (at line 11)\n" + 
2064
		"	X.Inner2<Integer> d3 = new X.Inner2<Integer>();\n" + 
2065
		"	                             ^^^^^^\n" + 
2066
		"Redundant declaration of type arguments <Integer>\n" + 
2067
		"----------\n",
2068
		null,
2069
		false,
2070
		customOptions);
2071
}
2072
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=340747
2073
// qualified allocation
2074
public void test0056() {
2075
	Map customOptions = getCompilerOptions();
2076
	customOptions.put(CompilerOptions.OPTION_ReportRedundantDeclarationOfTypeArguments, CompilerOptions.ERROR);	
2077
	customOptions.put(CompilerOptions.OPTION_ReportRawTypeReference, CompilerOptions.IGNORE);	
2078
	this.runNegativeTest(
2079
		new String[] {
2080
			"X.java",
2081
			"public class X <T> {\n" +
2082
			"	void foo1() {\n" +
2083
			"		X<String>.Item<Thread> i = new X<Exception>().new Item<Thread>();\n" +
2084
			"	}\n" +
2085
			"	void foo2() {\n" +
2086
			"		X<Exception>.Item<Thread> j = new X<Exception>.Item<Thread>();\n" +
2087
			"	}\n" +
2088
			"	class Item <E> {}\n" +
2089
			"}\n"
2090
		},
2091
		"----------\n" + 
2092
		"1. ERROR in X.java (at line 3)\n" + 
2093
		"	X<String>.Item<Thread> i = new X<Exception>().new Item<Thread>();\n" + 
2094
		"	                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
2095
		"Type mismatch: cannot convert from X<Exception>.Item<Thread> to X<String>.Item<Thread>\n" + 
2096
		"----------\n" + 
2097
		"2. ERROR in X.java (at line 3)\n" + 
2098
		"	X<String>.Item<Thread> i = new X<Exception>().new Item<Thread>();\n" + 
2099
		"	                                                  ^^^^\n" + 
2100
		"Redundant declaration of type arguments <Thread>\n" + 
2101
		"----------\n" + 
2102
		"3. ERROR in X.java (at line 6)\n" + 
2103
		"	X<Exception>.Item<Thread> j = new X<Exception>.Item<Thread>();\n" + 
2104
		"	                                  ^^^^^^^^^^^^^^^^^\n" + 
2105
		"Cannot allocate the member type X<Exception>.Item<Thread> using a parameterized compound name; use its simple name and an enclosing instance of type X<Exception>\n" + 
2106
		"----------\n" + 
2107
		"4. ERROR in X.java (at line 6)\n" + 
2108
		"	X<Exception>.Item<Thread> j = new X<Exception>.Item<Thread>();\n" + 
2109
		"	                                               ^^^^\n" + 
2110
		"Redundant declaration of type arguments <Thread>\n" + 
2111
		"----------\n",
2112
		null,
2113
		false,
2114
		customOptions);
2115
}
2116
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=340747
2117
// qualified allocation
2118
public void test0056b() {
2119
	Map customOptions = getCompilerOptions();
2120
	customOptions.put(CompilerOptions.OPTION_ReportRedundantDeclarationOfTypeArguments, CompilerOptions.ERROR);	
2121
	customOptions.put(CompilerOptions.OPTION_ReportRawTypeReference, CompilerOptions.IGNORE);	
2122
	this.runNegativeTest(
2123
		new String[] {
2124
			"X.java",
2125
			"public class X <T> {\n" +
2126
			"	static class X1<Z> {\n" +
2127
			"		X1(Z z){}\n" +
2128
			"	}\n" +
2129
			"	X1<Integer> x1 = new X.X1<Integer>(1);\n" +
2130
			"	X1<Number> x2 = new X.X1<Number>(1);\n" +
2131
			"}\n"
2132
		},
2133
		"----------\n" + 
2134
		"1. ERROR in X.java (at line 5)\n" + 
2135
		"	X1<Integer> x1 = new X.X1<Integer>(1);\n" + 
2136
		"	                       ^^\n" + 
2137
		"Redundant declaration of type arguments <Integer>\n" + 
2138
		"----------\n",
2139
		null,
2140
		false,
2141
		customOptions);
2142
}
2143
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=340747
2144
public void test0057() {
2145
	Map customOptions = getCompilerOptions();
2146
	customOptions.put(CompilerOptions.OPTION_ReportRedundantDeclarationOfTypeArguments, CompilerOptions.ERROR);	
2147
	customOptions.put(CompilerOptions.OPTION_ReportRawTypeReference, CompilerOptions.IGNORE);	
2148
	this.runNegativeTest(
2149
		new String[] {
2150
			"X.java",
2151
			"public class X {\n" +
2152
			"	void test() {\n" +
2153
			"		Pair<Double, Integer> p = new InvertedPair<Integer, Double>();\n" +
2154
			"	}\n" +
2155
			"}\n" +
2156
			"class Pair<A, B> {\n" +
2157
			"}\n" +
2158
			"class InvertedPair<A, B> extends Pair<B, A> {\n" +
2159
			"}\n"
2160
		},
2161
		"----------\n" + 
2162
		"1. ERROR in X.java (at line 3)\n" + 
2163
		"	Pair<Double, Integer> p = new InvertedPair<Integer, Double>();\n" + 
2164
		"	                              ^^^^^^^^^^^^\n" + 
2165
		"Redundant declaration of type arguments <Integer, Double>\n" + 
2166
		"----------\n",
2167
		null,
2168
		false,
2169
		customOptions);
2170
}
2171
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=340747
2172
public void test0058() {
2173
	Map customOptions = getCompilerOptions();
2174
	customOptions.put(CompilerOptions.OPTION_ReportRedundantDeclarationOfTypeArguments, CompilerOptions.ERROR);	
2175
	customOptions.put(CompilerOptions.OPTION_ReportRawTypeReference, CompilerOptions.IGNORE);	
2176
	this.runNegativeTest(
2177
		new String[] {
2178
			"X.java",
2179
			"import java.util.ArrayList;\n" +
2180
			"\n" +
2181
			"public class X {\n" +
2182
			"    public void test(boolean param) {\n" +
2183
			"        ArrayList<?> ls = (param) \n" +
2184
			"        		? new ArrayList<String>()\n" +
2185
			"        		: new ArrayList<Object>();\n" +
2186
			"        		\n" +
2187
			"    }\n" +
2188
			"}\n"
2189
		},
2190
		"----------\n" + 
2191
		"1. ERROR in X.java (at line 7)\n" + 
2192
		"	: new ArrayList<Object>();\n" + 
2193
		"	      ^^^^^^^^^\n" + 
2194
		"Redundant declaration of type arguments <Object>\n" + 
2195
		"----------\n",
2196
		null,
2197
		false,
2198
		customOptions);
2199
}
1814
public static Class testClass() {
2200
public static Class testClass() {
1815
	return GenericsRegressionTest_1_7.class;
2201
	return GenericsRegressionTest_1_7.class;
1816
}
2202
}

Return to bug 340747