@@ -413,17 +413,13 @@ private class ExternalLoggerCall extends LoggerCall::Range, DataFlow::CallNode {
413413 }
414414}
415415
416- /**
417- * A call to an interface that looks like a logger. It is common to use a
418- * locally-defined interface for logging to make it easy to changing logging
419- * library.
420- */
421- private class HeuristicLoggerCall extends LoggerCall:: Range , DataFlow:: CallNode {
422- HeuristicLoggerCall ( ) {
423- exists ( Method m , string tp , string logFunctionPrefix , string name |
424- m = this .getTarget ( ) and
425- m .hasQualifiedName ( _, tp , name ) and
426- m .getReceiverBaseType ( ) .getUnderlyingType ( ) instanceof InterfaceType
416+ private class HeuristicLoggerFunction extends Method {
417+ string logFunctionPrefix ;
418+
419+ HeuristicLoggerFunction ( ) {
420+ exists ( string tp , string name |
421+ this .hasQualifiedName ( _, tp , name ) and
422+ this .getReceiverBaseType ( ) .getUnderlyingType ( ) instanceof InterfaceType
427423 |
428424 tp .regexpMatch ( ".*[lL]ogger" ) and
429425 logFunctionPrefix =
@@ -435,6 +431,19 @@ private class HeuristicLoggerCall extends LoggerCall::Range, DataFlow::CallNode
435431 )
436432 }
437433
434+ override predicate mayReturnNormally ( ) { logFunctionPrefix != "Fatal" }
435+
436+ override predicate mustPanic ( ) { logFunctionPrefix = "Panic" }
437+ }
438+
439+ /**
440+ * A call to an interface that looks like a logger. It is common to use a
441+ * locally-defined interface for logging to make it easy to changing logging
442+ * library.
443+ */
444+ private class HeuristicLoggerCall extends LoggerCall:: Range , DataFlow:: CallNode {
445+ HeuristicLoggerCall ( ) { this .getTarget ( ) instanceof HeuristicLoggerFunction }
446+
438447 override DataFlow:: Node getAMessageComponent ( ) { result = this .getASyntacticArgument ( ) }
439448}
440449
0 commit comments