Today was pretty much a repeat from yesterday: I fixed (or at least worked on) another DrJava bug and made improvements to my dynamic thread checker. Unfortunately, the bug fix did not make it into our new new stable release anymore. I also couldn’t reproduce the “Unsupported major.minor version” error, but that may even be a good thing.
I was a little bit late to our research meeting, but when I talked about the thread checker, Corky agreed that annotations on superclasses or methods in superclasses should be considered in subclasses as well. He also said I could go ahead and use DrJava as test codebase. We didn’t talk very much, but when I mentioned the warnings that should be raised when a subclass has an annotation but a superclass does not, he suggested that perhaps an annotation should only be allowed where a method is first introduced, and not in a subclass or implementing class.
We both agreed that this might not be practical, though: Often programmers implement Standard Java API interfaces, like
ActionListener, and then they would not be able to annotate those implementing classes.
I still need to do a little more testing and write unit tests, but I did write the code tonight that checks superclasses and interfaces for annotations as well. The code for subtyping warnings is there too, but it generates a lot of warnings… More than may be useful. They currently look like this:
ThreadCheckTest has @NotRunBy thread name 'foo' but java.lang.Object does not ThreadCheckTest3 has @OnlyRunBy thread name 'main2' but java.lang.Object does not ThreadCheckTest4.run()V has @NotRunBy thread name 'childclass-method2' but ThreadCheckTest4SuperClass.run()V does not
I think I may want to exclude
java.lang.Object from this. And perhaps even more.
This sort of brings up the topic of instrumenting library code. There are probably a lot of AWT/Swing methods that should only be executed by the event thread, for example, but how do I instrument them? The source has been released, but I don’t think I actually want to compile it.
So what I have in mind now is an external text or XML file that just contains location-annotation pairs so the programmer can tell the instrumentor to attach a
java.swing.text.Document or a
I’m excited to see the thread checker grow and to apply it to DrJava. I may actually have some statistical and benchmarking data soon. All right, it’s nearly 5 AM again, and I think I should try to sleep (but not oversleep) again.