redundant cast: check only array access for write separately (IDEA-82003)

This commit is contained in:
anna
2012-02-29 14:10:29 +01:00
parent 4f64bb7ed8
commit 5a9e5f5acc
4 changed files with 29 additions and 1 deletions
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<problems>
<problem>
<file>A.java</file>
<line>6</line>
<description>Casting &lt;code&gt;t&lt;/code&gt; to &lt;code&gt;Foo&lt;/code&gt; is redundant</description>
</problem>
<problem>
<file>A.java</file>
<line>5</line>
<description>Casting &lt;code&gt;t&lt;/code&gt; to &lt;code&gt;Foo&lt;/code&gt; is redundant</description>
</problem>
</problems>
@@ -0,0 +1,11 @@
abstract class Foo {
protected int field;
public int f(Bar t){
((Foo)t).field = 0;
return ((Foo)t).field;
}
}
class Bar extends Foo{}