RFR: JDK-8252031: --patch-module java.base= may fail with "cyclic inheritance involving Object"

Jonathan Gibbons jonathan.gibbons at oracle.com
Wed Aug 19 22:08:29 UTC 2020


+1

I also confirm this patch fixes the situation where this issue was 
originally observed.

-- Jon

On 8/19/20 5:42 AM, Jan Lahoda wrote:
> Hi,
>
> When running javac with --patch-module java.base=<dir>, where <dir> 
> contains a copy of java/lang, the compilation may (depending on exact 
> circumstances) incorrectly fail with:
> error: cyclic inheritance involving Object
>
> The reason is that Types.asSuper is setting Flags.LOCKED on Symbols to 
> detect cycles. But it also completes some of the Symbols, and if it 
> tries to complete a Symbol that originates in source, cycle detection 
> in for that Symbol is triggered using Check.checkNonCyclic. And that 
> cycle detection is also using the LOCKED flag to detect cycles. So 
> there may be interference between these two uses, leading to the false 
> error.
>
> The proposal is to avoid using the flag in asSuper, and use a simple 
> Set to detect the cycles.
>
> Possible alternative solutions include using a different flag (which 
> is troublesome due to the limited supply of flags), or carefully avoid 
> the unwanted interference by not completing while the flag is set 
> (which is somewhat fragile).
>
> Proposed webrev:
> http://cr.openjdk.java.net/~jlahoda/8252031/webrev.00/index.html
>
> JBS: https://bugs.openjdk.java.net/browse/JDK-8252031
>
> What do you think?
>
> Thanks,
>     Jan


More information about the compiler-dev mailing list