mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
delegate methods: restore ellipsis type (IDEA-171529)
This commit is contained in:
@@ -451,7 +451,11 @@ public class GenerateMembersUtil {
|
||||
paramName = generator.generateUniqueName(paramName);
|
||||
}
|
||||
generator.addExistingName(paramName);
|
||||
result[i] = factory.createParameter(paramName, GenericsUtil.getVariableTypeByExpressionType(substituted), target);
|
||||
PsiType expressionType = GenericsUtil.getVariableTypeByExpressionType(substituted);
|
||||
if (expressionType instanceof PsiArrayType && substituted instanceof PsiEllipsisType) {
|
||||
expressionType = new PsiEllipsisType(((PsiArrayType)expressionType).getComponentType());
|
||||
}
|
||||
result[i] = factory.createParameter(paramName, expressionType, target);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
class Foo {
|
||||
void foo(String... s) {}
|
||||
}
|
||||
|
||||
class Bar {
|
||||
Foo myDelegate;
|
||||
|
||||
public void foo(String... s) {
|
||||
myDelegate.foo(s);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
class Foo {
|
||||
void foo(String... s) {}
|
||||
}
|
||||
|
||||
class Bar {
|
||||
Foo myDelegate;
|
||||
<caret>
|
||||
}
|
||||
@@ -100,6 +100,10 @@ public class DelegateMethodsTest extends LightCodeInsightTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testPreserveEllipsisType() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() throws Exception {
|
||||
doTest(getTestName(false));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user