In Java, can I somehow force a class that extends an abstract class to implement its constructor with a Object as a parameter?
Something like
public
Probably there it's not possible at compile time, but you can use reflection to check at run time if the desired constructor was declared:
public abstract class Points {
protected Points() {
try {
Constructor extends Points> constructor =
getClass().getDeclaredConstructor(Object.class);
if (!Modifier.isPublic(constructor.getModifiers()))
throw new NoSuchMethodError("constructor not public");
} catch (SecurityException ex) {
throw new RuntimeException(ex);
} catch (NoSuchMethodException ex) {
throw (NoSuchMethodError) new NoSuchMethodError().initCause(ex);
}
}
}