[java-intentions] Quick-fixes to change method/var return type when inference fails

Fixes IDEA-354184 Quick-fix for generic types

GitOrigin-RevId: 65d513f5303a082c26283e09275470840df90d30
This commit is contained in:
Tagir Valeev
2024-06-06 13:53:18 +02:00
committed by intellij-monorepo-bot
parent 9f5cf87b91
commit 78d4bd2c8b
5 changed files with 57 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
// "Make 'getList()' return 'A.Box<java.util.List<java.lang.String>>' or ancestor" "true-preview"
import java.util.*;
public class A {
Box<List<String>> getList() {
return new Box<>(Arrays.asList("foo"));
}
class Box<T> {
Box(T value) {}
}
}

View File

@@ -0,0 +1,12 @@
// "Make 'getList()' return 'A.Box<java.util.List<java.lang.String>>' or ancestor" "true-preview"
import java.util.*;
public class A {
Box<Set<String>> getList() {
return new <caret>Box<>(Arrays.asList("foo"));
}
class Box<T> {
Box(T value) {}
}
}

View File

@@ -0,0 +1,12 @@
// "Change variable 'box' type to 'A.Box<List<String>>'" "true-preview"
import java.util.*;
public class A {
void test() {
Box<List<String>> box = new Box<>(Arrays.asList("foo"));
}
class Box<T> {
Box(T value) {}
}
}

View File

@@ -0,0 +1,12 @@
// "Change variable 'box' type to 'A.Box<List<String>>'" "true-preview"
import java.util.*;
public class A {
void test() {
Box<Set<String>> box = new <caret>Box<>(Arrays.asList("foo"));
}
class Box<T> {
Box(T value) {}
}
}