Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Kernel-CodeModel/ClassDescription.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ ClassDescription >> classify: selector under: aProtocol [

"If we try to classify the method as an extension of its own package, just unclassify the method to avoid any weird state where the method could be considered as an extension or not depending on the interpretation."
(self isProtocolExtensionFromTheSamePackage: aProtocol) ifTrue: [
ExtensionPointsOwningPackageNotification signalFor: self package name.
ExtensionPointsOwningPackageNotification signalFor: self package name class: self selector: selector.
^ self classify: selector under: Protocol unclassified ].

(newProtocol := self ensureProtocol: aProtocol) = oldProtocol ifTrue: [ ^ self ].
Expand Down Expand Up @@ -933,7 +933,7 @@ ClassDescription >> renameProtocol: anOldProtocol as: aNewProtocol [

"We should not be able to have a protocol that is an extension of the same class so let's skip the rename."
(self isProtocolExtensionFromTheSamePackage: aNewProtocol) ifTrue: [
ExtensionPointsOwningPackageNotification signalFor: self package name.
ExtensionPointsOwningPackageNotification signalFor: self package name class: self selector: nil.
^ self ].

oldProtocol := self ensureProtocol: anOldProtocol.
Expand Down
36 changes: 32 additions & 4 deletions src/Kernel/ExtensionPointsOwningPackageNotification.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,43 @@ Class {
#name : 'ExtensionPointsOwningPackageNotification',
#superclass : 'SystemNotification',
#instVars : [
'packageName'
'packageName',
'concernedClass',
'selector'
],
#category : 'Kernel-Exceptions',
#package : 'Kernel',
#tag : 'Exceptions'
}

{ #category : 'signalling' }
ExtensionPointsOwningPackageNotification class >> signalFor: aPackageName [
ExtensionPointsOwningPackageNotification class >> signalFor: aPackageName class: aClass selector: aSelector [

^ self new
packageName: aPackageName;
concernedClass: aClass;
selector: aSelector;
signal
]

{ #category : 'accessing' }
ExtensionPointsOwningPackageNotification >> concernedClass [

^ concernedClass
]

{ #category : 'accessing' }
ExtensionPointsOwningPackageNotification >> concernedClass: anObject [

concernedClass := anObject
]

{ #category : 'accessing' }
ExtensionPointsOwningPackageNotification >> messageText [

^ messageText ifNil: [
'An extension protocol points the package "' , packageName
, '" while the class containing the method is already in this package. The creation of this protocol will be aborted.' ]
'An extension protocol points the package "' , packageName , '" while ' , self concernedClass , ' containing ' , (self selector ifNil: [ 'the method' ])
, ' is already in this package. The creation of this protocol will be aborted.' ]
]

{ #category : 'accessing' }
Expand All @@ -39,3 +55,15 @@ ExtensionPointsOwningPackageNotification >> packageName: anObject [

packageName := anObject
]

{ #category : 'accessing' }
ExtensionPointsOwningPackageNotification >> selector [

^ selector
]

{ #category : 'accessing' }
ExtensionPointsOwningPackageNotification >> selector: anObject [

selector := anObject
]