Integrated: 8319987: compilation of sealed classes leads to infinite recursion

Vicente Romero vromero at openjdk.org
Thu Nov 16 16:44:47 UTC 2023


On Wed, 15 Nov 2023 04:22:15 GMT, Vicente Romero <vromero at openjdk.org> wrote:

> The compiler can throw a SOE when trying to compile an incorrect sealed classes hierarchy like:
> 
>     sealed interface Action permits Add {}
>     sealed interface MathOp permits Add {}
>     sealed static class Add implements MathOp permits Add {}
> 
> The error is thrown while trying to prove if two classes are disjoint or not. The proposed solution is to keep a set with the pairs of classes analyzed so far and stop as soon as a the current pair of classes is already in the set.
> 
> TIA

This pull request has now been integrated.

Changeset: 52e2878c
Author:    Vicente Romero <vromero at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/52e2878cffd9cb704ad773b841dbab0d17eba896
Stats:     55 lines in 3 files changed: 30 ins; 6 del; 19 mod

8319987: compilation of sealed classes leads to infinite recursion

Reviewed-by: jlahoda

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

PR: https://git.openjdk.org/jdk/pull/16668


More information about the compiler-dev mailing list