redundant cast: special checks for throwable cases (IDEA-111511)

This commit is contained in:
anna
2013-08-05 18:16:23 +02:00
parent 1bd183256e
commit 5934fd50c6
4 changed files with 45 additions and 0 deletions
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<problems>
<problem>
<file>Test.java</file>
<line>7</line>
<description>Casting &lt;code&gt;e&lt;/code&gt; to &lt;code&gt;Ex&lt;/code&gt; is redundant</description>
</problem>
<problem>
<file>Test.java</file>
<line>3</line>
<description>Casting &lt;code&gt;e&lt;/code&gt; to &lt;code&gt;FileNotFoundEx&lt;/code&gt; is redundant</description>
</problem>
</problems>
@@ -0,0 +1,13 @@
public class RedundantCast{
void m(IOEx e) throws IOEx {
throw (FileNotFoundEx)e;
}
void foo(RuntimeException e) {
throw (Ex)e;
}
static class Ex extends RuntimeException {}
static class IOEx extends Exception {}
static class FileNotFoundEx extends Exception {}
}