08.17.05
Creatures of habit
I have been busily working on my research for the NextGen Generic Java compiler. I have spend the last couple days starting on this paper for SAC 2006. I was reviewing the list of type dependent operations supported by NextGen. In particular, I was double checking if NextGen currently handles casting correctly. I proceeded to create the following test case:
public class A {
static class Box < T> { }
public static void main(String[] args) {
Box < String> s = new Box< String>();
Box< ?> a1 = (Box< ?>) (Object)s;
Box< Object> a2 = (Box< Object>) (Object) s;
}
}
After executing this code, I inspected the resulting bytecode and discovered that casting was not working properly. So after some fiddling, I found the segment of code I need to modify. At the top of this section, I also found the following comment:
//TODO: cant cast Object to Box< String>
//will need to fix this case to support
//generic casts
So I’ve returned to fix a problem that I had skimmed over before, using the same basic names and types. Well I guess I like using Box< T> as an example. Still kinda funny though.