@@ -105,14 +105,14 @@ protected static String getLocalAnchor(ProgramElementDoc doc)
105105
106106 protected static String getReturnTypes (MethodDoc doc )
107107 {
108- String ret = importedName (doc .returnType ().toString ());
108+ String ret = nameInPDE (doc .returnType ().toString ());
109109 if (doc .containingClass () != null )
110110 {
111111 for (MethodDoc m : doc .containingClass ().methods ())
112112 {
113113 if ( m .name ().equals (doc .name ()) && m .returnType () != doc .returnType () )
114114 {
115- String name = getSimplifiedType ( importedName (m .returnType ().toString ()) );
115+ String name = getSimplifiedType ( nameInPDE (m .returnType ().toString ()) );
116116 if ( ! ret .contains ( name ) )
117117 { // add return type name if it's not already included
118118 ret += ", " + name ;
@@ -479,18 +479,24 @@ protected static ArrayList<HashMap<String, String>> getSyntax(MethodDoc doc, Str
479479 return ret ;
480480 }
481481
482- protected static String importedName (String fullName )
482+ private static String removePackage (String name )
483+ { // keep everything after the last dot
484+ if ( name .contains ("." ) )
485+ { return name .substring ( name .lastIndexOf ("." ) + 1 ); }
486+ return name ;
487+ }
488+
489+ private static String nameInPDE (String fullName )
483490 {
484- // keep everything after the last dot
485- // note that this doesn't properly handle generic types
486- if ( fullName .contains ("." ) )
487- { fullName = fullName .substring ( fullName .lastIndexOf ("." ) + 1 ); }
488- // for the moment, just strip angle brackets from names
489- if ( fullName .charAt (0 ) == '<' )
490- { fullName = fullName .substring ( 1 ); }
491- if ( fullName .endsWith (">" ) )
492- { fullName = fullName .substring ( 0 , fullName .length () - 1 ); }
493- return fullName ;
491+ if ( fullName .contains ("<" ) && fullName .endsWith (">" ) )
492+ { // if this type uses Java generics
493+ String parts [] = fullName .split ("<" );
494+ String generic = removePackage ( parts [0 ] );
495+ String specialization = removePackage ( parts [1 ] );
496+ specialization = specialization .substring ( 0 , specialization .length () - 1 );
497+ return generic + "<" + specialization + ">" ;
498+ }
499+ return removePackage ( fullName );
494500 }
495501
496502 protected static String getUsage (ProgramElementDoc doc ){
@@ -619,7 +625,7 @@ protected static void removeDuplicateParameters(ArrayList<HashMap<String, String
619625 protected static ArrayList <HashMap <String , String >> parseParameters (ExecutableMemberDoc doc ){
620626 ArrayList <HashMap <String , String >> ret = new ArrayList <HashMap <String ,String >>();
621627 for ( Parameter param : doc .parameters ()){
622- String type = getSimplifiedType ( importedName (param .type ().toString ()) ).concat (": " );
628+ String type = getSimplifiedType ( nameInPDE (param .type ().toString ()) ).concat (": " );
623629 String name = param .name ();
624630 String desc = "" ;
625631
0 commit comments