javacArea: Compiler
Synopsis: The Java 7 compiler used to erroneously accept the diamond operator in array initializer expressions. For example, the following code, which was previously accepted, is now rightly rejected:
class Foo<X> {}
class Test {
Foo<String>[] fooArr = new Foo<>[]{ }; //error
}
See 7057297.
Area: Compiler
Synopsis: The Java 7 compiler erroneously accepted the following program due to a bug in the most specific algorithm implementation:
import java.util.*;
interface A {List<Number> getList();}
interface B {ArrayList getList();}
interface AB extends A, B {}
class Test {
void test(AB ab) {
Number n = ab.getList().get(1);
}
}
This program used to fail in JDK 6. A fix has been provided in Java SE 7u2 to rightly reject this program. See 7062745.