mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
[java-intentions] IDEA-363734 "Make Xxx impelent Yyy" quick fix inserts @NotNull
(cherry picked from commit 4e9a3f94cf1aedadd0b2c4699e168ccb3be0e405) IJ-CR-150708 GitOrigin-RevId: ced9d4595e513387ebf996bf8dd0894877ef0f3e
This commit is contained in:
committed by
intellij-monorepo-bot
parent
9a6c3e865e
commit
d2d87a71f3
@@ -153,7 +153,8 @@ public class ExtendsListFix extends LocalQuickFixAndIntentionActionOnPsiElement
|
||||
else {
|
||||
anchor = referenceElements[position - 1];
|
||||
}
|
||||
PsiJavaCodeReferenceElement classReferenceElement = JavaPsiFacade.getElementFactory(project).createReferenceElementByType(myTypeToExtendFrom);
|
||||
PsiJavaCodeReferenceElement classReferenceElement = JavaPsiFacade.getElementFactory(project)
|
||||
.createReferenceElementByType(myTypeToExtendFrom.annotate(TypeAnnotationProvider.EMPTY));
|
||||
PsiElement element;
|
||||
if (anchor == null) {
|
||||
if (referenceElements.length == 0) {
|
||||
|
||||
@@ -4,6 +4,7 @@ class a implements Runnable {
|
||||
f(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
<caret>
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ class a implements b<String> {
|
||||
r.g(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void g(b<String> t) {
|
||||
<caret>
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Make 'A' implement 'J'" "true-preview"
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
interface J {}
|
||||
interface I {}
|
||||
|
||||
class A implements I, J <caret>{
|
||||
public @NotNull J foo() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Make 'A' implement 'J'" "true-preview"
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
interface J<S> {}
|
||||
interface I {}
|
||||
|
||||
class A implements I, J<@NotNull String> {
|
||||
public @NotNull J<@NotNull String> foo() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ class FooBar extends Foo {
|
||||
}
|
||||
|
||||
static class Bar implements Runnable {
|
||||
@Override
|
||||
public void run() {
|
||||
<caret>
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ interface b<T> {
|
||||
}
|
||||
|
||||
class a implements b<Integer> {
|
||||
@Override
|
||||
public void f(Integer integer) {
|
||||
<caret>
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Make 'A' implement 'J'" "true-preview"
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
interface J {}
|
||||
interface I {}
|
||||
|
||||
class A implements I {
|
||||
public @NotNull J foo() {
|
||||
return <caret>this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Make 'A' implement 'J'" "true-preview"
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
interface J<S> {}
|
||||
interface I {}
|
||||
|
||||
class A implements I {
|
||||
public @NotNull J<@NotNull String> foo() {
|
||||
return <caret>this;
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ class a implements Runnable {
|
||||
f(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ class a implements b<String> {
|
||||
r.g(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void g(b<String> t) {
|
||||
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ class FooBar extends Foo {
|
||||
}
|
||||
|
||||
static class Bar implements Runnable {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ interface b<T> {
|
||||
}
|
||||
|
||||
class a implements b<Integer> {
|
||||
@Override
|
||||
public void f(Integer integer) {
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
package com.intellij.codeInsight.daemon.impl.quickfix;
|
||||
|
||||
import com.intellij.codeInsight.daemon.quickFix.LightQuickFixParameterizedTestCase;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.testFramework.LightProjectDescriptor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import static com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase.JAVA_21;
|
||||
|
||||
public class ChangeParameterClassTest extends LightQuickFixParameterizedTestCase {
|
||||
|
||||
@@ -12,8 +15,8 @@ public class ChangeParameterClassTest extends LightQuickFixParameterizedTestCase
|
||||
}
|
||||
|
||||
@Override
|
||||
protected LanguageLevel getLanguageLevel() {
|
||||
return LanguageLevel.JDK_1_5;
|
||||
protected @NotNull LightProjectDescriptor getProjectDescriptor() {
|
||||
return JAVA_21;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user