PDE API Tools and Usage Scans

PDE API Tools and Usage Scans

The PDE team has been busy at work for the Eclipse 3.5M6 milestone, from revamping the target platform story to product definition enhancements. One of my favorite upcoming enhancements comes from the API Tools part of PDE, we are enhancing API Tools to do usage scanning. What does this mean? Well, let’s turn this into a story.

Let’s pretend I’m Darin Swanson, the lead of the Eclipse Platform Ant project in Eclipse. I want to answer the question of who is using any of my API, or even better, internal code. To answer this question, I would head over to one of the usage reports from API Tools (this particular one is done against the 3.4.1 release of the Eclipse SDK).


As Darin, I would cruise over to the projects I’m responsible for… in this case I see the org.eclipse.ant.core and org.eclipse.ant.ui bundles. If I peek at org.eclipse.ant.core first, I see three bundles referencing me:


Those references look fine to me, no one is using internal APIs except org.eclipse.ant.ui but that’s fine since the internal references are permissible (via x-friends). Let’s check out how org.eclipse.ant.ui is doing:


Uh oh, looks like there’s some trouble here. The org.eclipse.pde.ui bundle (doh!) is referencing some internal APIs from the org.eclipse.ant.ui bundle. If we drill down further, we see the guilty references:


Kind of cool huh? The usage scan tooling is still in the early stages, but we hope to make more progress at the Eclipse 3.5 release comes to a close. I guess the only bad thing about this particular example was that I found myself guilty for referencing internal APIs, but it goes to show you that it’s pretty easy to do this. Now that Darin knows that I’m referencing internal APIs from Platform Ant, maybe we could spark a conversation of how to make new API or give me an alternative route that’s public API friendly.

In the end, as a developer, the usage scan tooling enables me to find out who is referencing my code across a set of bundles. On a side note, it would be really interesting to see a usage scan across the whole Galileo release. We could have a contest for the bundle who has the most abused internal references!