Eclipse PDE/RPC Achilles Heel: Reflection

DZone 's Guide to

Eclipse PDE/RPC Achilles Heel: Reflection

· Java Zone ·
Free Resource

Having had a front seat to the mania that was the SWT v. Swing debate, clearly the broader question of why IBM has almost never seen fit to enhance what was in Java is not a new topic. Doing PDE dev, you are confronted with the obvious need for reflection to do anything serious, after all, this is metaprogramming, ergo, metadata/metamodel is going to be required.

What you find, once you go digging in, is that, for whatever reason, IBM decided to provide their own model. Now, if it was because they foresaw the fact that they wanted to be language agnostic, I spose that is understandable, and it‘s not the worst thing in the world. After all, there is not a lot of sense to having all your metamodel musings tied to just one language.

As is the case in so much else Eclipse, however, the trouble seeps in through other seams. First off, the implementation of much of this stuff has braindead gaps in it, and documentation, example code, etc., is sparse to the point of non-existent. For example, whereas in Java, you would pull out fields for a type by calling class.getDeclaredFields(), and then those things would be full-fledged recurseable types, in eclipse, you have to pull out the fields, and get an IField, and that does not even have a method for getting the type!! There were a ton of people complaining about it. Ultimately, you have to do a bunch of ridiculous stuff. Here is a util method (that‘s sure to make you want to brush yer teeth):

Of course, all the usual incantations that come to mind when one finds oneself inverted in a tank of water, wearing a straightjacket came forth as part of this exegesis. Having achieved some degree of catharsis, I am not as angry about this now, and having pushed on much further into the weeds, without so much resistance, feel better overall. However, the one thing that I realize is the biggest drag about Eclipse‘s form of model metadata is that it requires the container. So the simplest code to manipulate an AST (which is smartly modeled with a Visitor Pattern so no complaints there!), must be run as JUnit Plugin Tests. Same is true of even just examining the typing. Makes the lure of SSD salvation all the more compelling… There is also, though, the fact that because there is a whole other model (metamodel) here, the ramp is probably part of what is keeping more people from doing serious PDE work and developing tools that do more than code resurfacing or static analysis.

From http://www.jroller.com/robwilliams


Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}