I am getting the following error:
Bound mismatch: The generic method constructPage(WebDriver, int, Class) of type
Page is not applicab
The problem is that HomePage is a Page and not a Page. The login method would return a Page from its generic signature.
You must make the generic parameter of HomePage related to itself, not SecuredPage. This will resolve the compiler error. Keep SecuredPage generic, but make sure its bound extends SecuredPage. Then assign HomePage itself for the generic parameter T in HomePage.
class SecuredPage> extends Page {
...
}
class HomePage extends SecuredPage {
...
}