[squid:S1905] False positive detection of redundant casts


(Marvin Fröhlich) #1

Let’s consider the following method signature.

<M> M getMeta();

Now, if I used this (old) code:

String s = (String) x.getMeta();

a redundant cast is correctly detected.

But this code here:

int l = ( (String) x.getMeta() ).length();

will be reported a false positive redundant cast. And there are quite a lot of them.

Can this be fixed?

The rule key is squid:S1905