@@ -22,6 +22,7 @@ import org.jetbrains.uast.USimpleNameReferenceExpression
22
22
import org.jetbrains.uast.UastBinaryExpressionWithTypeKind
23
23
import org.jetbrains.uast.UastBinaryOperator
24
24
import org.jetbrains.uast.isNullLiteral
25
+ import org.jetbrains.uast.skipParenthesizedExprDown
25
26
import org.jetbrains.uast.visitor.AbstractUastVisitor
26
27
import java.util.EnumSet
27
28
@@ -211,9 +212,9 @@ class MissingListenerRemovalDetector : Detector(), SourceCodeScanner {
211
212
// otherwise must have a null argument for a set*Listener method
212
213
if (node.valueArgumentCount == 1 && (
213
214
name.matches(PATTERN_REMOVE_LISTENER_METHOD .toRegex()) &&
214
- ! node.valueArguments[0 ].isNullLiteralOrCastedNullLiteral() ||
215
+ node.valueArguments[0 ].skipParenthesizedExprDown()?. isNullLiteralOrCastedNullLiteral() == false ||
215
216
name.matches(PATTERN_SET_LISTENER .toRegex()) &&
216
- node.valueArguments[0 ].isNullLiteralOrCastedNullLiteral()
217
+ node.valueArguments[0 ].skipParenthesizedExprDown()?. isNullLiteralOrCastedNullLiteral() == true
217
218
)
218
219
) {
219
220
return true
@@ -228,7 +229,7 @@ class MissingListenerRemovalDetector : Detector(), SourceCodeScanner {
228
229
// try to find the pattern `*Listener = null`
229
230
is USimpleNameReferenceExpression -> {
230
231
if (leftOperand.identifier.endsWith(SUFFIX_LISTENER , ignoreCase = true ) &&
231
- node.rightOperand.isNullLiteralOrCastedNullLiteral()
232
+ node.rightOperand.skipParenthesizedExprDown()?. isNullLiteralOrCastedNullLiteral() == true
232
233
) {
233
234
return true
234
235
}
@@ -239,7 +240,7 @@ class MissingListenerRemovalDetector : Detector(), SourceCodeScanner {
239
240
SUFFIX_LISTENER ,
240
241
ignoreCase = true
241
242
) &&
242
- node.rightOperand.isNullLiteralOrCastedNullLiteral()
243
+ node.rightOperand.skipParenthesizedExprDown()?. isNullLiteralOrCastedNullLiteral() == true
243
244
) {
244
245
return true
245
246
}
0 commit comments