A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pmd/pmd/issues/4020 below:

[java] ImmutableField reports fields annotated with @FindBy and @FindBys (Selenium) · Issue #4020 · pmd/pmd · GitHub

Affects PMD Version:
6.46.0

Rule:
ImmutableField
https://pmd.github.io/pmd-6.46.0/pmd_rules_java_design.html#immutablefield

Description:
Fields annotated with Selenium's @findby or @FindBys are reported as "could be final", but they must not be final in order to be set by reflection.

Code Sample demonstrating the issue:

public class SomePage {
    @org.openqa.selenium.support.FindBy(id = "id1")
    private WebElement field1;

    @org.openqa.selenium.support.FindBys(value = {@org.openqa.selenium.support.FindByFindBy(id = "id2"), 
                                                                               @org.openqa.selenium.support.FindBy(xpath = "//div/table")})
    private WebElement table;
}

Expected outcome:
PMD reports a violation for fields field1 and table but that's wrong. That's a false positive.

Running PMD through:
Eclipse


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4