Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Eclipse PDE/RPC Achilles Heel: Reflection

DZone's Guide to

Eclipse PDE/RPC Achilles Heel: Reflection

· Java Zone
Free Resource

Bitbucket is for the code that takes us to Mars, decodes the human genome, or drives your next car. What will your code do? Get started with Bitbucket today, it's free.

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

Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

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

{{ parent.tldr }}

{{ parent.urlSource.name }}