AbstractQName can either be resolved or one of the two UnresolvedQName
variants. Make sure compiler knows this by sealing them.
Change-Id: I2c3d866777bb9a1f5ab15d65ba81d132942ffed7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
* Abstract superclass for sharing QName references, which can either be resolved {@link QName}s or unresolved
* {@link UnresolvedQName.Unqualified} and {@link UnresolvedQName.Qualified}s.
*/
-// FIXME: sealed to allow QName and UnresolvedQName only when we have JDK17+
@NonNullByDefault
-public abstract class AbstractQName implements Identifier, WritableObject {
+public abstract sealed class AbstractQName implements Identifier, WritableObject permits QName, UnresolvedQName {
private static final long serialVersionUID = 1L;
private final String localName;
* <li>{@link Qualified}, which also holds a string prefix available via {@link Qualified#getPrefix()}.</li>
* </ol>
*/
-// FIXME: sealed to allow Qualified and Unqualified only when we have JDK17+
@NonNullByDefault
-public abstract class UnresolvedQName extends AbstractQName {
+public abstract sealed class UnresolvedQName extends AbstractQName {
/**
* An unresolved, qualified {@link QName}. It is guaranteed to hold a valid {@link #getLocalName()} bound to a
* namespace identified through a prefix string, but remains unresolved. A resolved {@link QName} can be obtained