mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java-intentions] ModifierFix: Avoid adding modifier on separate line if modifier list consists of annotations only
IJ-CR-102194 GitOrigin-RevId: 50d4f16ee583d75be79f8c77126a5d20944bddef
This commit is contained in:
committed by
intellij-monorepo-bot
parent
c27a5fdc2f
commit
56e57c4179
@@ -157,7 +157,13 @@ public class ModifierFix extends LocalQuickFixAndIntentionActionOnPsiElement imp
|
||||
|
||||
private void changeModifierList (@NotNull PsiModifierList modifierList) {
|
||||
try {
|
||||
boolean needRemoveWhiteSpace = modifierList.getLastChild() instanceof PsiAnnotation &&
|
||||
modifierList.getNextSibling() instanceof PsiWhiteSpace &&
|
||||
myShouldHave;
|
||||
modifierList.setModifierProperty(myModifier, myShouldHave);
|
||||
if (needRemoveWhiteSpace) {
|
||||
modifierList.getNextSibling().delete();
|
||||
}
|
||||
}
|
||||
catch (IncorrectOperationException e) {
|
||||
LOG.error(e);
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
import com.intellij.openapi.components.Service;
|
||||
|
||||
@Service
|
||||
strictfp
|
||||
class <error descr="Light service must be final">MyService<caret></error> {
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
import com.intellij.openapi.components.Service;
|
||||
|
||||
@Service
|
||||
final strictfp
|
||||
class MyService {
|
||||
}
|
||||
+1
-2
@@ -1,6 +1,5 @@
|
||||
import com.intellij.openapi.components.Service;
|
||||
|
||||
@Service
|
||||
final
|
||||
class MyService {
|
||||
final class MyService {
|
||||
}
|
||||
|
||||
+3
-3
@@ -14,7 +14,7 @@ internal class LightServiceMustBeFinalInspectionTest : LightServiceMustBeFinalIn
|
||||
|
||||
override fun getFileExtension() = "java"
|
||||
|
||||
fun testMakeFinal() {
|
||||
doTest(MAKE_FINAL_FIX_NAME)
|
||||
}
|
||||
fun testMakeFinal() { doTest(MAKE_FINAL_FIX_NAME) }
|
||||
|
||||
fun testMakeFinalMultiLineModifierList() { doTest(MAKE_FINAL_FIX_NAME) }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user