mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
find lambdas passed into vararg methods
This commit is contained in:
@@ -20,6 +20,7 @@ import com.intellij.lang.LighterAST;
|
||||
import com.intellij.lang.LighterASTNode;
|
||||
import com.intellij.psi.JavaTokenType;
|
||||
import com.intellij.psi.PsiMethod;
|
||||
import com.intellij.psi.PsiNameHelper;
|
||||
import com.intellij.psi.impl.cache.RecordUtil;
|
||||
import com.intellij.psi.impl.cache.TypeInfo;
|
||||
import com.intellij.psi.impl.java.stubs.impl.PsiMethodStubImpl;
|
||||
@@ -169,8 +170,7 @@ public abstract class JavaMethodElementType extends JavaStubElementType<PsiMetho
|
||||
for (StubElement paramStub : ((PsiParameterListStub)stubElement).getChildrenStubs()) {
|
||||
if (paramStub instanceof PsiParameterStub) {
|
||||
TypeInfo type = ((PsiParameterStub)paramStub).getType(false);
|
||||
if (type.arrayCount > 0) continue;
|
||||
String typeName = type.getShortTypeText();
|
||||
String typeName = PsiNameHelper.getShortClassName(type.text);
|
||||
if (TypeConversionUtil.isPrimitive(typeName) || TypeConversionUtil.isPrimitiveWrapper(typeName)) continue;
|
||||
sink.occurrence(JavaStubIndexKeys.METHOD_TYPES, typeName);
|
||||
if (methodTypeParams != null && methodTypeParams.contains(typeName)) {
|
||||
|
||||
@@ -38,7 +38,7 @@ import java.io.IOException;
|
||||
* @author max
|
||||
*/
|
||||
public class JavaFileElementType extends ILightStubFileElementType<PsiJavaFileStub> {
|
||||
public static final int STUB_VERSION = 27;
|
||||
public static final int STUB_VERSION = 28;
|
||||
|
||||
public JavaFileElementType() {
|
||||
super("java.FILE", JavaLanguage.INSTANCE);
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
public interface <caret>I {
|
||||
void m();
|
||||
}
|
||||
|
||||
interface J extends I {}
|
||||
|
||||
+13
@@ -57,6 +57,19 @@ public class FindFunctionalInterfaceTest extends LightCodeInsightFixtureTestCase
|
||||
doTestOneExpression();
|
||||
}
|
||||
|
||||
public void testVarargPosition() throws Exception {
|
||||
myFixture.addClass("\n" +
|
||||
"class A { \n" +
|
||||
" <T> void foo(T... r) {}\n" +
|
||||
" void bar(J i){foo(i, i, () -> {});}\n" +
|
||||
"}");
|
||||
for (int i = 0; i < JavaFunctionalExpressionSearcher.SMART_SEARCH_THRESHOLD + 1; i++) {
|
||||
myFixture.addClass("class B" + i + " { {Runnable r = () -> {};}}"); //ensure common case is used
|
||||
}
|
||||
|
||||
doTestOneExpression();
|
||||
}
|
||||
|
||||
private void doTestOneExpression() {
|
||||
myFixture.configureByFile(getTestName(false) + ".java");
|
||||
final PsiElement elementAtCaret = myFixture.getElementAtCaret();
|
||||
|
||||
Reference in New Issue
Block a user