mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-04 00:20:55 +07:00
[java-inspections] IDEA-279333 Raw type inspection: provide fix on casts where using upper bound is possible
GitOrigin-RevId: 83ce4e9ddc79785e8b10859e5213b1fcf1709b2e
This commit is contained in:
committed by
intellij-monorepo-bot
parent
388e18627c
commit
bdd7c56ba9
@@ -0,0 +1,9 @@
|
||||
import java.util.*;
|
||||
|
||||
public class AtTypeCast {
|
||||
void test(Object object) {
|
||||
if (object instanceof List) {
|
||||
((<caret>List)object).clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import java.util.*;
|
||||
|
||||
public class AtTypeCast {
|
||||
void test(Object object) {
|
||||
if (object instanceof List) {
|
||||
Object element = ((<caret>List)object).get();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import java.util.*;
|
||||
|
||||
public class AtTypeCast {
|
||||
void test(Object object) {
|
||||
if (object instanceof List) {
|
||||
Object element = ((<caret>List<?>)object).get();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import java.util.*;
|
||||
|
||||
public class AtTypeCast {
|
||||
void test(Object object) {
|
||||
if (object instanceof List) {
|
||||
((<caret>List)object).add("");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import java.util.*;
|
||||
|
||||
public class AtTypeCast {
|
||||
void test(Object object) {
|
||||
if (object instanceof X) {
|
||||
((<caret>X)object).get();
|
||||
}
|
||||
}
|
||||
}
|
||||
interface X<T> {
|
||||
List<T> get();
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import java.util.*;
|
||||
|
||||
public class AtTypeCast {
|
||||
void test(Object object) {
|
||||
if (object instanceof X) {
|
||||
((<caret>X<?>)object).get();
|
||||
}
|
||||
}
|
||||
}
|
||||
interface X<T> {
|
||||
List<T> get();
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import java.util.*;
|
||||
|
||||
public class AtTypeCast {
|
||||
void test(Object object) {
|
||||
if (object instanceof X) {
|
||||
List list = ((<caret>X)object).get();
|
||||
}
|
||||
}
|
||||
}
|
||||
interface X<T> {
|
||||
List<T> get();
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import java.util.*;
|
||||
|
||||
public class AtTypeCast {
|
||||
void test(Object object) {
|
||||
if (object instanceof List) {
|
||||
((<caret>List<?>)object).clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user