google yields, after skipping posts from stackoverflow, http://mail.openjdk.java.net/pipermail/coin-dev/2011-June/003283.html
I'm guessing it's like this, usually an anonymous class is a concrete subclass of the apparent type
interface Foo<N extends Number>
{
void foo(N n);
}
Foo<Integer> foo = new Foo<Integer>(){ ... }
is implemented by
class AnonFoo_1 implements Foo<Integer>{ ... }
Foo<Integer> foo = new AnonFoo_1();
Suppose we allow diamond inference on anonymous classes, there can be complicated case like
Foo<? extends Runnable> foo = new Foo<>(){ ... }
The inference rules yield N=Number&Runnable
; following the prev implementation trick, we need
class AnonFoo_2 implements Foo<Number&Runnable>{ ... }
That is currently not allowed; the type arg to super type Foo
must be a "normal" type.
However, the rationale is not very strong. We can invent other implementation tricks to make it work
class AnonFoo<N extends Number&Runnable> implements Foo<N>
{
@Override public void foo(N n)
{
n.intValue();
n.run();
}
}
Foo<? extends Runnable> foo = new AnonFoo<>();
the compiler ought to be able to do the same trick.
In any case, at least the compiler should allow the majority of use cases that do not involve "undenotable types", like Foo<Integer> foo = new Foo<>(){...}
It's a pity that these common/simple cases are unnecessarily forbidden too.