Search code examples
javaeclipsejava-15java-sealed-type

Sealed classes don't compile, Eclipse compiler bug?


I am having those two classes in Eclipse 2020-09 and 2020-12:

Class A

package test;

public sealed class A permits B { }

Class B

package test;
import java.io.Serializable;

public final class B extends A implements Serializable  { }

However, the eclipse compiler is giving me a compiler error in class B:

The type B extending a sealed class Serializable should be a permitted subtype of Serializable

This seems odd, as Serializable isn't even a sealed class. I find nothing about that in JEP-360. Removing "implements Serializable" resolves that error.

Is that a bug in the Eclipse compiler?


Solution

  • In case someone else is reading this:

    My bug report has been fixed for Java 16.