EA-88093 - IOE: PsiElementFactoryImpl.createField

This commit is contained in:
Anna Kozlova
2016-09-22 20:40:28 +03:00
parent 558da78dd2
commit 3856ae2cb0
4 changed files with 41 additions and 0 deletions

View File

@@ -405,6 +405,9 @@ public class GenerateDelegateHandler implements LanguageCodeInsightActionHandler
final PsiVariable psiVariable = proc.getResult(i);
final PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(aClass.getProject());
final PsiType type = psiVariable.getType();
if (LambdaUtil.notInferredType(type)) {
continue;
}
result.add(new PsiFieldMember(elementFactory.createField(psiVariable.getName(), type instanceof PsiEllipsisType ? ((PsiEllipsisType)type).toArrayType() : type)) {
@Override
protected PsiClass getContainingClass() {

View File

@@ -0,0 +1,17 @@
import java.util.function.Function;
class Test {
public void foo() {
foo(s -> {
new Function<String, String>() {
{
<caret>
}
}
})
}
}

View File

@@ -0,0 +1,17 @@
import java.util.function.Function;
class Test {
public void foo() {
foo(s -> {
new Function<String, String>() {
{
<caret>
}
}
})
}
}

View File

@@ -92,6 +92,10 @@ public class DelegateMethodsTest extends LightCodeInsightTestCase {
doTest();
}
public void testInsideLambdaWithNonInferredTypeParameters() throws Exception {
doTest();
}
private void doTest() throws Exception {
doTest(getTestName(false));
}