mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
show params info: ignore varargs conflicts, current index calculation
This commit is contained in:
+5
@@ -56,4 +56,9 @@ public class CompletionParameterTypeInferencePolicy extends ProcessCandidatePara
|
||||
}
|
||||
return guess;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVarargsIgnored() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-5
@@ -35,11 +35,7 @@ public abstract class ParameterTypeInferencePolicy {
|
||||
|
||||
public abstract PsiType adjustInferredType(PsiManager manager, PsiType guess, ConstraintType second);
|
||||
|
||||
/**
|
||||
* @return true when Object bounds would be rejected in the hope that outer call could provide more information. Should be used for java 1.8 only
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean allowPostponeInference() {
|
||||
public boolean isVarargsIgnored() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -273,7 +273,7 @@ public class MethodCandidateInfo extends CandidateInfo{
|
||||
}
|
||||
final PsiMethod method = getElement();
|
||||
final CurrentCandidateProperties alreadyThere =
|
||||
map.put(getMarkerList(), new CurrentCandidateProperties(method, super.getSubstitutor(), isVarargs(), !includeReturnConstraint));
|
||||
map.put(getMarkerList(), new CurrentCandidateProperties(method, super.getSubstitutor(), policy.isVarargsIgnored() || isVarargs(), !includeReturnConstraint));
|
||||
try {
|
||||
PsiTypeParameter[] typeParameters = method.getTypeParameters();
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
class Test {
|
||||
{
|
||||
final String method = getParentOfType(String.class, CharSe<caret>quence.class);
|
||||
}
|
||||
|
||||
public static <T extends CharSequence> T getParentOfType(Class<T> aClass, Class<? extends CharSequence>... stopAt) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -144,7 +144,15 @@ public class ParameterInfoTest extends LightCodeInsightTestCase {
|
||||
doTestPresentation("<html>List<String> param</html>");
|
||||
}
|
||||
|
||||
public void testIgnoreVarargs() throws Exception {
|
||||
doTestPresentation("<html>Class<CharSequence> aClass, <b>Class<? extends CharSequence>... stopAt</b></html>", 1);
|
||||
}
|
||||
|
||||
private void doTestPresentation(String expectedString) {
|
||||
doTestPresentation(expectedString, -1);
|
||||
}
|
||||
|
||||
private void doTestPresentation(String expectedString, int currentParameterIndex) {
|
||||
configureByFile(BASE_PATH + getTestName(false) + ".java");
|
||||
|
||||
final MethodParameterInfoHandler handler = new MethodParameterInfoHandler();
|
||||
@@ -156,7 +164,8 @@ public class ParameterInfoTest extends LightCodeInsightTestCase {
|
||||
assertEquals(1, itemsToShow.length);
|
||||
assertTrue(itemsToShow[0] instanceof MethodCandidateInfo);
|
||||
final PsiMethod method = ((MethodCandidateInfo)itemsToShow[0]).getElement();
|
||||
final ParameterInfoUIContextEx parameterContext = ParameterInfoComponent.createContext(itemsToShow, myEditor, handler, -1);
|
||||
final ParameterInfoUIContextEx parameterContext = ParameterInfoComponent.createContext(itemsToShow, myEditor, handler,
|
||||
currentParameterIndex);
|
||||
Assert.assertEquals(expectedString,
|
||||
MethodParameterInfoHandler
|
||||
.updateMethodPresentation(method, ((MethodCandidateInfo)itemsToShow[0]).getSubstitutor(), parameterContext));
|
||||
|
||||
Reference in New Issue
Block a user