- A Concurrent Affair - https://www.concurrentaffair.org -

Data Predicate Annotations

I have thought a little about how to do predicate annotations on data. Of course there’s the local variable problem, but let’s ignore that for now.

Originally, I thought it would be rather easy: Whenever a field or parameter is declared, I run a check method every time it is accessed. This, of course, is wrong because the predicates should not be based on the declaration site but rather on the object that is created.

So I need to add fields to java.lang.Object that get filled in when the object is created to store the predicate class and method name. Of course, as we all know, you can’t add fields to Object, so I do what I have done for the object ID [1] and add a method to Object that calls the real check method in edu.rice.cs.cunit.threadCheck.ThreadCheck, which then looks up the predicates in a hash table.

What I haven’t figured out is how I get the parameters from the annotations into the check method.

[2] [3]Share [4]