I'm using a library - HtmlUnit - and I just updated from version 2.4 to version 2.5. When I compile my code against 2.5, I'm getting a strange object "cannot be dereferenced" error message that I'm not familiar with. Moreover, I don't understand why it works when I write the code in two lines, but fails when I do it as a one-liner .
Here is the code:
//this compiles fine
HtmlInput usernameInput = form.getInputByName("username");
usernameInput.setValueAttribute(userName);
//this fails to compile
form.getInputByName("password").setValueAttribute(passWord);
This is the error message I get when I compile using ANT and Java 1.6:
[javac] E:\workspaces\europa\PortalTestSuite\src\com\carefirst\portal\test\controller\EAITest.java:32: com.gargoylesoftware.htmlunit.html.HtmlInput cannot be dereferenced
[javac] form.getInputByName("password").setValueAttribute(passWord);
[javac] ^
com.gargoylesoftware.htmlunit.html.HtmlInput cannot be dereferenced ? I've seen derefernce issues with Autoboxing, but not with objects. What does it mean in this context? And why does the code work one way and not the other?