Hi all,
I seem to remember that if you use a deprecated method you used to get a warning in the system transcript. One of my apps writes to an ADO database and uses the ADOCollection>>item: method which is deprected in D6. However I only found that out after making an executable and run that executable. I've ran that application without problems/warnings in the development environment so I thought it would be save to create an executable which appeared a false assumption. Is there any way to find those deprecated methods more easily when moving to a new version? If not, can I suggest an enhancement to make it more easy to find them? Thanks, Ted |
"Ted" <[hidden email]> wrote in message
news:[hidden email]... > > I seem to remember that if you use a deprecated method you used to get a > warning in the system transcript. > > One of my apps writes to an ADO database and uses the ADOCollection>>item: > method which is deprected in D6. However I only found that out after > making an executable and run that executable. I've ran that application > without problems/warnings in the development environment so I thought it > would be save to create an executable which appeared a false assumption. In this instance OA has used the symbol #deprecated rather than the message send: Notification deprecated, hence there is no warning. They should probably change the method to use Notification deprecated, unless there is a reason not to. > Is there any way to find those deprecated methods more easily when moving > to a new version? If not, can I suggest an enhancement to make it more > easy to find them? If you evaluate: SmalltalkSystem current browseReferencesTo: #deprecated. You can see all the deprecated methods. However that doesn't really make it easy to know which ones you are actually using. I suppose one could write a script to check all message references from ones own packages to see if any deprecated methods might be sent. That will still require manual review since deprecated method names may be common enough to be non-deprecated in other classes. Bellow is a little script I whipped together. It is not great, but it may serve to give an idea of what method might reference deprecated methods. This may not be the best or most comprehensive way to do this, improvements are welcome. ======== "cdemers 6/13/2005 Inspect all methods that might refference deprecated methods." packagePrefix := 'MitSci'. myMethods := Set new. PackageManager current packages do: [:eachPackage | (eachPackage name beginsWith: packagePrefix ) ifTrue: [myMethods addAll: eachPackage allMethods.]]. deprecatedMethodSelectors := (deprecatedMethods collect: [:each | each selector]) asSet. "Ignore some common selectors to get more usefull results." ignoreSelectors := #( #do: #close #ok ). ignoreSelectors do: [:eachSelector | deprecatedMethodSelectors remove: eachSelector ifAbsent: []]. reviewMethods := OrderedCollection new. myMethods do: [:eachMethod | | intersection | intersection := deprecatedMethodSelectors intersection: eachMethod messages. intersection notEmpty ifTrue: [reviewMethods add: eachMethod -> intersection]]. reviewMethods inspect. ======== Chris |
Hello all,
It sounds as though the deployed exe is getting more bent out of shape than the IDE?? That's backwards. Have a good one, Bill -- Wilhelm K. Schwab, Ph.D. [hidden email] |
In reply to this post by Christopher J. Demers
Hi Chris et al,
Christopher J. Demers wrote: > "Ted" <[hidden email]> wrote in message > news:[hidden email]... > >>I seem to remember that if you use a deprecated method you used to get a >>warning in the system transcript. >> >>One of my apps writes to an ADO database and uses the ADOCollection>>item: >>method which is deprected in D6. However I only found that out after >>making an executable and run that executable. I've ran that application >>without problems/warnings in the development environment so I thought it >>would be save to create an executable which appeared a false assumption. > > > In this instance OA has used the symbol #deprecated rather than the message > send: Notification deprecated, hence there is no warning. They should > probably change the method to use Notification deprecated, unless there is a > reason not to. > I'll raise it as a bug > >>Is there any way to find those deprecated methods more easily when moving >>to a new version? If not, can I suggest an enhancement to make it more >>easy to find them? > > > If you evaluate: > SmalltalkSystem current browseReferencesTo: #deprecated. > You can see all the deprecated methods. However that doesn't really make it > easy to know which ones you are actually using. I suppose one could write a > script to check all message references from ones own packages to see if any > deprecated methods might be sent. That will still require manual review > since deprecated method names may be common enough to be non-deprecated in > other classes. > > Bellow is a little script I whipped together. It is not great, but it may > serve to give an idea of what method might reference deprecated methods. > This may not be the best or most comprehensive way to do this, improvements > are welcome. > ======== > "cdemers 6/13/2005 Inspect all methods that might refference deprecated > methods." > packagePrefix := 'MitSci'. > myMethods := Set new. > PackageManager current packages do: [:eachPackage | > (eachPackage name beginsWith: packagePrefix ) ifTrue: [myMethods addAll: > eachPackage allMethods.]]. > > deprecatedMethodSelectors := (deprecatedMethods collect: [:each | each > selector]) asSet. > "Ignore some common selectors to get more usefull results." > ignoreSelectors := #( #do: #close #ok ). > ignoreSelectors do: [:eachSelector | > deprecatedMethodSelectors remove: eachSelector ifAbsent: []]. > > reviewMethods := OrderedCollection new. > myMethods do: [:eachMethod | | intersection | > intersection := deprecatedMethodSelectors intersection: eachMethod > messages. > intersection notEmpty ifTrue: [reviewMethods add: eachMethod -> > intersection]]. > reviewMethods inspect. > ======== > > Chris > > Thanks alot for your help Chris Ted |
In reply to this post by Ted
Ted,
> Is there any way to find those deprecated methods more easily when moving > to a new version? If not, can I suggest an enhancement to make it more > easy to find them? One thing that hasn't been mentioned is that OA have moved a few deprecated classes/methods into their own packages - see "Dolphin MVP (Deprecated)" for an example. If you use the PackageBrowser's "Dependents" tab you can see if, and why, any of your packages are included. I don't know why all deprecated methods haven't been treated in this way, although it might create some interesting circular dependencies. Ian |
Free forum by Nabble | Edit this page |