RFR: 8255968: Confusing error message for inaccessible constructor [v3]

Maurizio Cimadamore mcimadamore at openjdk.java.net
Wed Nov 25 13:47:00 UTC 2020


On Wed, 25 Nov 2020 07:03:14 GMT, Guoxiong Li <github.com+13688759+lgxbslgx at openjdk.org> wrote:

>> Hi all,
>> 
>> When using inaccessible constructor, compiler would output some confusing error message occasionally. These confusing error message is related to the constructor order. See [JDK-8255968](https://bugs.openjdk.java.net/browse/JDK-8255968) for more information.
>> This patch solves this bug, regardless of the construction order, compiler can always output expected message.
>> Thank you for taking the time to review.
>> 
>> Best Regards.
>
> Guoxiong Li has updated the pull request incrementally with three additional commits since the last revision:
> 
>  - Change the `Test(String x)` from private to default. Add comments in test cases to improve readability.
>  - Add corresponding tests for the method reference cases.
>  - Add comments to state the situations

I left some additional comments on tests. I plan to do some experiments to validate that we are not going to introduce bad regressions.

test/langtools/tools/javac/T8255968/T8255968_10.java line 24:

> 22:  */
> 23: 
> 24: class T8255968 {

Can you please disambiguate all these class names? Having the same class name in multiple tests can create havocs, especially when running in concurrent mode. Please make sure that classes have different names, and that the auxiliary classes defined in these test are, instead, defined as nested classes (so that, again, everything will be encapsulated on a test-by-test basis, w/o any risk of a test picking up a class from another test).

test/langtools/tools/javac/T8255968/T8255968.java line 27:

> 25:  * @test
> 26:  * @bug 8255968
> 27:  * @summary Confusing error message for inaccessible constructor

Any reason as to why you went for this single file which lists all tests rather than adding jtreg tags in all the various test cases? AFAIK, in the javac code base the latter style is often preferred.

-------------

PR: https://git.openjdk.java.net/jdk/pull/1389


More information about the compiler-dev mailing list