mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java-inspections] IDEA-364068 don't use PsiType as field in ChangeExtendsToImplementsFix
GitOrigin-RevId: 51cb044bc1a3bad93f2ea34504a3c8e3f5ee9916
This commit is contained in:
committed by
intellij-monorepo-bot
parent
d677eb3e14
commit
d92d827067
+6
-1
@@ -9,6 +9,7 @@ import com.intellij.modcommand.ModPsiUpdater;
|
||||
import com.intellij.modcommand.Presentation;
|
||||
import com.intellij.modcommand.PsiUpdateModCommandAction;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.PsiTypesUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -27,7 +28,11 @@ public class ChangeExtendsToImplementsFix extends PsiUpdateModCommandAction<PsiC
|
||||
myToAdd = true;
|
||||
PsiClassType classType = aClass instanceof PsiTypeParameter ? classTypeToExtendFrom
|
||||
: (PsiClassType)GenericsUtil.eliminateWildcards(classTypeToExtendFrom);
|
||||
myTypeToExtendFrom = classType.getCanonicalText(true);
|
||||
PsiType typeToExtend = PsiTypesUtil.removeExternalAnnotations(classType);
|
||||
if (typeToExtend.getAnnotations().length > 0) {
|
||||
typeToExtend = typeToExtend.annotate(TypeAnnotationProvider.Static.create(PsiAnnotation.EMPTY_ARRAY));
|
||||
}
|
||||
myTypeToExtendFrom = typeToExtend.getCanonicalText(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Change 'implements B' to 'extends B'" "true-preview"
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
|
||||
class A extends B<@NotNull String, @NotNull Integer> {
|
||||
}
|
||||
|
||||
class B<@Nullable T, @NotNull K> {}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
// "Change 'implements B' to 'extends B'" "true-preview"
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
class A extends B<@NotNull C<String>, @NotNull Integer> {
|
||||
}
|
||||
|
||||
class B<@Nullable T, @NotNull K>{}
|
||||
|
||||
|
||||
class C<@Nullable T> {
|
||||
}
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
// "Change 'implements B' to 'extends B'" "true-preview"
|
||||
class A extends B<@NotNull C<String>, @NotNull Integer> {
|
||||
}
|
||||
|
||||
class B<@org.jetbrains.annotations.Nullable T, @org.jetbrains.annotations.NotNull K>{}
|
||||
|
||||
|
||||
class C<@org.jetbrains.annotations.Nullable T> {
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Change 'implements B' to 'extends B'" "true-preview"
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
|
||||
class A implements <caret>B<@NotNull String, @NotNull Integer> {
|
||||
}
|
||||
|
||||
class B<@Nullable T, @NotNull K> {}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
// "Change 'implements B' to 'extends B'" "true-preview"
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
class A implements <caret>B<@NotNull C<String>, @NotNull Integer>{
|
||||
}
|
||||
|
||||
class B<@Nullable T, @NotNull K>{}
|
||||
|
||||
|
||||
class C<@Nullable T> {
|
||||
}
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Change 'implements B' to 'extends B'" "true-preview"
|
||||
class A implements
|
||||
<caret>B<@org.jetbrains.annotations.NotNull C<java.lang.String>,
|
||||
@org.jetbrains.annotations.NotNull Integer>{
|
||||
}
|
||||
|
||||
class B<@org.jetbrains.annotations.Nullable T, @org.jetbrains.annotations.NotNull K>{}
|
||||
|
||||
|
||||
class C<@org.jetbrains.annotations.Nullable T> {
|
||||
}
|
||||
+1
-1
@@ -12,7 +12,7 @@ public class ChangeExtendsToImplementsTest extends LightQuickFixParameterizedTes
|
||||
|
||||
@Override
|
||||
protected LanguageLevel getLanguageLevel() {
|
||||
return LanguageLevel.JDK_1_5;
|
||||
return LanguageLevel.JDK_1_8;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user