开发者

Java static analyzer custom templating/specification

We have a Java project that uses TeamCity to do static analysis of our Java classes each night to find low hanging bugs in our code. We would like to tell TeamCity to look for a new type of bug that developers might introduce that has to do with the usage of == vs .equals

For a particular type within the system we were using == to do comparisons because we designed our software such that it was valid. Well, now it's no longer valid, and we want to tell TeamCity to look for == for this type and report it as a bug in it's detailed reporting. Does anyone know how to do this? Static analysis seems to be the most appropriate way to catch this if it's ever introduced into the source base. We have a templ开发者_运维知识库ate within Eclipse as well for code guidelines and formatting, but I don't think Eclipse can tell anything about types. Any help is appreciated.


Considering that TeamCity can run ALL of IntelliJ's code analysis tools , that is all 632 of them, you could rely on that to detect this kind of error.

It does have the test "== used instead of equals()", that you can customize by specifying the types to check.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜