replace with diamonds should always check if inferred type agrees with expected type (IDEA-73944)

This commit is contained in:
anna
2011-09-07 12:18:58 +02:00
parent e24044f3aa
commit 8fef5fc92d
12 changed files with 97 additions and 18 deletions
@@ -0,0 +1,12 @@
// "Change 'new Foo<Integer>()' to 'new Foo<Number>()'" "true"
class Foo<T> {
Foo(T t) {}
Foo() {}
}
class Constructors {
public static void main(String[] args) {
Foo<Number> foo2 = new Foo<>();
}
}
@@ -0,0 +1,12 @@
// "Change 'new Foo<Integer>(...)' to 'new Foo<Number>()'" "true"
class Foo<T> {
Foo(T t) {}
Foo() {}
}
class Constructors {
public static void main(String[] args) {
Foo<Number> foo2 = new Foo<Number>(1);
}
}
@@ -0,0 +1,12 @@
// "Change 'new Foo<Integer>()' to 'new Foo<Number>()'" "true"
class Foo<T> {
Foo(T t) {}
Foo() {}
}
class Constructors {
public static void main(String[] args) {
Foo<Number> foo2 = new Foo<Int<caret>eger>();
}
}
@@ -0,0 +1,12 @@
// "Change 'new Foo<Integer>(...)' to 'new Foo<Number>()'" "true"
class Foo<T> {
Foo(T t) {}
Foo() {}
}
class Constructors {
public static void main(String[] args) {
Foo<Number> foo2 = new Foo<Int<caret>eger>(1);
}
}