mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
MethodReturnTypeFix: updated fix to change method return type based on return statements in method body (IDEA-216275)
GitOrigin-RevId: e97990950039123c8c41921a71342b8ed60afdee
This commit is contained in:
committed by
intellij-monorepo-bot
parent
52aa1ae553
commit
42d733a694
+1
-1
@@ -2,7 +2,7 @@ class Test {
|
||||
public <T> T doStuff() {
|
||||
return null;
|
||||
}
|
||||
public boolean test() {
|
||||
public boolean <error descr="Invalid return type">test</error>() {
|
||||
<error descr="Incompatible types. Found: 'java.lang.Object', required: 'boolean'">return doStuff();</error>
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ public class WrongGenerics {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
<T> Set<Foo<? extends T>> bar(Set<Foo<? extends T>> foo) {
|
||||
<T> Set<Foo<? extends T>> <error descr="Invalid return type">bar</error>(Set<Foo<? extends T>> foo) {
|
||||
return <error descr="Inconvertible types; cannot cast 'java.util.Set<Foo<? extends T>>' to 'java.util.Set<Foo<?>>'">(Set<Foo<?>>) foo</error>;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
class Bug {
|
||||
static A test(A[] as) {
|
||||
static A <error descr="Invalid return type">test</error>(A[] as) {
|
||||
for (<error descr="Incompatible types. Found: 'Bug.B', required: 'Bug.A'">B b</error> : as) {
|
||||
<error descr="Incompatible types. Found: 'Bug.B', required: 'Bug.A'">return b;</error>
|
||||
}
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ class B<S> extends A<S> {
|
||||
|
||||
<error descr="'foo(T, S)' in 'A' clashes with 'foo(Object, Object)' in 'B'; both methods have same erasure, yet neither overrides the other">class C extends B<String></error> {
|
||||
@Override
|
||||
<T> T foo(T x, String y) {
|
||||
<T> T <error descr="Invalid return type">foo</error>(T x, String y) {
|
||||
<error descr="Incompatible types. Found: 'java.lang.Object', required: 'T'">return super.foo(x, y);</error>
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -16,7 +16,7 @@ class LimitedPool<T> {
|
||||
void cleanup(T t);
|
||||
}
|
||||
|
||||
public T alloc() {
|
||||
public T <error descr="Invalid return type">alloc</error>() {
|
||||
if (index >= capacity) return factory.create();
|
||||
|
||||
if (storage[index] == null) {
|
||||
|
||||
+3
-3
@@ -76,7 +76,7 @@ class d {
|
||||
}
|
||||
|
||||
class e {
|
||||
String foo () {
|
||||
String <error descr="Invalid return type">foo</error> () {
|
||||
MyList myList = new MyList();
|
||||
<error descr="Incompatible types. Found: 'java.lang.Object', required: 'java.lang.String'">return myList.get(0);</error>
|
||||
}
|
||||
@@ -128,7 +128,7 @@ class A111<T> {
|
||||
return v;
|
||||
}
|
||||
|
||||
String g(A111 a) {
|
||||
String <error descr="Invalid return type">g</error>(A111 a) {
|
||||
//noinspection unchecked
|
||||
<error descr="Incompatible types. Found: 'java.lang.Object', required: 'java.lang.String'">return a.f("");</error>
|
||||
}
|
||||
@@ -151,7 +151,7 @@ class A11<T> extends A1 {
|
||||
class Test1<X> {
|
||||
X x;
|
||||
java.util.ArrayList<Number> foo = new java.util.ArrayList<Number>();
|
||||
public static Number foo() {
|
||||
public static Number <error descr="Invalid return type">foo</error>() {
|
||||
<error descr="Incompatible types. Found: 'java.lang.Object', required: 'java.lang.Number'">return new Test1().foo.get(0);</error>
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user