The Trunk: Kernel-mt.1279.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Kernel-mt.1279.mcz

commits-2
Marcel Taeumel uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-mt.1279.mcz

==================== Summary ====================

Name: Kernel-mt.1279
Author: mt
Time: 22 November 2019, 11:32:11.080303 am
UUID: 5ebf13b5-8050-7243-812f-b74e0784b215
Ancestors: Kernel-mt.1278

Following the idea in Kernel-ct.1272 (inbox/treated), add the possibility to suppress warnings. Complements Tests-mt.423.

=============== Diff against Kernel-mt.1278 ===============

Item was removed:
- ----- Method: Deprecation class>>maybeSignalDeprecationFor:message:explanation: (in category 'utilities') -----
- maybeSignalDeprecationFor: context message: messageString explanation: explanationString
- self showDeprecationWarnings ifTrue:
- [ | message |
- message := context method reference, ' has been deprecated', messageString, '.'.
- explanationString ifNotEmpty: [message := message, ' ', explanationString].
- self signal: message].!

Item was added:
+ ----- Method: Deprecation class>>signalForContext:message:explanation: (in category 'instance creation') -----
+ signalForContext: context message: messageString explanation: explanationString
+
+ | message |
+ message := context method reference, ' has been deprecated', messageString, '.'.
+ explanationString ifNotEmpty: [message := message, ' ', explanationString].
+ self signal: message.!

Item was added:
+ ----- Method: Deprecation class>>suppressed (in category 'accessing') -----
+ suppressed
+
+ ^ self showDeprecationWarnings!

Item was added:
+ ----- Method: Deprecation class>>suppressed: (in category 'accessing') -----
+ suppressed: aBoolean
+
+ self showDeprecationWarnings: aBoolean.
+ super suppressed: aBoolean.!

Item was changed:
  ----- Method: Object>>backwardCompatibilityOnly: (in category 'error handling') -----
  backwardCompatibilityOnly: explanationString
  "Warn that the sending method has been deprecated. Methods that are tagt with #backwardCompatibility:
  are kept for compatibility."
 
  Deprecation
+ signalForContext: thisContext sender
- maybeSignalDeprecationFor: thisContext sender
  message: ' (but will be kept for compatibility)'
  explanation: explanationString!

Item was changed:
  ----- Method: Object>>deprecated (in category 'error handling') -----
  deprecated
  "Warn that the sending method has been deprecated."
 
  Deprecation
+ signalForContext: thisContext sender
- maybeSignalDeprecationFor: thisContext sender
  message: ''
  explanation: ''!

Item was changed:
  ----- Method: Object>>deprecated: (in category 'error handling') -----
  deprecated: explanationString
  "Warn that the sending method has been deprecated."
 
  Deprecation
+ signalForContext: thisContext sender
- maybeSignalDeprecationFor: thisContext sender
  message: ''
  explanation: explanationString!

Item was changed:
  ----- Method: Object>>deprecated:block: (in category 'error handling') -----
  deprecated: explanationString block: aBlock
  "Warn that the sender has been deprecated.  Answer the value of aBlock on resumption.  (Note that #deprecated: is usually the preferred method.)"
 
  Deprecation
+ signalForContext: thisContext sender
- maybeSignalDeprecationFor: thisContext sender
  message: ''
  explanation: explanationString.
+ ^ aBlock value
- ^ aBlock value.
  !

Item was changed:
  Notification subclass: #Warning
  instanceVariableNames: ''
  classVariableNames: ''
  poolDictionaries: ''
  category: 'Kernel-Exceptions'!
+ Warning class
+ instanceVariableNames: 'suppressed resetOnStartUp'!
 
  !Warning commentStamp: '<historical>' prior: 0!
  A Warning is a Notification which by default should be brought to the attention of the user.!
+ Warning class
+ instanceVariableNames: 'suppressed resetOnStartUp'!

Item was added:
+ ----- Method: Warning class>>cleanUp: (in category 'class initialization') -----
+ cleanUp: aggressive
+
+ aggressive ifTrue: [self resetAllWarnings].!

Item was added:
+ ----- Method: Warning class>>initialize (in category 'class initialization') -----
+ initialize
+
+ Smalltalk addToStartUpList: self.!

Item was added:
+ ----- Method: Warning class>>resetAllWarnings (in category 'suppress and reset') -----
+ resetAllWarnings
+
+ self withAllSubclassesDo: [:warningClass |
+ warningClass resetWarnings].!

Item was added:
+ ----- Method: Warning class>>resetOnStartUp (in category 'accessing') -----
+ resetOnStartUp
+ "If true, do not suppress this kind of warning anymore after image start up. This flag will be reset to false after doing this."
+
+ ^ resetOnStartUp ifNil: [false]!

Item was added:
+ ----- Method: Warning class>>resetOnStartUp: (in category 'accessing') -----
+ resetOnStartUp: aBoolean
+
+ resetOnStartUp := aBoolean.!

Item was added:
+ ----- Method: Warning class>>resetWarnings (in category 'suppress and reset') -----
+ resetWarnings
+
+ self suppressed: false.
+ self resetOnStartUp: false.!

Item was added:
+ ----- Method: Warning class>>signal (in category 'instance creation') -----
+ signal
+
+ ^ self signal: nil!

Item was added:
+ ----- Method: Warning class>>signal: (in category 'instance creation') -----
+ signal: signalerText
+
+ ^ self suppressed
+ ifTrue: [nil]
+ ifFalse: [self new signal: signalerText]!

Item was added:
+ ----- Method: Warning class>>startUp: (in category 'class initialization') -----
+ startUp: resuming
+
+ resuming ifTrue: [
+ self withAllSubclassesDo: [:warningClass |
+ warningClass resetOnStartUp ifTrue: [warningClass resetWarnings]]].!

Item was added:
+ ----- Method: Warning class>>suppressAndResetOnStartUp (in category 'suppress and reset') -----
+ suppressAndResetOnStartUp
+ "Suppress this kind of warning but reset that after the next image start up."
+
+ self suppressed: true.
+ self resetOnStartUp: true.!

Item was added:
+ ----- Method: Warning class>>suppressWarnings (in category 'suppress and reset') -----
+ suppressWarnings
+ "Suppress this kind of warning."
+
+ self suppressed: true.!

Item was added:
+ ----- Method: Warning class>>suppressed (in category 'accessing') -----
+ suppressed
+
+ ^ suppressed ifNil: [false]!

Item was added:
+ ----- Method: Warning class>>suppressed: (in category 'accessing') -----
+ suppressed: aBoolean
+
+ suppressed := aBoolean.!