}
return null;
}
public void checkTypeArgumentRedundancy(ParameterizedTypeBinding allocationType, ReferenceBinding enclosingType, TypeBinding[] argumentTypes, final BlockScope scope) {
ProblemReporter reporter = scope.problemReporter();
if ((reporter.computeSeverity(IProblem.RedundantSpecificationOfTypeArguments) == ProblemSeverities.Ignore) || scope.compilerOptions().sourceLevel < ClassFileConstants.JDK1_7) return;
if (allocationType.arguments == null) return; // raw binding
if (this.genericTypeArguments != null) return; // diamond can't occur with explicit type args for constructor
if (argumentTypes == Binding.NO_PARAMETERS && this.typeExpected instanceof ParameterizedTypeBinding) {
ParameterizedTypeBinding expected = (ParameterizedTypeBinding) this.typeExpected;
if (expected.arguments != null && allocationType.arguments.length == expected.arguments.length) {
// check the case when no ctor takes no params and inference uses the expected type directly
// eg. X<String> x = new X<String>()
int i;
for (i = 0; i < allocationType.arguments.length; i++) {
if (allocationType.arguments[i] != expected.arguments[i])
break;
}
if (i == allocationType.arguments.length) {
reporter.redundantSpecificationOfTypeArguments(this.type, allocationType.arguments);
return;
}
}
}
TypeBinding [] inferredTypes = inferElidedTypes(allocationType.genericType(), enclosingType, argumentTypes, scope);
if (inferredTypes == null) {
return;
}
for (int i = 0; i < inferredTypes.length; i++) {
if (inferredTypes[i] != allocationType.arguments[i])
return;
}
reporter.redundantSpecificationOfTypeArguments(this.type, allocationType.arguments);
}