Changes in GT for supporting in Pharo 12

This page documents changes that we did in GT for supporting it in Pharo 12.

Some changes are quick fixes that fix an issue, but would be better to review.

Updated load-patches.st.

RPackage>>#toTagName: is not in Pharo 12 so no need to patch it.

CompiledMethod>>#basicAsMCMethodDefinition basicAsMCMethodDefinition <gtPharoPatch: #Pharo12> ^ MCMethodDefinition className: self methodClass instanceSide name classIsMeta: self isClassSide selector: self selector category: self protocolName timeStamp: '' "self stamp" source: self sourceCode should use #protocolName instead of #protocol. Before #protocol returned a string, now it returns an object.

Added MetacelloToolBox to releaser

MetacelloToolBox Object << #MetacelloToolBox slots: { #project . #methodSpec }; tag: 'Metacello'; package: 'GToolkit-Releaser-BaselineModel' is not much used in Pharo and was removed in https://github.com/pharo-project/pharo/pull/15287. We copied it to releaser for now. We should review how/why we need to use it.

Added MetacelloMCProjectSpec>>projectClass; commit

we should review why we need it

Update GtRlDependenciesModelBuilder Object << #GtRlDependenciesModelBuilder slots: { #projectsByBaselineClass . #repositoriesByUrl . #projectsChain }; tag: 'Builder'; package: 'GToolkit-Releaser-BaselineModel'

In Pharo 12 getting the metacelo version throug MetacelloMCProjectSpec. Instead we get it directly from the baseline class.

Move announcer attribute to Job Object << #Job slots: { #block . #currentValue . #min . #max . #title . #children . #isRunning . #parent . #process . #owner . #announcer . #interruptBlock }; tag: 'Base'; package: 'Jobs' from GtJob Job << #GtJob slots: {}; tag: 'Refactorings'; package: 'GToolkit-Pharo-Coder-UI'

Protocols changes

The hierarchy of the class Protocol Object << #Protocol slots: { #name . #methodSelectors . #owningClass }; tag: 'Classes'; package: 'Kernel-CodeModel' is changed in Pharo 12. There is no more AbstractProtocol, AllProtocol andProtocolOrganizer.

Login to handle the finalization process was extracted from WeakArray Array << #WeakArray layout: WeakLayout; slots: {}; tag: 'Base'; package: 'Collections-Weak' .

In Pharo 11 the logic to handle the finalization process is on the class side of WeakArray Array << #WeakArray layout: WeakLayout; slots: {}; tag: 'Base'; package: 'Collections-Weak' . In Pharo 12 a dedicated class, FinalizationProcess Object << #FinalizationProcess slots: {}; sharedVariables: { #FinalizationSemaphore . #TheFinalizationProcess . #StoppedSemaphore . #MournLoopProcess . #StopRequested }; tag: 'Base'; package: 'System-Finalization' , was added.

For FinalizationProcess Object << #FinalizationProcess slots: {}; sharedVariables: { #FinalizationSemaphore . #TheFinalizationProcess . #StoppedSemaphore . #MournLoopProcess . #StopRequested }; tag: 'Base'; package: 'System-Finalization' we compile the class in Pharo 11 as a patch, and missing class variables in Pharo 12, in BaselineOfGToolkitPrerequisites>>#applyPatchForFinalizationProcess applyPatchForFinalizationProcess self applyPatchForFinalizationProcessPharo12Plus .

UUID Object << #UUID slots: { #uuidData }; tag: 'Base'; package: 'Network-UUID' changed superclass and structure

In Pharo 11 UUID Object << #UUID slots: { #uuidData }; tag: 'Base'; package: 'Network-UUID' subclasses ByteArray ArrayedCollection << #ByteArray layout: ByteLayout; slots: {}; tag: 'Base'; package: 'Collections-Native' . In Pharo 12 it subclasses Object and has a uuidData slot with the byte array data. In GT it was causing issues due to how we serialize UUID objects. Most changes are limited to:

UUID>>#fromBase64EncodedString: fromBase64EncodedString: aString64 | uid | uid := self nilUUID. (ZnBase64Encoder new decode: aString64 readStream to: uid uuidData writeStream). ^ uid

UUID>>#base64Encoded base64Encoded ^ self uuidData base64Encoded

OmEntry Object << #OmEntry slots: { #tags . #content }; tag: 'Entries'; package: 'Ombu' missing time

When OmEntry Object << #OmEntry slots: { #tags . #content }; tag: 'Entries'; package: 'Ombu' objects are created in EpLog>>#addEntryWith:tags: addEntryWith: anEvent tags: blockClosureForCustomTags "Add an event with the specified tags" | newEntry | newEntry := OmEntry content: anEvent. "add tags" newEntry tags at: self class priorReferenceKey put: self headReference; in: blockClosureForCustomTags. "write the new entry" store newEntry: newEntry. "update caches with the new entry" self cacheEntry: newEntry. self announceAdded: newEntry. ^ newEntry no time is set in Pharo 12. We are using them in OmEntry>>#gtTime gtTime ^ self tagAt: EpLog timeKey .

Icons for EpEvent Object << #EpEvent slots: {}; tag: 'Model'; package: 'Epicea' entries

In Pharo 12 a different visitor it used to just return the name of an icon instead of a Form object. The patch is in GtEpicea>>#iconForEpiceaChange: iconForEpiceaChange: anEpChange ^ Smalltalk ui icons iconNamed: (anEpChange accept: EpIconNameVisitor new) .

Use CodeError instead of OCSemanticWarning.

Error handling changed in the compiler. Checking for those errors in coder in GtPharoSourceCoder>>#handleCompilerErrorsDuring:inContext: handleCompilerErrorsDuring: aBlock inContext: aGtPharoSourceCoderEvaluationContext ^ [ aBlock value. true ] on: self compilerErrorsToHandle do: [ :ex | self notifyParseError: ex requesterObject: aGtPharoSourceCoderEvaluationContext requesterObject. ex return: false ] should use CodeError in Pharo 12.

Restructuring of OCUndeclaredVariableWarning Notification << #OCUndeclaredVariableWarning slots: { #notice }; tag: 'Exceptions'; package: 'OpalCompiler-Core'

In Pharo 11 OCUndeclaredVariableWarning Notification << #OCUndeclaredVariableWarning slots: { #notice }; tag: 'Exceptions'; package: 'OpalCompiler-Core' contains the ast node and the logic to repair the code.

In Pharo 12, the warning contains a notice as an instance of OCUndeclaredVariableNotice that is a kind of RBNotice, representing error and warning information on a AST node.

The undecrared variable notice returns then OCCodeReparator that contains the logic for doing the repair that was before in the warning.

Removed requestor from CompilationContext.

Was moved to OpalCompiler Object << #OpalCompiler slots: { #ast . #source . #compilationContext . #compilationContextClass . #permitFaulty . #permitUndeclared . #failBlock . #logged . #changeStamp . #protocol . #requestor . #priorMethod }; tag: 'FrontEnd'; package: 'OpalCompiler-Core' . It was used in BrRBTextStyler>>#privateStyle: privateStyle: aText | ast | ast := self parseWithSemanticAnalysis: aText. self style: aText ast: ast. self extraStyle: aText ast: ast. ^ aText

Setter is still OpalCompiler>>#requestor: requestor: aRequestor requestor := aRequestor

Clipboard Object << #Clipboard slots: { #contents . #recentClippings }; sharedVariables: { #Default }; tag: 'Base'; package: 'System-Utilities' recent items

The variable to hold the history changed from recent to recentClippings.

WorkingSession Object << #WorkingSession slots: { #manager . #deferredStartupActions . #properties . #id }; tag: 'Utilities'; package: 'System-SessionManager' does not have an id and creationTime in Pharo 12

DateAndTime Magnitude << #DateAndTime slots: { #seconds . #offset . #julianDayNumber . #nanos }; sharedVariables: { #ClockProvider . #LocalTimeZoneCache }; sharedPools: { ChronologyConstants }; package: 'System-Time' validation

DateAndTime Magnitude << #DateAndTime slots: { #seconds . #offset . #julianDayNumber . #nanos }; sharedVariables: { #ClockProvider . #LocalTimeZoneCache }; sharedPools: { ChronologyConstants }; package: 'System-Time' has more validation when parsed from a string. The code below fails in Pharo 12

DateAndTime fromString: '2023/10/01 09:00:00+00:00'.