Closed
Description
I think the below should be allowed.
class A {
protected constructor() {
}
}
class B extends A {
static create() {
new B(); // ERROR, but should not error.
}
}
I wanted to override a static factory and customise it a bit. But it seems like I wasn't allowed to do it.
And my motivation is that private constructors are accessible on a class's static methods.
class A {
static create() {
new this();
}
protected constructor() {
}
}
And a natural extension of the private case is to allow protected constructors on subclasses's static methods.