8023545: Misleading error message when using diamond operator with private constructor

Reviewed-by: jjg
This commit is contained in:
Vicente Romero 2013-09-03 23:41:37 +01:00
parent 06caeea3d6
commit cab6b226ff
3 changed files with 38 additions and 16 deletions

View file

@ -0,0 +1,16 @@
/*
* @test /nodynamiccopyright/
* @bug 8023545
* @summary Misleading error message when using diamond operator with private constructor
* @compile/fail/ref=MisleadingErrorMsgDiamondPlusPrivateCtorTest.out -XDrawDiagnostics MisleadingErrorMsgDiamondPlusPrivateCtorTest.java
*/
public class MisleadingErrorMsgDiamondPlusPrivateCtorTest {
public void foo() {
MyClass<Object> foo = new MyClass<>();
}
}
class MyClass<E> {
private MyClass() {}
}