java completion: use context substitutor even for methods whose type parameters can be inferred from parameter types (IDEA-148623)

This commit is contained in:
peter
2015-11-30 16:26:38 +01:00
parent 9d2abd7276
commit a46935adc6
3 changed files with 14 additions and 1 deletions
@@ -390,7 +390,7 @@ public class JavaCompletionContributor extends CompletionContributor {
return type.isAssignableFrom(returned);
}
});
if (matchingExpectation != null && SmartCompletionDecorator.hasUnboundTypeParams(method, matchingExpectation)) {
if (matchingExpectation != null) {
call.setInferenceSubstitutor(SmartCompletionDecorator.calculateMethodReturnTypeSubstitutor(method, matchingExpectation), position);
}
}
@@ -0,0 +1,9 @@
import java.util.*;
public class MainClass1 {
List<String> foo(){
return Collections.un<caret>
}
}
@@ -713,4 +713,8 @@ interface TxANotAnno {}
checkPreferredItems 0, 'xzMap', 'xaString'
}
public void testPreferCollectionsStaticOfExpectedType() {
checkPreferredItems 0, 'unmodifiableList', 'unmodifiableCollection'
}
}