Finding potentially dead code in OOABL

Posted by Fabian Frank on 24-Feb-2014 11:58

Before starting to write my own solution I want to make sure not to reinvent the wheel.

I'm only interested in OOABL and static analysis, no runtime statistics, code coverage etc. I searched for tools aimed at this purpose in this forum, ProgressTalk and Stackoverflow.

The Results:

Exchange 2013 presentation from Thomas Mercer-Hursh: Analysis Problems in ABL and How To Solve Them

Progress Community: Analysing code

ProgressTalk: Detecting Unused Code

EnterpriseArchitect, Joanju Analyst, Roundtable TSMS and the new Sonar based tool from Gilles Querret are all related to code analysis in some way. I haven't used any of them yet, but based on what I read, my first impression is that they don't offer excactly what I'm looking for.

If I'm right on that, this would mean writing my own solution based on the lower level "tools" XREF or Proparse. Because Proparse is no longer maintened and supports no 11.x releases, this would leave XREF as the only option.

It's sad that xref does not include private members, but compared to the effort needed to write my own parser, I think I can live with that. A very quick and dirty solution could be to make all private members protected with regex based search and replace before creating the xref files.

All Replies

Posted by Thomas Mercer-Hursh on 24-Feb-2014 12:44

I would take a look at Gilles tool first.  He *might* be getting ready to release something.  When he does, I am going to be exploring some extensions also using the parser.  So, there might be some synergy.

Posted by Fabian Frank on 24-Feb-2014 14:06

I found this PDF from his Presentation at Pugchallenge 2013:

The Java API looks like a good foundation for my task. Using xref I would need to create a similar object model first, before solving the real problem.

On the other hand, xref is available now, it's officially supported by progress and I'm familiar with it already.

Do you have any idea when he will publish the Parser?

Posted by Thomas Mercer-Hursh on 24-Feb-2014 14:26

You should check out his presentation from Brussels   There was significant progress from June to November.  I haven't asked him lately what the schedule is, but I am expecting it soonish.  Note that the parser is actually the parser from PDSOE, not something Gilles wrote.  So, you already have the parser ... it is just figuring out how to use it.  I don't see that XREF is going to do you much good for this.

Which said, what about just compiling the code and collecting the unreachable code messages?  That you can do without anything else.  What beyond that do you expect to detect without some dynamic analysis?

Posted by Fabian Frank on 24-Feb-2014 15:05

Thanks for the new link. I didn't know that he is using the parser from PDSOE. Is there any information available about it?

My primary goal is to find unreferenced methods, properties, class variables and events. Except for the private members, xref contains all necessary information for this task.

Posted by Thomas Mercer-Hursh on 24-Feb-2014 15:27

There *is* a document, part of which covers the parser.  It is not openly published, but rather given by PSC to those for whom it seems relevant.  However, before you get too excited, I will say that it doesn't really tell one what one wants to know.  It is much closer to "this is how you find out what it does" than it is "this is how you do X".  This is why I am hoping to build on what Gilles does since I figure that will be easier than having to figure it all out from scratch.  Recognize too that Gilles is doing is in Java.  So, piggybacking on his work to do something more implies working in Java, which is not that accessible from ABL.  There is a tool for turning Java into a .NET assembly which I may explore for using this from ABL, but that may be down the way yet.  But, the very first thing I would do is to contact Gilles directly, tell him what you want, ask if he is already doing it, and see if he will tell you when you might get your hands on it.  Gilles QUERRET <>

Posted by CHT on 26-Feb-2014 03:52

I really hope the tool from Gilles Querret will be released soon

Posted by cverbiest on 26-Feb-2014 05:14

+1, waiting for Gilles SonarQube tool as well.

Posted by Fabian Frank on 26-Feb-2014 16:16

I got an answer from Gilles:

I've read this thead, and really would like to announce a release
date. However, this release is dependant on my good will, but
unfortunately also on legal matters. So my best bet is "soon"...

All in all I would say the answer to my initial question is no, because there is no tool available to detect unreferenced (dead) members (class variables, properties, events, methods) in OOABL.
Chances are that it would be easier to write the rules to find these members against Gilles API, but it's also possible using xref (except for the private ones).

My plan is to create an object model from xref as foundation for the concrete task of finding dead members. I'm going to code in C# so that it can be used from ABL easily, without the need for IKVM.NET.

Parser and object model will reside in a separate assembly to make them available for other use cases and to keep them independent from the tool.

If I manage to leave experimental stage successfully I will publish it on github.

Posted by Jeff Ledbetter on 26-Feb-2014 16:27

Roundtable TSMS has the necessary information stored to do this. We store cross-reference data for class members so that one can easily see where/how they are used.

Posted by Thomas Mercer-Hursh on 28-Feb-2014 09:36

Fabian, please drop me a line off line at  I have a project this spring which might have some synergy to your needs.

Posted by Fabian Frank on 01-Mar-2014 17:51

@Jeff Ledbetter: I knew roundtable stores xref info because i had a look at the product pages and documentation before starting this thread. Thats why I mentioned it in the question. Because I have never had the chance to use it, I was just not sure if it would be able to find unreferenced members directly. So, thanks for clearing that up.

Being able to see what references point to a specific class member is only one step away from my task. Based on this, it should be easier to detect the unreferenced members in a project than starting from pure xref.
But as compelling as roundtable looks as a whole, using it only for this purpose, feels like taking a sledgehammer to crack a nut.

Even though I would like to have some other roundtable features in our development environment, it's not enough to get me away from our current setup. It's based on mercurial scm and a custom build tool (with reliable multiprocess compilation for classes) that I wrote two years ago when I was not aware of the community and PCT (yes, shame on me :)).
But to make it clear: Version Control is my main issue here, not the build tool. Our whole process is based on the advantages that DVCS's like git and mercurial provide. In my eyes, roundtable would be much more interesting if it could be used with git/mercurial as scm. By the way: I missed git/mercurial in your scm comparison document.


Back to topic: I started to design the underlying object model and began to fill it with data from xref. All in all I'm making good progress (in C#).

More details later.

@Thomas: You've got mail.

This thread is closed