This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 183367 - Inappropriate warning on Collection.remove(int)
Summary: Inappropriate warning on Collection.remove(int)
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 6.x
Hardware: PC Linux
: P4 normal (vote)
Assignee: Jan Lahoda
URL:
Keywords:
: 192791 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-04-01 16:32 UTC by Jesse Glick
Modified: 2010-12-09 06:17 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2010-04-01 16:32:19 UTC
100331.

List<Whatever> l = ...;
l.remove(0); // delete first element

=>

"Given object cannot contain instances of int (expected Whatever)"

which is nonsense since this method overload is remove(int), not remove(Object).
Comment 1 Jesse Glick 2010-07-29 14:17:49 UTC
Example in maven/src/org/netbeans/modules/maven/ActionProviderImpl.java:

                if (maps.getActions().size() > 10) {
                    maps.getActions().remove(0);
                }
Comment 2 Jesse Glick 2010-12-06 16:03:01 UTC
*** Bug 192791 has been marked as a duplicate of this bug. ***
Comment 3 matthies 2010-12-07 14:31:29 UTC
It doesn't happen with

    List<String> list = null;
    list.remove(0);


(any more?), but it happens with e.g.


    List<String> list = null;
    list.subList(0, 0).remove(0);
Comment 4 Jan Lahoda 2010-12-08 15:30:26 UTC
http://hg.netbeans.org/jet-main/rev/001b95f5d29d
Comment 5 Quality Engineering 2010-12-09 06:17:23 UTC
Integrated into 'main-golden', will be available in build *201012090001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/001b95f5d29d
User: Jan Lahoda <jlahoda@netbeans.org>
Log: #183367: $l{java.util.Collection}.remove($o{java.lang.Object}) should not match l.subList(0, 0).remove(0).