Monday, August 08, 2005

Another gumption trap

It looks like I have hit a major roadblock in Vajra. The problem stems from my not having thought through fully how to handle class objects. I have two classes called object and Class, which model the respective Java constructs. Whenever I need a class object, I create a dummy object which has a Class object as its data member. I was able to manage things as long as I was aware of when I needed to access the class object and when I did not (e.g. invoking static methods vs instance methods). But I have at last run into a situation where I will not be able to make this distinction: places where the class object is used in a (for want of a better word) non-static scenario -- as, for example, happens in Classpath's Permissions.java:

perms.put(perm.getClass(), allPermission);

(which is incidentally where Vajra chokes right now).

The ideal solution is to inherit Class from object, as is done in JNI, but I think this will break too many things at this stage. Meanwhile, I am looking for a less painful solution...