ObsoleteMethodCallWarning.st
changeset 22948 7db274fb5ecb
parent 19711 ce5eca41f3d1
--- a/ObsoleteMethodCallWarning.st	Wed May 16 15:37:51 2018 +0200
+++ b/ObsoleteMethodCallWarning.st	Thu May 17 07:29:20 2018 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 2016 by eXept Software AG
               All Rights Reserved
@@ -15,7 +17,7 @@
 
 HaltInterrupt subclass:#ObsoleteMethodCallWarning
 	instanceVariableNames:''
-	classVariableNames:''
+	classVariableNames:'IgnoredWarnings'
 	poolDictionaries:''
 	category:'Kernel-Exceptions-Control'
 !
@@ -58,6 +60,46 @@
     "
 ! !
 
+!ObsoleteMethodCallWarning class methodsFor:'ignoring'!
+
+ignoreWarningFrom:aContext
+    "add aContext's method to the ignoredWarnings set.
+     This will stop the warning during this session."
+
+    |con|
+    
+    IgnoredWarnings isNil ifTrue:[
+        IgnoredWarnings := Set new.
+    ].
+    con := aContext.
+    [con notNil and:[con selector startsWith:'obsoleteMethodWarning']]
+    whileTrue:[
+        con := con sender
+    ].   
+    con notNil ifTrue:[
+        IgnoredWarnings add:(con method whoString)
+    ].
+! !
+
+!ObsoleteMethodCallWarning class methodsFor:'raising'!
+
+raiseRequestErrorString:errorString
+    |con|
+    
+    IgnoredWarnings notNil ifTrue:[
+        con := thisContext sender.
+        [con notNil and:[con selector startsWith:'obsoleteMethodWarning']]
+        whileTrue:[
+            con := con sender
+        ].   
+
+        (IgnoredWarnings includes:(con method whoString)) ifTrue:[
+            ^ self
+        ].    
+    ].
+    super raiseRequestErrorString:errorString.
+! !
+
 !ObsoleteMethodCallWarning class methodsFor:'documentation'!
 
 version