As mentioned before, Eddy and I discovered a problem with type variables in code generated by the Mint compiler. We have now fixed this problem in the new release of Mint and DrJava with Mint: August 30, 2010 (r15716). The latest release is, as always, available from the Mint implementation page:
The problem occurred when the programmer used a type variable inside a bracket. An example of this would be a generic method like this:
[cc lang=”java”]public separable
return <| ( `(lfTest.eval(e,f).booleanCodeValue()) ?
`c2 : `c1 ) |>;
}[/cc]
This caused Mint to generate 2nd stage code that contained the type variable [cci lang=”java”]X[/cci] unbound. Unfortunately, the types are erased, and there is no way to find out what type [cci lang=”java”]X[/cci] actually refers to at runtime, e.g. by writing something like [cci lang=”java”]X.class[/cci] (this generates the Java compiler error “cannot select from a type variable”).
To get around this problem, we now require a final instance of type [cci lang=”java”]Class
[cc lang=”java”]public separable
final Class
return <| ( `(lfTest.eval(e,f).booleanCodeValue()) ?
`c2 : `c1 ) |>;
}[/cc]
That’s all that is necessary. The variable [cci lang=”java”]xc[/cci] is not actually used in the code, it just needs to be in scope.
(Re-posted from The Java Mint Blog.)