LightTypeElement#getText: include annotations

Otherwise JavaChangeInfoImpl.fillOldParams thinks that old parameter type has no annotation, so if we removed an annotation, it's considered unchanged
Fixes IDEA-235090 "Change signature" action removing @NotNull does nothing

GitOrigin-RevId: 419990f23330090fc5bd8f92500328db7bd5e15b
This commit is contained in:
Tagir Valeev
2020-03-18 07:01:42 +00:00
committed by intellij-monorepo-bot
parent cdc2649bc5
commit 218a25f776
4 changed files with 24 additions and 1 deletions
@@ -24,7 +24,7 @@ public class LightTypeElement extends LightElement implements PsiTypeElement {
@Override
public String getText() {
return myType.getPresentableText();
return myType.getPresentableText(true);
}
@Override
@@ -0,0 +1,8 @@
import java.lang.annotation.*;
class X {
void <caret>test(@Foo int x) {}
@Target(ElementType.TYPE_USE)
@interface Foo
}
@@ -0,0 +1,8 @@
import java.lang.annotation.*;
class X {
void test(int x) {}
@Target(ElementType.TYPE_USE)
@interface Foo
}
@@ -560,6 +560,13 @@ public class ChangeSignatureTest extends ChangeSignatureBaseTest {
};
}, false);
}
public void testRemoveAnnotation() {
doTest(null, null, null, method -> new ParameterInfoImpl[]{
ParameterInfoImpl.create(0).withName("x").withType(PsiType.INT)
}, false);
}
/* workers */
}