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 51775 - Navigator does not handle generics
Summary: Navigator does not handle generics
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Navigation (show other bugs)
Version: 4.x
Hardware: PC Windows XP
: P3 blocker (vote)
Assignee: David Simonek
URL:
Keywords:
Depends on: 50260 53742
Blocks:
  Show dependency tree
 
Reported: 2004-11-23 19:46 UTC by manawiz
Modified: 2005-08-12 13:11 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
A patch to the JDK1.5 tooltip problem. (5.81 KB, application/octet-stream)
2004-11-29 14:47 UTC, Jan Lahoda
Details
Patch improving behaviour for the "List<? extends E>" like generics. (3.69 KB, patch)
2004-12-23 16:07 UTC, Jan Lahoda
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description manawiz 2004-11-23 19:46:20 UTC
The Navigator does not handle generics properly,
either as argument types or return types.  E.g.,

List<Integer> foo(List<Float> bar) { ... }

misinterprets both types in pop-ups and lists.
Comment 1 _ tboudreau 2004-11-25 07:11:20 UTC
Correct that it doesn't handle them - but I'd welcome suggestions on how it *should* 
handle them.  Do you have any suggestions?
Comment 2 manawiz 2004-11-25 19:35:41 UTC
Here is one suggestion:  Navigator should display generics properly. 

In both the list displays and the pop-up displays, it does not show
generic types properly.  E.g., Set<Integer> is sometimes shown as
"Set", sometimes shows as "Integer>", sometimes omitted entirely,
depending on view and position.  Problems occur when generics are used
as paramter types, return types, and class types, at least. 
Inheritance Structure view seems to show generics properly for the
superclass (extends), but I haven't seen any other case that works. 
In Inheritance Structure view the class itself is not right (e.g.,
  public class ObjectTreeSetHashMap<K, V>
omits the <K, V> in the class type.

There may be other problems as well, but I haven't figured out how to
use other Navigator functionality yet (e.g., drag and drop
reorganizaiton or method overriding, both of which were "advertised"
features in the descripion).

Comment 3 _ tboudreau 2004-11-27 03:30:40 UTC
> drag and drop reorganizaiton or method overriding

In the method list, right click a node and choose Sort by Order (I think that was the menu 
item title).  Then you'll be able to reorder methods/fields/etc via drag and drop (it would 
be meaningless in an alphabetized list).

Method overriding works if the filter is set to include inherited elements or you're in the 
inheritance tree, but the override method implementation is pretty prototypey and should 
be rewritten - it won't handle inner classes correctly yet.
Comment 4 manawiz 2004-11-27 06:19:18 UTC
I cannot get any context menus.  I've tried every view and every
filter, and right-cliked everywhere on and off nodes.  The only
context menu I get is on the Navigator menu title bar and that menu
only contains 3 basic window operations.

How can I find the context menus?  Do they providing the sorting and
the  method overriding?

FYI, I'm now in 4.0 RC1.  The only Navigator functionality I can
access is the selection of nodes, which warps me to the definition in
the file and shows the in-class callers/users.

There are distinct icons on the different nodes.  Are these documented
anywhere?  When Navigator first installed there was a text file that
came up with some explanations -- is there any way to find it again to
see how to interpret the icons and/or access the functionality I can't
find?
Comment 5 Jan Lahoda 2004-11-29 14:46:35 UTC
Hello,
   I just installed the navigator+javagator modules, and have seen 
problems regarding the JDK1.5 support: tooltip for the methods with
generics return value and/or parameters is broken. I am attaching a
patch that hopefully fixes this problem. Part of the archive is also a
test class to partially test this functionality.
Comment 6 Jan Lahoda 2004-11-29 14:47:10 UTC
Created attachment 19068 [details]
A patch to the JDK1.5 tooltip problem.
Comment 7 David Simonek 2004-12-15 17:27:09 UTC
Moving to objectbrowser/navigator.
Comment 8 David Simonek 2004-12-17 12:12:36 UTC
Patch integrated, thanks alot! So now generics work in tooltips, what
is left is better generics support in the lists and trees.

However generics like List<? extends E> still could be displayed
better, will need further effort.
Comment 9 Jan Lahoda 2004-12-23 16:04:44 UTC
I have hopefully improved the behaviour for "List<? extends E>" like
generics. Patch attached.

The methods JUtils.convertToSimpleName and JUtils.separateClassName
are package private, so they can be tested by the test. I think that
they should remain package private, if it is not a big problem.

The HTML coloring could be a bit improved in the future for the
"List<? extends E>" like generics (highlighting "extends" and "super").
Comment 10 Jan Lahoda 2004-12-23 16:07:28 UTC
Created attachment 19404 [details]
Patch improving behaviour for the "List<? extends E>" like generics.
Comment 11 David Simonek 2005-01-20 13:52:12 UTC
Patch applied and verified that it works correctly, however for right
end user effect, there needs to be javacore bug 53742 fixed first.
Comment 12 David Simonek 2005-01-20 15:14:20 UTC
fixed in main trunk

Checking in src/org/netbeans/modules/javanavigation/JUtils.java;
new revision: 1.12; previous revision: 1.11

test/unit/src/org/netbeans/modules/javanavigation/JUtilsTest.java;
new revision: 1.2; previous revision: 1.1
Comment 13 David Simonek 2005-01-21 14:28:34 UTC
Resolving as fixed, just note that end user will see correct results
only after 50260 will be fixed.