Source:
public AppiumFieldDecorator(SearchContext context, TimeOutDuration duration) { this.originalDriver = unpackWebDriverFromSearchContext(context); HasSessionDetails hasSessionDetails = ofNullable(this.originalDriver).map(webDriver -> { if (!HasSessionDetails.class.isAssignableFrom(originalDriver.getClass())) { return null; } return HasSessionDetails.class.cast(originalDriver); }).orElse(null); if (hasSessionDetails == null) { platform = null; automation = null; } else { platform = hasSessionDetails.getPlatformName(); automation = hasSessionDetails.getAutomationName(); } this.duration = duration; defaultElementFieldDecoracor = new DefaultFieldDecorator( new AppiumElementLocatorFactory(context, duration, new DefaultElementByBuilder(platform, automation))) { @Override protected WebElement proxyForLocator(ClassLoader ignored, ElementLocator locator) { return proxyForAnElement(locator); } @Override @SuppressWarnings("unchecked") protected List<WebElement> proxyForListLocator(ClassLoader ignored, ElementLocator locator) { ElementListInterceptor elementInterceptor = new ElementListInterceptor(locator); return getEnhancedProxy(ArrayList.class, elementInterceptor); } @Override protected boolean isDecoratableList(Field field) { if (!List.class.isAssignableFrom(field.getType())) { return false; } Type genericType = field.getGenericType(); if (!(genericType instanceof ParameterizedType)) { return false; } Type listType = ((ParameterizedType) genericType).getActualTypeArguments()[0]; for (Class<? extends WebElement> webElementClass : availableElementClasses) { if (webElementClass.equals(listType)) { return true; } } return false; } }; widgetLocatorFactory = new AppiumElementLocatorFactory(context, duration, new WidgetByBuilder(platform, automation)); }

Target:
public AppiumFieldDecorator(SearchContext context, TimeOutDuration duration) { this.webDriver = unpackWebDriverFromSearchContext(context); HasSessionDetails hasSessionDetails = ofNullable(this.webDriver).map(webDriver -> { if (!HasSessionDetails.class.isAssignableFrom(webDriver.getClass())) { return null; } return HasSessionDetails.class.cast(webDriver); }).orElse(null); if (hasSessionDetails == null) { platform = null; automation = null; } else { platform = hasSessionDetails.getPlatformName(); automation = hasSessionDetails.getAutomationName(); } this.duration = duration; defaultElementFieldDecoracor = new DefaultFieldDecorator( new AppiumElementLocatorFactory(context, duration, new DefaultElementByBuilder(platform, automation))) { @Override protected WebElement proxyForLocator(ClassLoader ignored, ElementLocator locator) { return proxyForAnElement(locator); } @Override @SuppressWarnings("unchecked") protected List<WebElement> proxyForListLocator(ClassLoader ignored, ElementLocator locator) { ElementListInterceptor elementInterceptor = new ElementListInterceptor(locator); return getEnhancedProxy(ArrayList.class, elementInterceptor); } @Override protected boolean isDecoratableList(Field field) { if (!List.class.isAssignableFrom(field.getType())) { return false; } Type genericType = field.getGenericType(); if (!(genericType instanceof ParameterizedType)) { return false; } Type listType = ((ParameterizedType) genericType).getActualTypeArguments()[0]; for (Class<? extends WebElement> webElementClass : availableElementClasses) { if (webElementClass.equals(listType)) { return true; } } return false; } }; widgetLocatorFactory = new AppiumElementLocatorFactory(context, duration, new WidgetByBuilder(platform, automation)); }