Summary: | java import : unable to import AzareusCore | ||
---|---|---|---|
Product: | [Applications] umbrello | Reporter: | JP Fournier <jfournier121> |
Component: | general | Assignee: | Umbrello Development Group <umbrello-devel> |
Status: | RESOLVED FIXED | ||
Severity: | crash | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Slackware | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: | patch to track files already parsed |
Description
JP Fournier
2006-08-06 18:29:50 UTC
Created attachment 17246 [details]
patch to track files already parsed
$ diff -c svn/kdesdk/umbrello/umbrello/codeimport/javaimport.cpp
kdesdk/umbrello/umbrello/codeimport/javaimport.cpp > trackAlreadyParsed.diff
- keep track of the files already parsed and don't reparse them over and over
again.
- Time to import test file was 1 minute instead of quasi-inifinte.
SVN commit 570457 by okellogg: Attachment 17246 [details] from JP Fournier adds logic to keep track of files already parsed to avoid gratuitous reparsing. JP, I've added you as co-author to the javaimport.h, hope that's okay :) BUG:131961 M +1 -0 ChangeLog M +12 -5 umbrello/codeimport/javaimport.cpp M +13 -0 umbrello/codeimport/javaimport.h --- branches/KDE/3.5/kdesdk/umbrello/ChangeLog #570456:570457 @@ -5,6 +5,7 @@ instead of public (131327) * Python code generation not independent of diagram view (131790) * Java import - method parameter types not resolved correctly (131825) +* Java import: unable to import AzareusCore (131961) Version 1.5.4 --- branches/KDE/3.5/kdesdk/umbrello/umbrello/codeimport/javaimport.cpp #570456:570457 @@ -38,6 +38,7 @@ } void JavaImport::initVars() { + m_parseDepth = 0; m_isStatic = false; } @@ -130,19 +131,18 @@ ///Spawn off an import of the specifed file void JavaImport::spawnImport( QString file ) { - static QStringList filesBeingParsed; // if the file is being parsed, don't bother // - if (filesBeingParsed.contains( file ) ) { + if (m_filesAlreadyParsed.contains( file ) ) { return; } if (QFile::exists(file)) { JavaImport importer; QStringList fileList; fileList.append( file ); - filesBeingParsed.append( file ); + m_filesAlreadyParsed.append( file ); importer.importFiles( fileList ); - filesBeingParsed.remove( file ); + } } @@ -233,8 +233,15 @@ // public for member vars and methods m_defaultCurrentAccess = Uml::Visibility::Implementation; m_currentAccess = m_defaultCurrentAccess; - + m_parseDepth++; NativeImportBase::parseFile(filename); + m_parseDepth--; + if ( m_parseDepth <= 0 ) { + // if the user decides to clear things out and reparse, we need + // to honour the request, so reset things for next time. + m_filesAlreadyParsed.clear(); + m_parseDepth = 0; + } } --- branches/KDE/3.5/kdesdk/umbrello/umbrello/codeimport/javaimport.h #570456:570457 @@ -18,6 +18,7 @@ /** * Java code import * @author Oliver Kellogg + * @author JP Fournier * Bugs and comments to uml-devel@lists.sf.net or http://bugs.kde.org */ class JavaImport : public NativeImportBase { @@ -86,6 +87,18 @@ QStringList m_imports; /** + * Keep track of the files we have already parsed so we don't + * reparse the same ones over and over again. + */ + QStringList m_filesAlreadyParsed; + + /** + * Keep track of the parses so that the filesAlreadyParsed + * can be reset when we're done. + */ + int m_parseDepth; + + /** * The current visibility for when the visibility is absent */ Uml::Visibility m_defaultCurrentAccess; |