jdk-24/test/langtools/tools/javac/generics/UncheckedConstructor.java

25 lines
601 B
Java
Raw Normal View History

2007-12-01 00:00:00 +00:00
/*
* @test /nodynamiccopyright/
2007-12-01 00:00:00 +00:00
* @bug 4951260
* @summary compiler disallows raw call to generic constructor
* @author gafter
*
* @compile -Werror UncheckedConstructor.java
* @compile/fail/ref=UncheckedConstructor.out -XDrawDiagnostics -Werror -Xlint:unchecked UncheckedConstructor.java
2007-12-01 00:00:00 +00:00
*/
import java.util.*;
class G3 {
G3(Enumeration<Object> e) { }
static void g() {
new G3(new Enumeration() {
public boolean hasMoreElements() { return false; }
public Object nextElement() { return null; }
});
}
}