« Ex-Forms and Ant Propeties | Main | Skinning the cat another way »

Evil, but not Evil Enough

I almost got my evil scheme to work...

try {
    Field fieldProp = Project.class.getDeclaredField("properties");
    fieldProp.setAccessible(true);
    Hashtable props = (Hashtable) fieldProp.get(project);
    props.remove(property);
    fieldProp.setAccessible(false);
} catch (Exception e) {
    project.log("I got caught with my hand in the cookie jar: " + e);
    project.setProperty(property, "");
}

I can access the properties object, but only in jdk 1.2+. The API I need to access a private field is java.lang.reflect.AccessableObject, which wasn't present in JDK 1.1.

So I am at a crossroads... and what I am leaning towards is to drop JDK 1.1 support. It kinda works but will be rather broken for most install tasks. The other option is to try and add a removeProperty method to the Project class, but I would either need to fork it or get it into Ant 1.6. Forking for a legitamite API reason is just as unpallitable to me as forking for political reasons. As for the other path I bet that a bug for adding a removeProperty method would get shot down for design reasons, and I couldn't say I'de blame them on that one either. Oh well...

About

This page contains a single entry from the blog posted on November 3, 2002 9:59 AM.

The previous post in this blog was Ex-Forms and Ant Propeties.

The next post in this blog is Skinning the cat another way.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type 3.33