Hello,
I can confirm that the fix pushed by Chen Liang solves the issue :)

Rémi

----- Original Message -----
> From: "jan lahoda" <[email protected]>
> To: "Remi Forax" <[email protected]>, "valhalla-dev" 
> <[email protected]>
> Cc: "Vicente Romero" <[email protected]>
> Sent: Wednesday, February 4, 2026 8:32:19 PM
> Subject: Re: bworld - java laucher vs restricted field

> Hi Remi,
> 
> 
> Thanks for the report. Please see for what I think is the cause and a
> possible fix:
> https://github.com/openjdk/valhalla/pull/2039
> 
> 
> Jan
> 
> 
> On 2/4/26 16:43, Remi Forax wrote:
>> Hello,
>> I'm testing the restricted fields on the bworld branch,
>> running the source code directly with the command "java" without using javac
>> failed.
>>
>> step to reproduce:
>>
>> $JAVA_HOME/bin/java --enable-preview ComplexBox.java
>>
>> ComplexBox.java:10: error: cannot access NullRestricted
>> public class ComplexBox {
>>         ^
>>    class file for jdk.internal.vm.annotation.NullRestricted not found
>> 1 error
>> error: compilation failed
>>
>> If instead, I first compile and then run, there is no issue.
>>
>> ---
>> public class ComplexBox {
>>    public value record Complex(int re, int im) {}
>>
>>    private Complex! complex;
>>
>>    public ComplexBox(Complex! complex) {
>>      this.complex = complex;
>>      super();
>>    }
>>
>>    @Override
>>    public String toString() {
>>      return "ComplexBox (" + complex + ")";
>>    }
>>
>>    // -XX:+UnlockDiagnosticVMOptions -XX:+PrintInlineLayout
>>    static void main() {
>>      var complex = new Complex(2, 1);
>>      var box = new ComplexBox(complex);
>>
>>      IO.println(box);
>>    }
> > }

Reply via email to