mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
explicit -> var: preserve comments
found by property testing GitOrigin-RevId: c626ca0f4039927c59e7acae5c44a38fb0d31f35
This commit is contained in:
committed by
intellij-monorepo-bot
parent
c4d7796bb2
commit
c5e8fb5b98
+2
-1
@@ -62,6 +62,7 @@ import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.Processor;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.MultiMap;
|
||||
import com.siyeh.ig.psiutils.CommentTracker;
|
||||
import com.siyeh.ig.psiutils.VariableAccessUtils;
|
||||
import com.siyeh.ipp.psiutils.ErrorUtil;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
@@ -961,7 +962,7 @@ public abstract class IntroduceVariableBase extends IntroduceHandlerBase {
|
||||
}
|
||||
}
|
||||
|
||||
return typeElement.replace(JavaPsiFacade.getElementFactory(context.getProject()).createTypeElementFromText("var", context));
|
||||
return new CommentTracker().replaceAndRestoreComments(typeElement, JavaPsiFacade.getElementFactory(context.getProject()).createTypeElementFromText("var", context));
|
||||
}
|
||||
|
||||
public static PsiElement replace(final PsiExpression expr1, final PsiExpression ref, final Project project)
|
||||
|
||||
+2
-1
@@ -1,7 +1,8 @@
|
||||
// "Replace explicit type with 'var'" "true"
|
||||
class Main {
|
||||
{
|
||||
@Anno var args = new String[42];
|
||||
//c1
|
||||
@Anno var args = new String[42];
|
||||
}
|
||||
}
|
||||
@interface Anno {}
|
||||
+2
-1
@@ -1,7 +1,8 @@
|
||||
// "Replace explicit type with 'var'" "true"
|
||||
class Main {
|
||||
{
|
||||
@Anno <caret>String[] args = new String[42];
|
||||
@Anno <caret>String//c1
|
||||
[] args = new String[42];
|
||||
}
|
||||
}
|
||||
@interface Anno {}
|
||||
Reference in New Issue
Block a user