On Mon, 16 Mar 2026 15:31:31 GMT, Vicente Romero <[email protected]> wrote:
> this test case is being rejected by javac:
>
> class Test {
> Test(Test t) {}
>
> Test(String s) {
> this(new Test());
> }
>
> Test() {}
> }
>
> here what is happening is that when analyzing the `new Test()` invocation the
> code to determine if there is an enclosing instance for this expression,
> javac is not checking first if there is an enclosing instance at all. This
> analysis shouldn't be done for cases like the one above for which there is no
> enclosing instance.
>
> TIA
This pull request has now been integrated.
Changeset: 1b6f3e01
Author: Vicente Romero <[email protected]>
URL:
https://git.openjdk.org/valhalla/commit/1b6f3e01ead404fc9b48a06ae376a860de9d1288
Stats: 18 lines in 2 files changed: 15 ins; 0 del; 3 mod
8379833: [lworld] Javac is rejecting valid constructor code
Reviewed-by: liach
-------------
PR: https://git.openjdk.org/valhalla/pull/2231