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 145680 - Wrong hint in openide.loaders/**/MenuBar.java
Summary: Wrong hint in openide.loaders/**/MenuBar.java
Status: RESOLVED INVALID
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 6.x
Hardware: All All
: P4 blocker (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-30 13:01 UTC by Jaroslav Tulach
Modified: 2016-05-25 06:16 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 Jaroslav Tulach 2008-08-30 13:01:22 UTC
In the following code, the hint says "equals on incompatible types", which seems wrong to me:

        protected Object createInstance(InstanceCookie[] cookies)
                throws IOException, ClassNotFoundException {
            final LinkedList<Object> ll = new LinkedList<Object>();
            allInstances(cookies, ll);

            final MenuBar mb = MenuBar.this;
            
            if (ll.equals(Arrays.asList(mb.getComponents()))) {
                return mb;
            }
Comment 1 Jan Becicka 2008-09-05 14:18:06 UTC
Those 2 types are incompatible. Please go to options and turn off this warning if you don't want to see it.
Comment 2 Jaroslav Tulach 2008-09-05 20:41:54 UTC
Oh, I see. Sorry for disturbing.
Comment 3 Jan Lahoda 2008-09-08 09:21:14 UTC
Hm, I think that the hint is too picky in this case, and that it is not correct: the hint should appear only if the
result of the invocation of the equals method is "guaranteed" to be false (which is not true in this case). For
a.equals(b), the hint checks whether either type(a) can be cast to type(b) or vice versa, which seems to be overly
strict. We either should check that erasure(type(a)) is castable to erasure(type(b)) (or vice versa), or check
castability of the erasures *and* the "corresponding" type parameters (which likely would be quite tricky).