move enum to inner: don't add static modifier (IDEA-185872)

This commit is contained in:
Ivo Šmíd
2018-01-31 17:25:10 +03:00
committed by Anna Kozlova
parent 8b064122b1
commit af250865af
7 changed files with 20 additions and 1 deletions
@@ -49,7 +49,7 @@ public class JavaMoveClassToInnerHandler implements MoveClassToInnerHandler {
if (targetClass.isInterface()) {
PsiUtil.setModifierProperty(newClass, PsiModifier.PACKAGE_LOCAL, true);
}
else {
else if (!newClass.isEnum()) {
PsiUtil.setModifierProperty(newClass, PsiModifier.STATIC, true);
}
return (PsiClass)ChangeContextUtil.decodeContextInfo(newClass, null, null);
@@ -0,0 +1,6 @@
package pack1;
public class Class1 {
public enum AEnum {
}
}
@@ -0,0 +1,4 @@
package pack1;
public class Class1 {
}
@@ -0,0 +1,5 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package pack2;
public enum AEnum {
}
@@ -52,6 +52,10 @@ public class MoveClassToInnerTest extends RefactoringTestCase {
doTest(new String[] { "pack1.Class1" }, "pack2.A");
}
public void testInnerEnum() throws Exception {
doTest(new String[] { "pack2.AEnum" }, "pack1.Class1");
}
public void testInnerInsideMoved() throws Exception {
doTest(new String[] { "pack1.Class1" }, "pack2.A");
}