diff options
author | Stephan Herrmann | 2019-01-27 19:56:02 +0000 |
---|---|---|
committer | Stephan Herrmann | 2019-01-27 19:57:18 +0000 |
commit | ec7b27d00e7457096b173be6b860b3d9fd92f3e5 (patch) | |
tree | 771d7e21e37f99530cf5f3b0e43a034504a001c2 /org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler | |
parent | 5a6691be6a47ae09ea9a64bcefdb95cd5eca9fd7 (diff) | |
download | eclipse.jdt.core-ec7b27d00e7457096b173be6b860b3d9fd92f3e5.tar.gz eclipse.jdt.core-ec7b27d00e7457096b173be6b860b3d9fd92f3e5.tar.xz eclipse.jdt.core-ec7b27d00e7457096b173be6b860b3d9fd92f3e5.zip |
Bug 543820 - Problem with generics: wrong "Type mismatch: cannotI20190127-1800
convert"
Change-Id: Ibcc742fb2c7fdc08dafbbd0e12c108c54259fe0e
Signed-off-by: Stephan Herrmann <stephan.herrmann@berlin.de>
Diffstat (limited to 'org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler')
2 files changed, 4 insertions, 4 deletions
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java index 6e2fb89be3..7710fcfdee 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2018 IBM Corporation and others. + * Copyright (c) 2000, 2019 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -591,7 +591,7 @@ public MethodBinding inferConstructorOfElidedParameterizedType(final Scope scope if (this.expressionContext == INVOCATION_CONTEXT && this.typeExpected == null) constructor = ParameterizedGenericMethodBinding.computeCompatibleMethod18(constructor.shallowOriginal(), this.argumentTypes, scope, this); } - if (this.typeExpected != null) + if (this.typeExpected != null && this.typeExpected.isProperType(true)) registerResult(this.typeExpected, constructor); } return constructor; diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java index f7a144f39b..d40fbeb2c0 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2017 IBM Corporation and others. + * Copyright (c) 2000, 2019 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -278,7 +278,7 @@ public class ParameterizedGenericMethodBinding extends ParameterizedMethodBindin TypeBinding[] solutions = infCtx18.getSolutions(typeVariables, invocationSite, result); if (solutions != null) { methodSubstitute = scope.environment().createParameterizedGenericMethod(originalMethod, solutions, infCtx18.usesUncheckedConversion, hasReturnProblem, expectedType); - if (invocationSite instanceof Invocation && allArgumentsAreProper) + if (invocationSite instanceof Invocation && allArgumentsAreProper && (expectedType == null || expectedType.isProperType(true))) infCtx18.forwardResults(result, (Invocation) invocationSite, methodSubstitute, expectedType); try { if (hasReturnProblem) { // illegally working from the provisional result? |