Skip to content

Commit

Permalink
Bug 583958 - Class diagrams and class hierarchy don't work for java g…
Browse files Browse the repository at this point in the history
…eneric classes

Bug 631675 - Java inheritance of instantiated generics not recognized.
  • Loading branch information
Dimitri van Heesch committed Aug 14, 2014
1 parent 7d9d432 commit c3ddf33
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/classdef.cpp
Expand Up @@ -249,7 +249,7 @@ void ClassDefImpl::init(const char *defFileName, const char *name,
{
isLocal=FALSE;
}
isGeneric = lang==SrcLangExt_CSharp && QCString(name).find('<')!=-1;
isGeneric = (lang==SrcLangExt_CSharp || lang==SrcLangExt_Java) && QCString(name).find('<')!=-1;
isAnonymous = QCString(name).find('@')!=-1;
}

Expand Down
53 changes: 27 additions & 26 deletions src/doxygen.cpp
Expand Up @@ -1347,11 +1347,12 @@ static void addClassToContext(EntryNav *rootNav)
cd->insertUsedFile(fd);

// add class to the list
//printf("ClassDict.insert(%s)\n",resolveDefines(fullName).data());
//printf("ClassDict.insert(%s)\n",fullName.data());
Doxygen::classSDict->append(fullName,cd);

if (cd->isGeneric()) // generics are also stored in a separate dictionary for fast lookup of instantions
{
//printf("inserting generic '%s' cd=%p\n",fullName.data(),cd);
Doxygen::genericsDict->insert(fullName,cd);
}
}
Expand Down Expand Up @@ -4113,7 +4114,9 @@ static ClassDef *findClassWithinClassContext(Definition *context,ClassDef *cd,co
{
result = getClass(name);
}
if (result==0 && cd && cd->getLanguage()==SrcLangExt_CSharp && name.find('<')!=-1)
if (result==0 && cd &&
(cd->getLanguage()==SrcLangExt_CSharp || cd->getLanguage()==SrcLangExt_Java) &&
name.find('<')!=-1)
{
result = Doxygen::genericsDict->find(name);
}
Expand Down Expand Up @@ -4638,34 +4641,32 @@ static bool findClassRelation(
int i=baseClassName.find('<');
int si=baseClassName.findRev("::",i==-1 ? baseClassName.length() : i);
if (si==-1) si=0;
if (baseClass==0 && (root->lang==SrcLangExt_CSharp || root->lang==SrcLangExt_Java))
{
baseClass = Doxygen::genericsDict->find(baseClassName);
//printf("looking for '%s' result=%p\n",baseClassName.data(),baseClass);
}
if (baseClass==0 && i!=-1)
// base class has template specifiers
{
if (root->lang == SrcLangExt_CSharp)
{
baseClass = Doxygen::genericsDict->find(baseClassName);
}
else
// TODO: here we should try to find the correct template specialization
// but for now, we only look for the unspecializated base class.
int e=findEndOfTemplate(baseClassName,i+1);
//printf("baseClass==0 i=%d e=%d\n",i,e);
if (e!=-1) // end of template was found at e
{
// TODO: here we should try to find the correct template specialization
// but for now, we only look for the unspecializated base class.
int e=findEndOfTemplate(baseClassName,i+1);
//printf("baseClass==0 i=%d e=%d\n",i,e);
if (e!=-1) // end of template was found at e
{
templSpec=removeRedundantWhiteSpace(baseClassName.mid(i,e-i));
baseClassName=baseClassName.left(i)+baseClassName.right(baseClassName.length()-e);
baseClass=getResolvedClass(explicitGlobalScope ? Doxygen::globalScope : context,
cd->getFileDef(),
baseClassName,
&baseClassTypeDef,
0, //&templSpec,
mode==Undocumented,
TRUE
);
//printf("baseClass=%p -> baseClass=%s templSpec=%s\n",
// baseClass,baseClassName.data(),templSpec.data());
}
templSpec=removeRedundantWhiteSpace(baseClassName.mid(i,e-i));
baseClassName=baseClassName.left(i)+baseClassName.right(baseClassName.length()-e);
baseClass=getResolvedClass(explicitGlobalScope ? Doxygen::globalScope : context,
cd->getFileDef(),
baseClassName,
&baseClassTypeDef,
0, //&templSpec,
mode==Undocumented,
TRUE
);
//printf("baseClass=%p -> baseClass=%s templSpec=%s\n",
// baseClass,baseClassName.data(),templSpec.data());
}
}
else if (baseClass && !templSpec.isEmpty()) // we have a known class, but also
Expand Down

0 comments on commit c3ddf33

Please sign in to comment.