groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jamie Echlin <>
Subject static type checking not finding inconvertible types
Date Mon, 07 Sep 2015 15:43:56 GMT
There are a number of cases where I think type checking should produce
errors, for instance:

def str = "s"
if (str == 12) {...

In IDEA this is described as "Reports calls to *.equals()* and *==*
operator usages where the target and argument are of incompatible types.
While such a call might theoretically be useful, most likely it represents
a bug."

As that text says, I guess it's not always a coding error. But I'm
interested in how hard it would be to add it.
seems to have the code for this, and StaticTypeCheckingVisitor seems to do
many checks of this kind, but not this one.

cheers, jamie

View raw message