<lambda>null1package shark 2 3 import shark.HeapObject.HeapInstance 4 5 /** 6 * Inspector that automatically marks instances of the provided class names as not leaking 7 * because they're app wide singletons. 8 */ 9 class AppSingletonInspector(private vararg val singletonClasses: String) : ObjectInspector { 10 override fun inspect( 11 reporter: ObjectReporter 12 ) { 13 if (reporter.heapObject is HeapInstance) { 14 reporter.heapObject.instanceClass 15 .classHierarchy 16 .forEach { heapClass -> 17 if (heapClass.name in singletonClasses) { 18 reporter.notLeakingReasons += "${heapClass.name} is an app singleton" 19 } 20 } 21 } 22 } 23 }