GemTalk / Rowan

a new project/package manager for Smalltalk that supports FileTree and Tonel repositories, and is independent of Monticello and Metacello
MIT License
13 stars 7 forks source link

RwTopazTonelReader >> newMethodDefinition... should signal Error if class not found #889

Open AllenOtis opened 1 year ago

AllenOtis commented 1 year ago

If the class is not found it tries to compile a method in UndefinedObject, which if not logged in as SystemUser leads to a confusing security error . If logged in as SystemUser, it seems like the wrong default to take ...

method: RwTopazTonelReader newMethodDefinitionForClassNamed: className classIsMeta: meta selector: selector category: category source: source "for topaz TFILE and TMETHOD commands, compile the method instead of creating a method definition"

 | behavior symbolList |
 symbolList := GsCurrentSession currentSession symbolList.
 behavior := symbolList objectNamed: className asSymbol.
behavior ifNil:[ Error signal: 'class  ', className , ' not found].      <<<<<<< Recommend adding this line 
 meta
   ifTrue: [ behavior := behavior class ].
 behavior
   compileMethod: source
   dictionaries: symbolList
   category: category
   environmentId: self environmentId

To reproduce , login as DataCurator, and use topaz TFILE to load methods for a class which is not yet defined .