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 196606 - suspicious call hint on List.remove(int)
Summary: suspicious call hint on List.remove(int)
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 7.0
Hardware: PC Windows XP
: P3 normal (vote)
Assignee: Jan Lahoda
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-11 19:23 UTC by devon_c_miller
Modified: 2011-03-18 14:51 UTC (History)
0 users

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 devon_c_miller 2011-03-11 19:23:43 UTC
build dev 201103070000

This message:

     Suspicious call to java.util.Collection.remove:
     Expected type Integer, actual type Object

is presented for the call to super.remove in this code

    public class MyArrayList extends ArrayList<Integer> {
        @Override
        public boolean remove(Object o){
            return super.remove(o);
        }
    }

This is probably related to bug#181930 and bug#183367.
Comment 1 Quality Engineering 2011-03-18 09:46:57 UTC
Integrated into 'main-golden', will be available in build *201103180400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/7ab3f2d6f579
User: Jan Lahoda <jlahoda@netbeans.org>
Log: #196606: do not warn about suspicious calls to Collection.remove inside method that overrides the method itself.
Comment 2 Jan Lahoda 2011-03-18 14:51:48 UTC
Slightly different from the other bugs: the other bugs were bugs in the matching algorithm, where the expression were incorrectly identified as an occurrence of a pattern like $list.remove($obj) (where $list instanceof java.util.List, $obj instanceof java.lang.Object). In this case, correct occurrence is found, but as there is nothing the user can do about it, the warning should probably be auto-suppressed, which is what I tried in the above patch.