mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 15:27:45 +07:00
IDEA-151190 Change class signature doesn't support complicated bounds
This commit is contained in:
+9
@@ -0,0 +1,9 @@
|
||||
import java.io.Serializable;
|
||||
|
||||
class <caret>C {}
|
||||
|
||||
class Some implements Runnable, Serializable {
|
||||
void m() {
|
||||
C c = new C();
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
import java.io.Serializable;
|
||||
|
||||
class C<T extends Runnable & Serializable> {}
|
||||
|
||||
class Some implements Runnable, Serializable {
|
||||
void m() {
|
||||
C<Some> c = new C<Some>();
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public class Main {
|
||||
|
||||
class B<T extends java.util.Collection> {}
|
||||
class B<T extends Collection> {}
|
||||
|
||||
public void someMethod() {
|
||||
B<List> b = new B<List>();
|
||||
|
||||
+2
-1
@@ -1,8 +1,9 @@
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public class Main {
|
||||
|
||||
class B<T extends java.util.Collection, X extends Long> {}
|
||||
class B<T extends Collection, X extends Long> {}
|
||||
|
||||
public void someMethod() {
|
||||
B<List, Long> b = new B<>();
|
||||
|
||||
+14
-2
@@ -2,8 +2,7 @@ package com.intellij.refactoring.changeClassSignature;
|
||||
|
||||
import com.intellij.JavaTestUtil;
|
||||
import com.intellij.codeInsight.TargetElementUtil;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.refactoring.LightRefactoringTestCase;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -100,6 +99,19 @@ public class ChangeClassSignatureTest extends LightRefactoringTestCase {
|
||||
});
|
||||
}
|
||||
|
||||
public void testAddBoundWithIntersection() throws Exception {
|
||||
doTest(aClass -> {
|
||||
final PsiElementFactory factory = JavaPsiFacade.getElementFactory(aClass.getProject());
|
||||
final PsiFile context = aClass.getContainingFile();
|
||||
return new TypeParameterInfo[]{
|
||||
new TypeParameterInfo.New("T",
|
||||
factory.createTypeFromText("Some", context),
|
||||
PsiIntersectionType.createIntersection(factory.createTypeFromText("java.lang.Runnable", context),
|
||||
factory.createTypeFromText("java.io.Serializable", context)))
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
private void doTest(Function<PsiClass, TypeParameterInfo[]> gen) throws Exception {
|
||||
@NonNls final String filePathBefore = getTestName(false) + ".java";
|
||||
@NonNls final String filePathAfter = getTestName(false) + ".java.after";
|
||||
|
||||
Reference in New Issue
Block a user