| Summary: | Wrong warning with hint to make this ... access statically | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | LKWG82 <lkwg82> |
| Component: | Core | Assignee: | Jesper Moller <jesper> |
| Status: | VERIFIED INVALID | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | amj87.iitr, daniel_megert, lkwg82, markus.kell.r, srikanth_sankaran |
| Version: | 3.8 | ||
| Target Milestone: | 4.3 M6 | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | |||
Can you explain why you think the warning is wrong?
By#xpath(String) is a static method, so
By.id("profil_header").xpath("/h1")
is equivalent to
By.xpath("/h1")
, unless the execution of By#id(String) changes some global state, which would be quite bad style and is not documented.
Moving to JDT Core to close.
Agree with Markus. I intend to close as invalid.
By.id("profil_header") returns a new object, from which the static function xpath("/h1") is being invoked. This warning is indeed meant to catch cases such as these.
Agreed, closing as invalid.
FWIW, the intended WebDriver usage would be:
webdriver.findElement(By.id("profil_header")).findElement(By.xpath("/h1")).getText()
|
Build Identifier: 20110916-0149 static fluent interface: webdriver.findElement(By.id("profil_header").xpath("/h1")).getText() -> By.id("profil_header").xpath("/h1"); see api http://selenium.googlecode.com/svn/trunk/docs/api/java/org/openqa/selenium/By.html Reproducible: Always Steps to Reproduce: 1. import org.openqa.selenium.By; public class Bug{ public static void main(String[] args){ By.id("profil_header").xpath("/h1"); } } 2. see the warning