Commit c3ddf333 authored by Dimitri van Heesch's avatar Dimitri van Heesch

Bug 583958 - Class diagrams and class hierarchy don't work for java generic classes

Bug 631675 - Java inheritance of instantiated generics not recognized.
parent 7d9d4320
...@@ -249,7 +249,7 @@ void ClassDefImpl::init(const char *defFileName, const char *name, ...@@ -249,7 +249,7 @@ void ClassDefImpl::init(const char *defFileName, const char *name,
{ {
isLocal=FALSE; 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; isAnonymous = QCString(name).find('@')!=-1;
} }
......
...@@ -1347,11 +1347,12 @@ static void addClassToContext(EntryNav *rootNav) ...@@ -1347,11 +1347,12 @@ static void addClassToContext(EntryNav *rootNav)
cd->insertUsedFile(fd); cd->insertUsedFile(fd);
// add class to the list // 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); Doxygen::classSDict->append(fullName,cd);
if (cd->isGeneric()) // generics are also stored in a separate dictionary for fast lookup of instantions 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); Doxygen::genericsDict->insert(fullName,cd);
} }
} }
...@@ -4113,7 +4114,9 @@ static ClassDef *findClassWithinClassContext(Definition *context,ClassDef *cd,co ...@@ -4113,7 +4114,9 @@ static ClassDef *findClassWithinClassContext(Definition *context,ClassDef *cd,co
{ {
result = getClass(name); 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); result = Doxygen::genericsDict->find(name);
} }
...@@ -4638,34 +4641,32 @@ static bool findClassRelation( ...@@ -4638,34 +4641,32 @@ static bool findClassRelation(
int i=baseClassName.find('<'); int i=baseClassName.find('<');
int si=baseClassName.findRev("::",i==-1 ? baseClassName.length() : i); int si=baseClassName.findRev("::",i==-1 ? baseClassName.length() : i);
if (si==-1) si=0; 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) if (baseClass==0 && i!=-1)
// base class has template specifiers // base class has template specifiers
{ {
if (root->lang == SrcLangExt_CSharp) // TODO: here we should try to find the correct template specialization
{ // but for now, we only look for the unspecializated base class.
baseClass = Doxygen::genericsDict->find(baseClassName); int e=findEndOfTemplate(baseClassName,i+1);
} //printf("baseClass==0 i=%d e=%d\n",i,e);
else if (e!=-1) // end of template was found at e
{ {
// TODO: here we should try to find the correct template specialization templSpec=removeRedundantWhiteSpace(baseClassName.mid(i,e-i));
// but for now, we only look for the unspecializated base class. baseClassName=baseClassName.left(i)+baseClassName.right(baseClassName.length()-e);
int e=findEndOfTemplate(baseClassName,i+1); baseClass=getResolvedClass(explicitGlobalScope ? Doxygen::globalScope : context,
//printf("baseClass==0 i=%d e=%d\n",i,e); cd->getFileDef(),
if (e!=-1) // end of template was found at e baseClassName,
{ &baseClassTypeDef,
templSpec=removeRedundantWhiteSpace(baseClassName.mid(i,e-i)); 0, //&templSpec,
baseClassName=baseClassName.left(i)+baseClassName.right(baseClassName.length()-e); mode==Undocumented,
baseClass=getResolvedClass(explicitGlobalScope ? Doxygen::globalScope : context, TRUE
cd->getFileDef(), );
baseClassName, //printf("baseClass=%p -> baseClass=%s templSpec=%s\n",
&baseClassTypeDef, // baseClass,baseClassName.data(),templSpec.data());
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 else if (baseClass && !templSpec.isEmpty()) // we have a known class, but also
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment