mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
functional expressions & @FunctionalInterface based conflicts for pull up/push down refactorings
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
@FunctionalInterface
|
||||
interface I {
|
||||
void foo();
|
||||
}
|
||||
|
||||
class IImpl implements I {
|
||||
public void foo(){}
|
||||
public void g<caret>et() {}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
@FunctionalInterface
|
||||
interface I {
|
||||
void foo();
|
||||
|
||||
default void get() {}
|
||||
}
|
||||
|
||||
class IImpl implements I {
|
||||
public void foo(){}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
@FunctionalInterface
|
||||
interface Base {
|
||||
default void foo() {
|
||||
System.out.println("Hi there.");
|
||||
}
|
||||
void ba<caret>r();
|
||||
}
|
||||
|
||||
class Child implements Base {
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
@FunctionalInterface
|
||||
interface Base {
|
||||
default void foo() {
|
||||
System.out.println("Hi there.");
|
||||
}
|
||||
}
|
||||
|
||||
class Child implements Base {
|
||||
public abstract void bar();
|
||||
}
|
||||
@@ -95,7 +95,12 @@ public class PullUpTest extends LightRefactoringTestCase {
|
||||
|
||||
public void testNotFunctionalAnymore() {
|
||||
setLanguageLevel(LanguageLevel.JDK_1_8);
|
||||
doTest(true, "Functional expression demands functional interface to have exact one method", new RefactoringTestUtil.MemberDescriptor("get", PsiMethod.class));
|
||||
doTest(true, "Functional expression demands functional interface to have exact one method", new RefactoringTestUtil.MemberDescriptor("get", PsiMethod.class, true));
|
||||
}
|
||||
|
||||
public void testStillFunctional() {
|
||||
setLanguageLevel(LanguageLevel.JDK_1_8);
|
||||
doTest(true, new RefactoringTestUtil.MemberDescriptor("get", PsiMethod.class, false));
|
||||
}
|
||||
|
||||
public void testAsDefault() {
|
||||
|
||||
@@ -16,12 +16,14 @@
|
||||
package com.intellij.refactoring;
|
||||
|
||||
import com.intellij.codeInsight.TargetElementUtilBase;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.refactoring.memberPushDown.PushDownProcessor;
|
||||
import com.intellij.refactoring.util.DocCommentPolicy;
|
||||
import com.intellij.refactoring.util.classMembers.MemberInfo;
|
||||
import com.intellij.refactoring.util.classMembers.MemberInfoStorage;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.usageView.UsageInfo;
|
||||
import com.intellij.util.containers.MultiMap;
|
||||
|
||||
@@ -55,6 +57,7 @@ public class PushDownTest extends LightRefactoringTestCase {
|
||||
public void testExtensionMethodToClass() { doTest(); }
|
||||
|
||||
public void testFunctionalExpression() { doTest(true);}
|
||||
public void testFunctionalInterface() { doTest(true);}
|
||||
public void testFunctionalExpressionDefaultMethod() { doTest();}
|
||||
|
||||
private void doTest() {
|
||||
@@ -125,4 +128,9 @@ public class PushDownTest extends LightRefactoringTestCase {
|
||||
|
||||
checkResultByFile(BASE_PATH + getTestName(false) + "_after.java");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Sdk getProjectJDK() {
|
||||
return IdeaTestUtil.getMockJdk18();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user