Apparent generics compilation bug new to Java 1.7
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Thu Feb 23 10:09:55 PST 2012
Thanks for the report - this problem is caused by a bug in type-variable
substitution when checking for generic type well-formedness. We are
working on a fix.
Thanks
Maurizio
On 23/02/12 15:09, Benedict Elliott Smith wrote:
> I'm not using I and I2 interchangeably, I'm just swapping them when
> declaring a new binding for the type parameters of (a different) A.
>
> i.e. let's call the class definition A, and the type I am declaring
> for the method return value A' ; and its corresponding type parameters
> K', V', I' and I2'
>
> All I am saying is that K' ^= V, V' ^= K, I' ^= I2 and I2' ^= I
>
> Now, I2 ^= "?" extends B<V, K> and I ^= "?" extends B<K, V>
>
> (now ignoring the ? extends for brevity...)
>
> Since K' ^= V and V' ^= K; we have I' == I2 == B<K',V'> and I2' == I
> == B<V',K'>
>
> Which looks fine to me. Could you clarify your argument if I'm missing
> something?
>
>
>
>
>
>
>
> On 23 February 2012 14:46, Florian Weimer <fweimer at bfk.de
> <mailto:fweimer at bfk.de>> wrote:
>
> * Benedict Elliott Smith:
>
> > The below class no longer compiles (1.7.02); I can't see any
> good reason
> > for it not to, and nor can ecj or the 1.6 JDK, so I think it is
> quite
> > probably a bug.
>
> Why are I and I2 interchangeable?
>
> > public class TypeTest {
> > static abstract class A<K, V, I extends B<K, V>, I2 extends
> B<V, K>> {
> > abstract A<V, K, I2, I> test();
> > }
> > static class B<K, V> {
> > }
> > }
>
> They have different bounds, so I think you can't swap them.
>
> --
> Florian Weimer <fweimer at bfk.de <mailto:fweimer at bfk.de>>
> BFK edv-consulting GmbH http://www.bfk.de/
> Kriegsstraße 100 tel: +49-721-96201-1
> <tel:%2B49-721-96201-1>
> D-76133 Karlsruhe fax: +49-721-96201-99
> <tel:%2B49-721-96201-99>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20120223/0a61bae3/attachment.html
More information about the compiler-dev
mailing list