hg: valhalla/valhalla: 8222634: [lworld] Javac sometimes emits incorrect ('Q') descriptors for fields.

Srikanth srikanth.adayapalam at oracle.com
Wed Apr 17 13:03:22 UTC 2019


Hi Tobias,

This change set fixes 4 problems you had reported in 
https://bugs.openjdk.java.net/browse/JDK-8222634:

1. The following code snippet compiles fine now:
value class MyValue1 {
     final int x = 0;
}

public class Test {
     static final MyValue1 vField = new MyValue1();

     value class MyValue2 {
         final MyValue1? vBoxField;

         public MyValue2() {
             vBoxField = new MyValue1();
         }
     }

     public static void main(String[] args) { }
}

(earlier error: incompatible types: MyValue1 cannot be converted to 
Test.MyValue2
             vBoxField = new MyValue1();)

(2) The following code snippet compiles fine now:
value class MyValue1 {
     final int x = 0;
     public int hash() { return 0; }
}

public class Test {

     value class MyValue2 {
         final MyValue1? vBoxField = null;

         public int test() {
             return vBoxField.hash();
         }
     }

     public static void main(String[] args) { }
}

(earlier error: cannot find symbol
             return vBoxField.hash();)

                             ^
(3) The following code snippet compiles fine now:
interface MyInterface {
     public void test(MyValue1? vt);
}

value class MyValue1 implements MyInterface {
     final int x = 0;

     @Override
     public void test(MyValue1? vt) { }
}


(4) Sometimes field descriptors carried the wrong 'Q' type for V?

I have upgraded the javac tests to include these scenarios. I will also 
be adding more tests in future as I test and upgrade the preliminary 
support that has been put in place.

Here are the pending ones I see:

(1) Compile time null assignment to values should be tolerated (?)
(2) Compiler does not tolerate the following:
MyValue1?[] vBoxArray = new MyValue1?[42];

Thanks!
Srikanth


On 17/04/19 5:31 PM, srikanth.adayapalam at oracle.com wrote:
> Changeset: 2e5ecb20aa24
> Author:    sadayapalam
> Date:      2019-04-17 17:31 +0530
> URL:       http://hg.openjdk.java.net/valhalla/valhalla/rev/2e5ecb20aa24
>
> 8222634: [lworld] Javac sometimes emits incorrect ('Q') descriptors for fields.
>
> ! src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java
> + test/langtools/tools/javac/valhalla/lworld-values/CheckFieldDescriptors.java
>



More information about the valhalla-dev mailing list