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

Summary: suspicious call hint on List.remove(int)
Product: java Reporter: devon_c_miller <devon_c_miller>
Component: HintsAssignee: Jan Lahoda <jlahoda>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P3    
Version: 7.0   
Hardware: PC   
OS: Windows XP   
Issue Type: DEFECT Exception Reporter:

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.