diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/findUsages/GroovyConstructorUsagesSearchHelper.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/findUsages/GroovyConstructorUsagesSearchHelper.java index d3ea103a2b8e..c53a4c8d1f26 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/findUsages/GroovyConstructorUsagesSearchHelper.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/findUsages/GroovyConstructorUsagesSearchHelper.java @@ -153,7 +153,7 @@ public class GroovyConstructorUsagesSearchHelper { final GrConstructorInvocation invocation = (GrConstructorInvocation)statements[0]; if (invocation.isThisCall() == processThisRefs && invocation.getManager().areElementsEquivalent(invocation.resolveConstructor(), searchedConstructor) && - !consumer.process(invocation)) { + !consumer.process(invocation.getThisOrSuperKeyword())) { return false; } } diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parser/parsing/statements/constructor/ConstructorBody.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parser/parsing/statements/constructor/ConstructorBody.java index 4163acc4c878..a6ff89d69721 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parser/parsing/statements/constructor/ConstructorBody.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parser/parsing/statements/constructor/ConstructorBody.java @@ -65,8 +65,21 @@ public class ConstructorBody implements GroovyElementTypes { private static boolean parseExplicitConstructor(PsiBuilder builder, GroovyParser parser) { TypeArguments.parse(builder); + boolean result = false; + if (ParserUtils.lookAhead(builder, kTHIS, mLPAREN)) { + final PsiBuilder.Marker marker = builder.mark(); + ParserUtils.getToken(builder, kTHIS); + marker.done(THIS_REFERENCE_EXPRESSION); + result = true; + } + if (ParserUtils.lookAhead(builder, kSUPER, mLPAREN)) { + final PsiBuilder.Marker marker = builder.mark(); + ParserUtils.getToken(builder, kSUPER); + marker.done(SUPER_REFERENCE_EXPRESSION); + result = true; + } - if ((ParserUtils.getToken(builder, kTHIS) || ParserUtils.getToken(builder, kSUPER)) && ParserUtils.lookAhead(builder, mLPAREN)) { + if (result) { PsiBuilder.Marker marker = builder.mark(); ParserUtils.getToken(builder, mLPAREN); ArgumentList.parseArgumentList(builder, mRPAREN, parser); diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/api/statements/GrConstructorInvocation.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/api/statements/GrConstructorInvocation.java index 5ed606681f5b..91aee9536d4a 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/api/statements/GrConstructorInvocation.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/api/statements/GrConstructorInvocation.java @@ -16,18 +16,17 @@ package org.jetbrains.plugins.groovy.lang.psi.api.statements; import com.intellij.psi.PsiClass; -import com.intellij.psi.PsiElement; -import com.intellij.psi.PsiPolyVariantReference; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.plugins.groovy.lang.psi.api.statements.arguments.GrArgumentList; import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrConstructorCall; +import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrThisSuperReferenceExpression; /** * User: Dmitry.Krasilschikov * Date: 29.05.2007 */ -public interface GrConstructorInvocation extends GrStatement, GrConstructorCall, PsiPolyVariantReference { +public interface GrConstructorInvocation extends GrStatement, GrConstructorCall { boolean isSuperCall(); boolean isThisCall(); @@ -35,7 +34,7 @@ public interface GrConstructorInvocation extends GrStatement, GrConstructorCall, @NotNull GrArgumentList getArgumentList(); - PsiElement getThisOrSuperKeyword(); + GrThisSuperReferenceExpression getThisOrSuperKeyword(); @Nullable PsiClass getDelegatedClass(); diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/api/statements/expressions/GrSuperReferenceExpression.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/api/statements/expressions/GrSuperReferenceExpression.java index b01e40a92a5d..d4400f8f1244 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/api/statements/expressions/GrSuperReferenceExpression.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/api/statements/expressions/GrSuperReferenceExpression.java @@ -4,12 +4,8 @@ package org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions; -import org.jetbrains.annotations.Nullable; - /** * @author ilyas */ -public interface GrSuperReferenceExpression extends GrExpression { - @Nullable - GrReferenceExpression getQualifier(); +public interface GrSuperReferenceExpression extends GrThisSuperReferenceExpression { } \ No newline at end of file diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/api/statements/expressions/GrThisReferenceExpression.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/api/statements/expressions/GrThisReferenceExpression.java index ec6daf46be55..a8b0da352bfc 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/api/statements/expressions/GrThisReferenceExpression.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/api/statements/expressions/GrThisReferenceExpression.java @@ -4,12 +4,8 @@ package org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions; -import org.jetbrains.annotations.Nullable; - /** * @author ilyas */ -public interface GrThisReferenceExpression extends GrExpression { - @Nullable - GrReferenceExpression getQualifier(); +public interface GrThisReferenceExpression extends GrThisSuperReferenceExpression { } diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/api/statements/expressions/GrThisSuperReferenceExpression.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/api/statements/expressions/GrThisSuperReferenceExpression.java new file mode 100644 index 000000000000..ac0c9ab00418 --- /dev/null +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/api/statements/expressions/GrThisSuperReferenceExpression.java @@ -0,0 +1,27 @@ +/* + * Copyright 2000-2010 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions; + +import com.intellij.psi.PsiPolyVariantReference; +import org.jetbrains.annotations.Nullable; + +/** + * @author Maxim.Medvedev + */ +public interface GrThisSuperReferenceExpression extends GrExpression, PsiPolyVariantReference { + @Nullable + GrReferenceExpression getQualifier(); +} diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/GrConstructorInvocationImpl.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/GrConstructorInvocationImpl.java index f8460706203f..707c0012b9b4 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/GrConstructorInvocationImpl.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/GrConstructorInvocationImpl.java @@ -21,17 +21,17 @@ import com.intellij.psi.*; import com.intellij.psi.tree.TokenSet; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.psi.util.TypeConversionUtil; -import com.intellij.util.ArrayUtil; import com.intellij.util.IncorrectOperationException; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes; +import org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes; import org.jetbrains.plugins.groovy.lang.psi.GroovyElementVisitor; import org.jetbrains.plugins.groovy.lang.psi.api.GroovyResolveResult; import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrConstructorInvocation; import org.jetbrains.plugins.groovy.lang.psi.api.statements.arguments.GrArgumentList; import org.jetbrains.plugins.groovy.lang.psi.api.statements.arguments.GrNamedArgument; import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression; +import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrThisSuperReferenceExpression; import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefinition; import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyPsiElementImpl; import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyResolveResultImpl; @@ -73,17 +73,18 @@ public class GrConstructorInvocationImpl extends GroovyPsiElementImpl implements } public boolean isSuperCall() { - return findChildByType(GroovyTokenTypes.kSUPER) != null; + return findChildByType(GroovyElementTypes.SUPER_REFERENCE_EXPRESSION) != null; } public boolean isThisCall() { - return findChildByType(GroovyTokenTypes.kTHIS) != null; + return findChildByType(GroovyElementTypes.THIS_REFERENCE_EXPRESSION) != null; } - private static final TokenSet THIS_OR_SUPER_SET = TokenSet.create(GroovyTokenTypes.kTHIS, GroovyTokenTypes.kSUPER); + private static final TokenSet THIS_OR_SUPER_SET = + TokenSet.create(GroovyElementTypes.THIS_REFERENCE_EXPRESSION, GroovyElementTypes.SUPER_REFERENCE_EXPRESSION); - public PsiElement getThisOrSuperKeyword() { - return findChildByType(THIS_OR_SUPER_SET); + public GrThisSuperReferenceExpression getThisOrSuperKeyword() { + return (GrThisSuperReferenceExpression)findChildByType(THIS_OR_SUPER_SET); } public GroovyResolveResult[] multiResolveConstructor() { @@ -156,36 +157,4 @@ public class GrConstructorInvocationImpl extends GroovyPsiElementImpl implements public String getCanonicalText() { return getText(); //TODO } - - public PsiElement handleElementRename(String newElementName) throws IncorrectOperationException { - return this; - } - - public PsiElement bindToElement(@NotNull PsiElement element) throws IncorrectOperationException { - return this; - } - - public boolean isReferenceTo(PsiElement element) { - return element instanceof PsiMethod && ((PsiMethod)element).isConstructor() && getManager().areElementsEquivalent(element, resolve()); - - } - - @NotNull - public Object[] getVariants() { - return ArrayUtil.EMPTY_OBJECT_ARRAY; - } - - public boolean isSoft() { - return false; - } - - @Override - public PsiReference getReference() { - return this; - } - - @NotNull - public ResolveResult[] multiResolve(boolean incompleteCode) { - return multiResolveConstructor(); - } } diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/GrSuperReferenceExpressionImpl.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/GrSuperReferenceExpressionImpl.java index 8d1f4dd657ce..fed5fc22d790 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/GrSuperReferenceExpressionImpl.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/GrSuperReferenceExpressionImpl.java @@ -9,7 +9,6 @@ import com.intellij.psi.*; import com.intellij.psi.util.PsiTreeUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes; import org.jetbrains.plugins.groovy.lang.psi.GroovyElementVisitor; import org.jetbrains.plugins.groovy.lang.psi.GroovyFile; import org.jetbrains.plugins.groovy.lang.psi.GroovyFileBase; @@ -22,7 +21,7 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefini /** * @author ilyas */ -public class GrSuperReferenceExpressionImpl extends GrExpressionImpl implements GrSuperReferenceExpression { +public class GrSuperReferenceExpressionImpl extends GrThisSuperReferenceExpressionBase implements GrSuperReferenceExpression { public GrSuperReferenceExpressionImpl(@NotNull ASTNode node) { super(node); } @@ -60,11 +59,6 @@ public class GrSuperReferenceExpressionImpl extends GrExpressionImpl implements return null; } - @Nullable - public GrReferenceExpression getQualifier() { - return (GrReferenceExpression)findChildByType(GroovyElementTypes.REFERENCE_EXPRESSION); - } - @Nullable private PsiType getSuperType(PsiClass aClass) { if (aClass.isInterface()) { @@ -88,4 +82,10 @@ public class GrSuperReferenceExpressionImpl extends GrExpressionImpl implements return superTypes[0]; } + + @NotNull + @Override + public String getCanonicalText() { + return "super"; + } } diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/GrThisReferenceExpressionImpl.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/GrThisReferenceExpressionImpl.java index 95f465b09902..f2d892c46aaf 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/GrThisReferenceExpressionImpl.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/GrThisReferenceExpressionImpl.java @@ -9,8 +9,6 @@ import com.intellij.psi.*; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.util.IncorrectOperationException; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes; import org.jetbrains.plugins.groovy.lang.psi.GroovyElementVisitor; import org.jetbrains.plugins.groovy.lang.psi.GroovyFile; import org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElement; @@ -22,7 +20,7 @@ import org.jetbrains.plugins.groovy.lang.psi.util.PsiUtil; /** * @author ilyas */ -public class GrThisReferenceExpressionImpl extends GrExpressionImpl implements GrThisReferenceExpression { +public class GrThisReferenceExpressionImpl extends GrThisSuperReferenceExpressionBase implements GrThisReferenceExpression { public GrThisReferenceExpressionImpl(@NotNull ASTNode node) { super(node); } @@ -73,8 +71,9 @@ public class GrThisReferenceExpressionImpl extends GrExpressionImpl implements G return elementFactory.createType(context); } - @Nullable - public GrReferenceExpression getQualifier() { - return (GrReferenceExpression)findChildByType(GroovyElementTypes.REFERENCE_EXPRESSION); + @NotNull + @Override + public String getCanonicalText() { + return "this"; } } diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/GrThisSuperReferenceExpressionBase.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/GrThisSuperReferenceExpressionBase.java new file mode 100644 index 000000000000..99604e3acc57 --- /dev/null +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/GrThisSuperReferenceExpressionBase.java @@ -0,0 +1,82 @@ +package org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions; + +import com.intellij.lang.ASTNode; +import com.intellij.openapi.util.TextRange; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiMethod; +import com.intellij.psi.PsiReference; +import com.intellij.psi.ResolveResult; +import com.intellij.util.ArrayUtil; +import com.intellij.util.IncorrectOperationException; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes; +import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrConstructorInvocation; +import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrReferenceExpression; +import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrThisSuperReferenceExpression; + +/** + * @author Maxim.Medvedev + */ +public abstract class GrThisSuperReferenceExpressionBase extends GrExpressionImpl implements GrThisSuperReferenceExpression { + public GrThisSuperReferenceExpressionBase(ASTNode node) { + super(node); + } + + @Nullable + public GrReferenceExpression getQualifier() { + return (GrReferenceExpression)findChildByType(GroovyElementTypes.REFERENCE_EXPRESSION); + } + + @Override + public PsiElement getElement() { + return this; + } + + @Override + public TextRange getRangeInElement() { + return new TextRange(0, getTextLength()); + } + + @Override + public PsiElement resolve() { + final PsiElement parent = getParent(); + if (parent instanceof GrConstructorInvocation)return ((GrConstructorInvocation)parent).resolveConstructor(); + return null; + } + + public PsiElement handleElementRename(String newElementName) throws IncorrectOperationException { + return this; + } + + public PsiElement bindToElement(@NotNull PsiElement element) throws IncorrectOperationException { + return this; + } + + public boolean isReferenceTo(PsiElement element) { + return element instanceof PsiMethod && ((PsiMethod)element).isConstructor() && getManager().areElementsEquivalent(element, resolve()); + } + + @NotNull + public Object[] getVariants() { + return ArrayUtil.EMPTY_OBJECT_ARRAY; + } + + public boolean isSoft() { + return false; + } + + @Override + public PsiReference getReference() { + return this; + } + + @NotNull + public ResolveResult[] multiResolve(boolean incompleteCode) { + final PsiElement parent = getParent(); + if (parent instanceof GrConstructorInvocation) { + return ((GrConstructorInvocation)parent).multiResolveConstructor(); + } + return ResolveResult.EMPTY_ARRAY; + } +} diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/util/PsiUtil.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/util/PsiUtil.java index d1981723e78c..640357cce719 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/util/PsiUtil.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/util/PsiUtil.java @@ -856,7 +856,7 @@ public class PsiUtil { public static boolean isMethodUsage(PsiElement element) { if (element instanceof GrEnumConstant) return true; - if (!(element instanceof GrReferenceElement)) return false; + if (!(element instanceof GrReferenceElement || element instanceof GrThisSuperReferenceExpression)) return false; PsiElement parent = element.getParent(); if (parent instanceof GrCall) { return true; diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/changeSignature/ChangeSignatureTest.java b/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/changeSignature/ChangeSignatureTest.java index 66a6b287c437..f4d84488722e 100644 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/changeSignature/ChangeSignatureTest.java +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/changeSignature/ChangeSignatureTest.java @@ -216,20 +216,24 @@ public class ChangeSignatureTest extends ChangeSignatureTestCase { doTest(new SimpleInfo[]{new SimpleInfo("l", 1, null, null, "Map[]"), new SimpleInfo(0)}); } + public void testConstructorCall() { + doTest(new SimpleInfo[]{new SimpleInfo(0), new SimpleInfo("a", -1, "1", null, PsiType.INT)}); + } + private PsiType createType(String typeText) { return JavaPsiFacade.getElementFactory(getProject()).createTypeByFQClassName(typeText, GlobalSearchScope.allScope(getProject())); } - private void doTest(SimpleInfo[] parameterInfos) throws Exception { + private void doTest(SimpleInfo[] parameterInfos) { doTest("public", null, null, parameterInfos, new ThrownExceptionInfo[0], false); } - private void doTest(String newReturnType, SimpleInfo[] parameterInfos) throws Exception { + private void doTest(String newReturnType, SimpleInfo[] parameterInfos) { doTest("public", null, newReturnType, parameterInfos, new ThrownExceptionInfo[0], false); } - private void doTest(String newReturnType, SimpleInfo[] parameterInfos, final boolean generateDelegate) throws Exception { + private void doTest(String newReturnType, SimpleInfo[] parameterInfos, final boolean generateDelegate) { doTest("public", null, newReturnType, parameterInfos, new ThrownExceptionInfo[0], generateDelegate); } @@ -238,7 +242,7 @@ public class ChangeSignatureTest extends ChangeSignatureTestCase { String newReturnType, SimpleInfo[] parameterInfo, ThrownExceptionInfo[] exceptionInfo, - final boolean generateDelegate) throws Exception { + final boolean generateDelegate) { final File javaSrc = new File(getTestDataPath() + "/" + getTestName(false) + ".java"); if (javaSrc.exists()) { myFixture.copyFileToProject(getTestName(false) + ".java"); diff --git a/plugins/groovy/testdata/parsing/groovy/statements/typedef/constructors/constructor1.test b/plugins/groovy/testdata/parsing/groovy/statements/typedef/constructors/constructor1.test index 10667feddba0..17b392c66fb5 100644 --- a/plugins/groovy/testdata/parsing/groovy/statements/typedef/constructors/constructor1.test +++ b/plugins/groovy/testdata/parsing/groovy/statements/typedef/constructors/constructor1.test @@ -32,7 +32,8 @@ Groovy script PsiElement({)('{') PsiWhiteSpace('\n ') Constructor invocation - PsiElement(this)('this') + 'this' reference expression + PsiElement(this)('this') PsiWhiteSpace(' ') Arguments PsiElement(()('(') diff --git a/plugins/groovy/testdata/parsing/groovy/statements/typedef/constructors/constructor2.test b/plugins/groovy/testdata/parsing/groovy/statements/typedef/constructors/constructor2.test index 7d69532a781f..0dccf897942e 100644 --- a/plugins/groovy/testdata/parsing/groovy/statements/typedef/constructors/constructor2.test +++ b/plugins/groovy/testdata/parsing/groovy/statements/typedef/constructors/constructor2.test @@ -34,7 +34,8 @@ Groovy script PsiElement({)('{') PsiWhiteSpace('\n ') Constructor invocation - PsiElement(super)('super') + 'super' reference expression + PsiElement(super)('super') Arguments PsiElement(()('(') PsiElement())(')') diff --git a/plugins/groovy/testdata/parsing/groovy/statements/typedef/constructors/constructor3.test b/plugins/groovy/testdata/parsing/groovy/statements/typedef/constructors/constructor3.test index 543a792f9ebd..3a7d3dfa2214 100644 --- a/plugins/groovy/testdata/parsing/groovy/statements/typedef/constructors/constructor3.test +++ b/plugins/groovy/testdata/parsing/groovy/statements/typedef/constructors/constructor3.test @@ -32,7 +32,8 @@ Groovy script PsiElement({)('{') PsiWhiteSpace('\n ') Constructor invocation - PsiElement(this)('this') + 'this' reference expression + PsiElement(this)('this') Arguments PsiElement(()('(') PsiElement())(')') diff --git a/plugins/groovy/testdata/parsing/groovy/statements/typedef/constructors/constructor5.test b/plugins/groovy/testdata/parsing/groovy/statements/typedef/constructors/constructor5.test index 78698c6f5561..72e3ca82f323 100644 --- a/plugins/groovy/testdata/parsing/groovy/statements/typedef/constructors/constructor5.test +++ b/plugins/groovy/testdata/parsing/groovy/statements/typedef/constructors/constructor5.test @@ -39,7 +39,8 @@ Groovy script PsiElement({)('{') PsiWhiteSpace('\n ') Constructor invocation - PsiElement(this)('this') + 'this' reference expression + PsiElement(this)('this') PsiWhiteSpace(' ') Arguments PsiElement(()('(') diff --git a/plugins/groovy/testdata/parsing/groovy/statements/typedef/constructors/constructor6.test b/plugins/groovy/testdata/parsing/groovy/statements/typedef/constructors/constructor6.test index 7432dfea3d65..c711c17da9ca 100644 --- a/plugins/groovy/testdata/parsing/groovy/statements/typedef/constructors/constructor6.test +++ b/plugins/groovy/testdata/parsing/groovy/statements/typedef/constructors/constructor6.test @@ -33,7 +33,8 @@ Groovy script PsiElement({)('{') PsiWhiteSpace('\n ') Constructor invocation - PsiElement(this)('this') + 'this' reference expression + PsiElement(this)('this') Arguments PsiElement(()('(') PsiElement())(')') diff --git a/plugins/groovy/testdata/parsing/groovy/statements/typedef/constructors/constructor8.test b/plugins/groovy/testdata/parsing/groovy/statements/typedef/constructors/constructor8.test index fe23f5bc045a..8ecd734e6fb3 100644 --- a/plugins/groovy/testdata/parsing/groovy/statements/typedef/constructors/constructor8.test +++ b/plugins/groovy/testdata/parsing/groovy/statements/typedef/constructors/constructor8.test @@ -39,7 +39,8 @@ Groovy script PsiElement({)('{') PsiWhiteSpace('\n ') Constructor invocation - PsiElement(this)('this') + 'this' reference expression + PsiElement(this)('this') PsiWhiteSpace(' ') Arguments PsiElement(()('(') diff --git a/plugins/groovy/testdata/parsing/groovy/statements/typedef/constructors/constructor9.test b/plugins/groovy/testdata/parsing/groovy/statements/typedef/constructors/constructor9.test index 8cd7b5834167..eea22f6ef80a 100644 --- a/plugins/groovy/testdata/parsing/groovy/statements/typedef/constructors/constructor9.test +++ b/plugins/groovy/testdata/parsing/groovy/statements/typedef/constructors/constructor9.test @@ -43,7 +43,8 @@ Groovy script PsiElement({)('{') PsiWhiteSpace('\n ') Constructor invocation - PsiElement(this)('this') + 'this' reference expression + PsiElement(this)('this') PsiWhiteSpace(' ') Arguments PsiElement(()('(') diff --git a/plugins/groovy/testdata/parsing/groovy/statements/typedef/interfaces/errors/interfaceerr1.test b/plugins/groovy/testdata/parsing/groovy/statements/typedef/interfaces/errors/interfaceerr1.test index da49e3c00fc1..f551a5148732 100644 --- a/plugins/groovy/testdata/parsing/groovy/statements/typedef/interfaces/errors/interfaceerr1.test +++ b/plugins/groovy/testdata/parsing/groovy/statements/typedef/interfaces/errors/interfaceerr1.test @@ -52,7 +52,8 @@ Groovy script PsiElement({)('{') PsiWhiteSpace('\n ') Constructor invocation - PsiElement(this)('this') + 'this' reference expression + PsiElement(this)('this') Arguments PsiElement(()('(') PsiElement())(')') diff --git a/plugins/groovy/testdata/refactoring/changeSignature/ConstructorCall.groovy b/plugins/groovy/testdata/refactoring/changeSignature/ConstructorCall.groovy new file mode 100644 index 000000000000..d90bc5a6c2ab --- /dev/null +++ b/plugins/groovy/testdata/refactoring/changeSignature/ConstructorCall.groovy @@ -0,0 +1,15 @@ +class Foo { + def Foo() { + this("a") + } + + def Foo(String s) { + + } +} + +class Bar extends Foo { + def Bar() { + super("d") + } +} \ No newline at end of file diff --git a/plugins/groovy/testdata/refactoring/changeSignature/ConstructorCall_after.groovy b/plugins/groovy/testdata/refactoring/changeSignature/ConstructorCall_after.groovy new file mode 100644 index 000000000000..504fdcda027e --- /dev/null +++ b/plugins/groovy/testdata/refactoring/changeSignature/ConstructorCall_after.groovy @@ -0,0 +1,15 @@ +class Foo { + def Foo() { + this("a", 1) + } + + def Foo(String s, int a) { + + } +} + +class Bar extends Foo { + def Bar() { + super("d", 1) + } +} \ No newline at end of file