Prev: Java work from home. Remote (telecommuting) jobs in Java.
Next: Zip question: Where are all the extra characters coming fromupon unzipping?
From: Steven Simpson on 2 Nov 2009 16:10 Tomas Mikula wrote: > I have implemented a subset of the proposal with the @ImplementsStatic > annotation. I see you've used an annotation processor to generate the static proxy class at the same time as the target class. Neat. Is there any reason you need a second field in your annotation for the generic type parameters? Since they might have parameters of their own, and you deal with these by inserting them into the same array (as if by in-order traversal?), could the original type parameters not be similarly inserted into the main array? > Only later I found Stefan Schulz's blog entry where he > proposed the same. So his code will probably be similar, but I haven't > found it anywhere. The main difference is that it is a run-time implementation - a reflective proxy is created by the equivalent of getContractor. Cheers! -- ss at comp dot lancs dot ac dot uk
From: Tomas Mikula on 4 Nov 2009 14:54
On Mon, 02 Nov 2009 21:10:58 +0000, Steven Simpson wrote: > Is there any reason you need a second field in your annotation for the > generic type parameters? Since they might have parameters of their own, > and you deal with these by inserting them into the same array (as if by > in-order traversal?), could the original type parameters not be > similarly inserted into the main array? You are right, they could be inserted into the first array. The reason was that my initial idea was to have yet another array of Strings as formal parameters that would match to the annotated class's formal type parameters, like in this example: @ImplementsStatic( value={Map.class}, actualTypeParameters={Integer.class, Anything.class}, formalTypeParameters={ "" , "T" } ) class MyClass<T> { ... } The above would be equivalent to class MyClass<T> implements static Map<Integer,T> Then I realized that static methods don't inherit the class's type parameters, so this would be meaningless, yet the actualTypeParameters array remained there. |