[lworld] RFR: 8280194: Abstract classes that allow value subclasses should be marked ACC_PERMITS_VALUE (0x0040)

Srikanth Adayapalam sadayapalam at openjdk.java.net
Tue Feb 1 11:25:40 UTC 2022


On Tue, 1 Feb 2022 10:10:02 GMT, Aggelos Biboudis <duke at openjdk.java.net> wrote:

>> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java line 1255:
>> 
>>> 1253:                     }
>>> 1254:                 }
>>> 1255: 
>> 
>> This is too late here. Now this is moved up to MemberEnter
>
> Why was this moved up? (for me to understand better)

This was in being set in Attribution phase - and is also consulted in the attribution phase. 
so when we have classes like:

value class V extends A {}
abstract class A { A() {} } 

when we are attributing V, A may not be attributed. While attributing V, we will check if V's superclass (A) meets all the requirements of an abstract class to be a value super but A isn't attributed yet.

What we have done now is to move these analysis to MemberEnter - MemberEnter for V and A are both guaranteed to have finished before Attribution of either starts, so we have eliminated the phase ordering problem

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

PR: https://git.openjdk.java.net/valhalla/pull/622


More information about the valhalla-dev mailing list