[Codenarc-developer] UnnecessaryNulCheck - bug?
Brought to you by:
chrismair
From: <chr...@wa...> - 2011-01-18 13:46:03
|
Hamlet, I am running the CodeNarc snapshot release jar against a bunch of projects at work. I came across what seems like a bug in UnnecessaryNullCheck. This code: if (cmd.autoDefUseOrderInd && cmd.allMTsBottom != null) { // Line 128 cmd.errors.reject("message.code", "All the auto deferral MTs must be included in the order list."); } produces: Rule Name Priority Line # Source Line / Message UnnecessaryNullCheck 2 128 [SRC]if (cmd.autoDefUseOrderInd && cmd.allMTsBottom != null) { [MSG]The expression (cmd.autoDefUseOrderInd && (cmd.allMTsBottom != null)) can be simplified to (cmd.autoDefUseOrderInd) UnnecessaryNullCheck 2 128 [SRC]if (cmd.autoDefUseOrderInd && cmd.allMTsBottom != null) { [MSG]The expression (cmd.autoDefUseOrderInd && (cmd.allMTsBottom != null)) can be simplified to (cmd.autoDefUseOrderInd) I don't think that should be a violation, and I'm not sure why it shows up twice. Thanks. Chris |