mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
redundant cast: nested casts with outer primitive (IDEA-119857)
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems/>
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
class TestCasting
|
||||
{
|
||||
public void testRedundantCast() throws Exception
|
||||
{
|
||||
Object o = getObject();
|
||||
double d = 0.0;
|
||||
|
||||
if( o instanceof Integer )
|
||||
{
|
||||
d = (double) (Integer)o;
|
||||
}
|
||||
|
||||
System.out.println( "d = " + d );
|
||||
}
|
||||
|
||||
private Object getObject()
|
||||
{
|
||||
return new Integer(42);
|
||||
}
|
||||
}
|
||||
@@ -57,6 +57,11 @@ public class RedundantCast15Test extends InspectionTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testBoxingTopCast() throws Exception {
|
||||
IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_7, getModule(), getTestRootDisposable());
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testIgnore() throws Exception {
|
||||
final RedundantCastInspection castInspection = new RedundantCastInspection();
|
||||
castInspection.IGNORE_ANNOTATED_METHODS = true;
|
||||
|
||||
Reference in New Issue
Block a user