diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/CheckInitialized.java b/java/java-impl/src/com/intellij/codeInsight/completion/CheckInitialized.java index 129108251d87..ab71b944ea51 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/CheckInitialized.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/CheckInitialized.java @@ -41,7 +41,8 @@ class CheckInitialized implements ElementFilter { } static boolean isInsideConstructorCall(@NotNull PsiElement position) { - return ExpressionUtils.isConstructorInvocation(PsiTreeUtil.getParentOfType(position, PsiMethodCallExpression.class)); + return ExpressionUtils.isConstructorInvocation(PsiTreeUtil.getParentOfType(position, PsiMethodCallExpression.class)) && + !JavaKeywordCompletion.AFTER_DOT.accepts(position); } private static boolean isInitializedImplicitly(PsiField field) { diff --git a/java/java-tests/testData/codeInsight/completion/smartType/ChainMethodsInSuperConstructorCall-out.java b/java/java-tests/testData/codeInsight/completion/smartType/ChainMethodsInSuperConstructorCall-out.java new file mode 100644 index 000000000000..f78985d95ee6 --- /dev/null +++ b/java/java-tests/testData/codeInsight/completion/smartType/ChainMethodsInSuperConstructorCall-out.java @@ -0,0 +1,10 @@ +class A { + A(String a) {} +} + +class B extends A { + + B(Object aab) { + super(aab.toString()); + } +} \ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/completion/smartType/ChainMethodsInSuperConstructorCall.java b/java/java-tests/testData/codeInsight/completion/smartType/ChainMethodsInSuperConstructorCall.java new file mode 100644 index 000000000000..001ebd9c9ac5 --- /dev/null +++ b/java/java-tests/testData/codeInsight/completion/smartType/ChainMethodsInSuperConstructorCall.java @@ -0,0 +1,10 @@ +class A { + A(String a) {} +} + +class B extends A { + + B(Object aab) { + super(aab.to); + } +} \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartTypeCompletionTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartTypeCompletionTest.java index 4937a7d44e60..8eddf8f83837 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartTypeCompletionTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartTypeCompletionTest.java @@ -453,6 +453,8 @@ public class SmartTypeCompletionTest extends LightFixtureCompletionTestCase { public void testNoFieldsInSuperConstructorCall() throws Throwable { doTest(); } + public void testChainMethodsInSuperConstructorCall() throws Throwable { doTest(); } + public void testNoUninitializedFieldsInConstructor() throws Throwable { configureByTestName(); assertStringItems("aac", "aab", "hashCode");