While looking at the Selenium source code, I noticed the following in PageFactory:
public static <T> T initElements(WebDriver driver, Class<T> pageClassToProxy) { T page = instantiatePage(driver, pageClassToProxy); initElements(driver, page); return page; } public static void initElements(WebDriver driver, Object page) { final WebDriver driverRef = driver; initElements(new DefaultElementLocatorFactory(driverRef), page); }
What is the advantage of the next line?
final WebDriver driverRef = driver;
Doesn't it make sense to just make the final parameter, and then pass this to the next method without declaring a new link?
Scott source share