mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
redundant cast: don't mark redundant boxing casts in conditional (IDEA-137395)
This commit is contained in:
+7
@@ -6,4 +6,11 @@
|
||||
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Redundant type cast</problem_class>
|
||||
<description>Casting <code>2</code> to <code>Integer</code> is redundant</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>Test.java</file>
|
||||
<line>18</line>
|
||||
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Redundant type cast</problem_class>
|
||||
<description>Casting <code>1</code> to <code>Integer</code> is redundant</description>
|
||||
</problem>
|
||||
|
||||
</problems>
|
||||
|
||||
+12
@@ -7,4 +7,16 @@ public class Test {
|
||||
private int foo1(String s, Integer i) {
|
||||
return s == null ? i : (Integer)2;
|
||||
}
|
||||
}
|
||||
|
||||
class RedundantCastTest {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Integer foo = 5;
|
||||
Integer bar = null;
|
||||
print(args == null || args.length == 0 ? bar : (Integer) 1);
|
||||
int i = args == null || args.length == 0 ? bar : (Integer) 1;
|
||||
}
|
||||
|
||||
private static void print(Integer i) {}
|
||||
}
|
||||
Reference in New Issue
Block a user