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.
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; }
Those 2 types are incompatible. Please go to options and turn off this warning if you don't want to see it.
Oh, I see. Sorry for disturbing.
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).