Community
Participate
Working Groups
Build Identifier: I20091217-0819 The following code reports "myList cannot be resolved or is not a field" whereas it should report something like "length is not a field of type ArrayList". All of myList.length is underlined, but probably just the .length part should be underlined: ArrayList<String> myList = new ArrayList<String>(); int len = myList.length; It is a much more confusing message when myList *is* actually a field, and you thought you were using an array but you're actually using an ArrayList... Reproducible: Always
I cannot reproduce this using 3.5, 3.6 M4 or I20100223-0800. In all those builds I get the following expected error reported: "myList.length cannot be resolved or is not a field"
Reproduced using I20100307-2000
Created attachment 161335 [details] Proposed fix + regression test Patch under testing.
If testing is successful, I will target 3.6M6.
Created attachment 161350 [details] Proposed fix + updated regression tests Updated existing regression tests.
Created attachment 161352 [details] Proposed fix + updated regression tests Same patch with copyright updates.
Targetting M7 as it needs more testing.
Created attachment 161359 [details] Proposed fix + updated regression tests + new regression test A NPE was possible with previous patch. This should fix it. More testing is expected.
Released for 3.6M6. Updated existing regression tests.
Verified for 3.6M6 using I20100309-0809 build.
Actually, I was not able to reproduce this either. I observe the same behavior as Dani per comment#1 which was reasonable in itself. Further more all the existing regression tests that have been modified as a part of this patch also indicate that the old message was reasonable. That said, the new message and range look correct too. Verified for 3.6M6 using build I20100309-0809
The "problem" was that the compiler is reporting the error on the second part of the qualified name, but the problem message and positions don't properly reflect this. The change is minor and doesn't remove anything in the compiler. The problem message and positions are just more narrow to report the problem against the appropriate part of the qualified name. We had such changes in the past for other cases and we decided to fix them on a case-by-case basis.