ObsoleteMethodCallWarning.st
author Claus Gittinger <cg@exept.de>
Tue, 09 Jul 2019 20:55:17 +0200
changeset 24417 03b083548da2
parent 22948 7db274fb5ecb
permissions -rw-r--r--
#REFACTORING by exept class: Smalltalk class changed: #recursiveInstallAutoloadedClassesFrom:rememberIn:maxLevels:noAutoload:packageTop:showSplashInLevels: Transcript showCR:(... bindWith:...) -> Transcript showCR:... with:...

"{ Encoding: utf8 }"

"
 COPYRIGHT (c) 2016 by eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
"{ Package: 'stx:libbasic' }"

"{ NameSpace: Smalltalk }"

HaltInterrupt subclass:#ObsoleteMethodCallWarning
	instanceVariableNames:''
	classVariableNames:'IgnoredWarnings'
	poolDictionaries:''
	category:'Kernel-Exceptions-Control'
!

!ObsoleteMethodCallWarning class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 2016 by eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
!

documentation
"
    Raised when an obsolete method is called.
    Thus used to do a halt; now this separate exception is raised to make it
    easier to separately handle this.
    Still a kind of programmed debug-breakpoint.

    [author:]
        Claus Gittinger
"
! !

!ObsoleteMethodCallWarning class methodsFor:'initialization'!

initialize
    NotifierString := 'Obsolete method called'.

    "
     self initialize.
    "
! !

!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
    ^ '$Header$'
!

version_CVS
    ^ '$Header$'
! !


ObsoleteMethodCallWarning initialize!