Question Stefan Cronje · Jul 18, 2024

Finding all usages of deprecated classes and methods

Hi folks,

We are in the process of migrating from Ensemble to IRIS.

After the migration I would like to find all usages of deprecated classes and methods in all of our code. This is to align with the changes in package like %SYSTEM.SQL for example.

Is there an easy way to do this, or maybe a tool that can assist?

Thanks.

Comments

Brett Saviano · Jul 18, 2024

@Stefan Cronje 
You can open the classes in VS Code and and it will notify you when you use deprecated classes or methods. There isn't a programmatic way to get that information (for example, by calling a ClassMethod) but it would be possible to write one using %SyntaxColor.

0
Stefan Cronje  Jul 19, 2024 to Brett Saviano

Thank you.

I will check it out. Doing one by one is a bit impractical as I have around 5200 classes in the project.

0
Stefan Cronje  Jul 19, 2024 to Stefan Cronje

Tried it out, but id does not indicate when a method call or class is deprecated.

0
John Murray · Jul 19, 2024

I think it's possible to do this using our Yuzinji tool. Here's my idea:

  1. Go to https://structure101.com/downloads/, fill in your details, and download Structure101g Studio (S101g) for your desktop platform (one of the 3 icons circled red below):
  2. Read the instructions in https://structure101.com/help/generic/flavors/yuzinji/index.pdf to install Yuzinji into S101g, then to add Yuzinji's server-side component to your InterSystems server.
  3. Analyze all your classes and load the results into Structure101g Studio.

But how to identify which deprecated methods or classes are being referenced?

S101g has facility for tagging items on its diagrams. Its "Tag" menu can also export and import a list of tags.

  1. Tag an arbitrary class and an arbitrary method.
  2. Export your tags.
  3. Examine the file.
  4. Write a SQL query to list deprecated classes:

    select ID from %Dictionary.ClassDefinition where deprecated=1 order by ID
     

  5. Format the output to match the structure of the exported tags file, and write this to a file. I'm leaving this as an exercise for the reader.
  6. Import the file into S101g
  7. Repeat previous steps to create a tags file for deprecated methods.
  8. Explore your diagrams to pinpoint the tagged (and therefore deprecated) items.
0
John Murray  Jul 22, 2024 to John Murray

I came up with a better technique for using Yuzinji and Structure101g Studio to reveal which deprecated classes an app's codebase uses. Here's a screenshot showing the results for the Web Terminal 4.9.6 package on IRIS 2024.1

I adapted the tagging technique to identify the use of deprecated methods in non-deprecated classes. In the case of the Web Terminal codebase, no such usage was found.

If anyone reading this is interested in trying this on your own codebase please contact me through DC's DM facility, or email info@georgejames.com

0
John Murray  Jul 24, 2024 to John Murray

@Ben Spead sometime we'd love to show your Internal Apps team the kind of codebase insights Yuzinji can provide. Please DM me if you are interested.
 

0