mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Java: pushing down nested class from interface to class should add static modifier (IDEA-241036)
GitOrigin-RevId: 9b6541f85a1ea73a3debe088ff32899db79aade4
This commit is contained in:
committed by
intellij-monorepo-bot
parent
9cb3b5a16f
commit
a6d3ae518f
+4
-1
@@ -303,9 +303,12 @@ public class JavaPushDownDelegate extends PushDownDelegate<MemberInfo, PsiMember
|
||||
inlineSuperCall(memberInfo, methodBySignature);
|
||||
}
|
||||
}
|
||||
else if (member instanceof PsiClass) {
|
||||
else if (member instanceof PsiClass aClass) {
|
||||
if (sourceClass.isInterface() && !targetClass.isInterface()) {
|
||||
PsiUtil.setModifierProperty(member, PsiModifier.PUBLIC, true);
|
||||
if (!aClass.isRecord() && !aClass.isInterface() && !aClass.isEnum()) {
|
||||
PsiUtil.setModifierProperty(member, PsiModifier.STATIC, true);
|
||||
}
|
||||
}
|
||||
if (Boolean.FALSE.equals(memberInfo.getOverrides())) {
|
||||
final PsiClass psiClass = (PsiClass)memberInfo.getMember();
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
interface IMessage {
|
||||
class <caret>Topic {
|
||||
}
|
||||
}
|
||||
|
||||
abstract class Message implements IMessage {
|
||||
public static void main(String[] args) {
|
||||
new Topic();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
interface IMessage {
|
||||
}
|
||||
|
||||
abstract class Message implements IMessage {
|
||||
public static void main(String[] args) {
|
||||
new Topic();
|
||||
}
|
||||
|
||||
public static class Topic {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
interface IMessage {
|
||||
record <caret>Topic() {
|
||||
}
|
||||
}
|
||||
|
||||
abstract class Message implements IMessage {
|
||||
public static void main(String[] args) {
|
||||
new Topic();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
interface IMessage {
|
||||
}
|
||||
|
||||
abstract class Message implements IMessage {
|
||||
public static void main(String[] args) {
|
||||
new Topic();
|
||||
}
|
||||
|
||||
public record Topic() {
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.java.refactoring;
|
||||
|
||||
import com.intellij.codeInsight.TargetElementUtil;
|
||||
@@ -68,6 +68,8 @@ public class PushDownTest extends LightRefactoringTestCase {
|
||||
public void testDefaultMethodToClassKeepAbstract() { doTestImplements(true); }
|
||||
public void testInterfaceStaticMethodToInterface() { doTest(); }
|
||||
public void testInterfaceStaticMethodToClass() { doTest(); }
|
||||
public void testInterfaceInnerRecordToClass() { doTest(); }
|
||||
public void testInterfaceInnerClassToClass() { doTest(); }
|
||||
public void testThisSuperExpressions() {doTest();}
|
||||
public void testMethodsInheritedFromSuper() {doTest();}
|
||||
public void testMethodsInheritedFromSuper1() {doTest();}
|
||||
|
||||
Reference in New Issue
Block a user