Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
8255968: Confusing error message for inaccessible constructor
Reviewed-by: mcimadamore
- Loading branch information
1 parent
c5046ca
commit 29d90b9
Showing
31 changed files
with
715 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
* | ||
* This code is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
* or visit www.oracle.com if you need additional information or have any | ||
* questions. | ||
*/ | ||
|
||
/* | ||
* @test | ||
* @bug 8255968 | ||
* @summary Confusing error message for inaccessible constructor | ||
* @run compile/fail/ref=T8255968_1.out -XDrawDiagnostics T8255968_1.java | ||
*/ | ||
|
||
class T8255968_1 { | ||
T8255968_1_Test c = new T8255968_1_Test(0); | ||
} | ||
|
||
class T8255968_1_Test { | ||
private T8255968_1_Test(int x) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
T8255968_1.java:32:25: compiler.err.report.access: T8255968_1_Test(int), private, T8255968_1_Test | ||
1 error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
* | ||
* This code is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
* or visit www.oracle.com if you need additional information or have any | ||
* questions. | ||
*/ | ||
|
||
/* | ||
* @test | ||
* @bug 8255968 | ||
* @summary Confusing error message for inaccessible constructor | ||
* @run compile/fail/ref=T8255968_10.out -XDrawDiagnostics T8255968_10.java | ||
*/ | ||
|
||
class T8255968_10 { | ||
T8255968_10_TestMethodReference c = T8255968_10_Test::new; | ||
} | ||
|
||
interface T8255968_10_TestMethodReference { | ||
T8255968_10_Test create(int x); | ||
} | ||
|
||
class T8255968_10_Test { | ||
private T8255968_10_Test(int x) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
T8255968_10.java:32:41: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.report.access: T8255968_10_Test(int), private, T8255968_10_Test)) | ||
1 error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
* | ||
* This code is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
* or visit www.oracle.com if you need additional information or have any | ||
* questions. | ||
*/ | ||
|
||
/* | ||
* @test | ||
* @bug 8255968 | ||
* @summary Confusing error message for inaccessible constructor | ||
* @run compile/fail/ref=T8255968_11.out -XDrawDiagnostics T8255968_11.java | ||
*/ | ||
|
||
class T8255968_11 { | ||
T8255968_11_TestMethodReference c = T8255968_11_Test::new; | ||
} | ||
|
||
interface T8255968_11_TestMethodReference { | ||
T8255968_11_Test create(int x); | ||
} | ||
|
||
class T8255968_11_Test { | ||
T8255968_11_Test(String x) {} // If this method is private, compiler will output the same error message. | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
T8255968_11.java:32:41: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbol: kindname.constructor, T8255968_11_Test, java.lang.String, int, kindname.class, T8255968_11_Test, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: int, java.lang.String)))) | ||
1 error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
* | ||
* This code is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
* or visit www.oracle.com if you need additional information or have any | ||
* questions. | ||
*/ | ||
|
||
/* | ||
* @test | ||
* @bug 8255968 | ||
* @summary Confusing error message for inaccessible constructor | ||
* @run compile/fail/ref=T8255968_12.out -XDrawDiagnostics T8255968_12.java | ||
*/ | ||
|
||
class T8255968_12 { | ||
T8255968_12_TestMethodReference c = T8255968_12_Test::new; | ||
} | ||
|
||
interface T8255968_12_TestMethodReference { | ||
T8255968_12_Test create(int x); | ||
} | ||
|
||
class T8255968_12_Test { | ||
private T8255968_12_Test(int x) {} // This method is not at the end. | ||
T8255968_12_Test(String x) {} // If this method is private, compiler will output the same error message. | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
T8255968_12.java:32:41: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbols: kindname.constructor, T8255968_12_Test, int,{(compiler.misc.inapplicable.method: kindname.constructor, T8255968_12_Test, T8255968_12_Test(int), (compiler.misc.report.access: T8255968_12_Test(int), private, T8255968_12_Test)),(compiler.misc.inapplicable.method: kindname.constructor, T8255968_12_Test, T8255968_12_Test(java.lang.String), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: int, java.lang.String)))})) | ||
1 error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
* | ||
* This code is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
* or visit www.oracle.com if you need additional information or have any | ||
* questions. | ||
*/ | ||
|
||
/* | ||
* @test | ||
* @bug 8255968 | ||
* @summary Confusing error message for inaccessible constructor | ||
* @run compile/fail/ref=T8255968_13.out -XDrawDiagnostics T8255968_13.java | ||
*/ | ||
|
||
class T8255968_13 { | ||
T8255968_13_TestMethodReference c = T8255968_13_Test::new; | ||
} | ||
|
||
interface T8255968_13_TestMethodReference { | ||
T8255968_13_Test create(int x); | ||
} | ||
|
||
class T8255968_13_Test { | ||
T8255968_13_Test(String x) {} // If this method is private, compiler will output the same error message. | ||
private T8255968_13_Test(int x) {} // This method is at the end. | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
T8255968_13.java:32:41: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbols: kindname.constructor, T8255968_13_Test, int,{(compiler.misc.inapplicable.method: kindname.constructor, T8255968_13_Test, T8255968_13_Test(int), (compiler.misc.report.access: T8255968_13_Test(int), private, T8255968_13_Test)),(compiler.misc.inapplicable.method: kindname.constructor, T8255968_13_Test, T8255968_13_Test(java.lang.String), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: int, java.lang.String)))})) | ||
1 error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
* | ||
* This code is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
* or visit www.oracle.com if you need additional information or have any | ||
* questions. | ||
*/ | ||
|
||
/* | ||
* @test | ||
* @bug 8255968 | ||
* @summary Confusing error message for inaccessible constructor | ||
* @run compile/fail/ref=T8255968_14.out -XDrawDiagnostics T8255968_14.java | ||
*/ | ||
|
||
class T8255968_14 { | ||
T8255968_14_TestMethodReference c = T8255968_14_Test::new; | ||
} | ||
|
||
interface T8255968_14_TestMethodReference { | ||
T8255968_14_Test create(int x); | ||
} | ||
|
||
class T8255968_14_Test { | ||
private T8255968_14_Test(int x) {} // This method is not at the end. | ||
T8255968_14_Test(String x) {} // If this method is private, compiler will output the same error message. | ||
private T8255968_14_Test(int[] x) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
T8255968_14.java:32:41: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbols: kindname.constructor, T8255968_14_Test, int,{(compiler.misc.inapplicable.method: kindname.constructor, T8255968_14_Test, T8255968_14_Test(int), (compiler.misc.report.access: T8255968_14_Test(int), private, T8255968_14_Test)),(compiler.misc.inapplicable.method: kindname.constructor, T8255968_14_Test, T8255968_14_Test(java.lang.String), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: int, java.lang.String))),(compiler.misc.inapplicable.method: kindname.constructor, T8255968_14_Test, T8255968_14_Test(int[]), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: int, int[])))})) | ||
1 error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
* | ||
* This code is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
* or visit www.oracle.com if you need additional information or have any | ||
* questions. | ||
*/ | ||
|
||
/* | ||
* @test | ||
* @bug 8255968 | ||
* @summary Confusing error message for inaccessible constructor | ||
* @run compile/fail/ref=T8255968_15.out -XDrawDiagnostics T8255968_15.java | ||
*/ | ||
|
||
class T8255968_15 { | ||
T8255968_15_TestMethodReference c = T8255968_15_Test::new; | ||
} | ||
|
||
interface T8255968_15_TestMethodReference { | ||
T8255968_15_Test create(int x); | ||
} | ||
|
||
class T8255968_15_Test { | ||
T8255968_15_Test(String x) {} // If this method is private, compiler will output the same error message. | ||
private T8255968_15_Test(int x) {} // This method is not at the end. | ||
private T8255968_15_Test(int[] x) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
T8255968_15.java:32:41: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbols: kindname.constructor, T8255968_15_Test, int,{(compiler.misc.inapplicable.method: kindname.constructor, T8255968_15_Test, T8255968_15_Test(java.lang.String), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: int, java.lang.String))),(compiler.misc.inapplicable.method: kindname.constructor, T8255968_15_Test, T8255968_15_Test(int), (compiler.misc.report.access: T8255968_15_Test(int), private, T8255968_15_Test)),(compiler.misc.inapplicable.method: kindname.constructor, T8255968_15_Test, T8255968_15_Test(int[]), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: int, int[])))})) | ||
1 error |
Oops, something went wrong.
29d90b9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review
Issues