Commit 2e290f0a authored by Ralf Habacker's avatar Ralf Habacker

Fix 'Wrong namespace assignment of imported base classes with java class import'

In case a referenced base class specified by an import statement is not
found in the file system, use the namespace from the import statement
to avoid placing it in the top level name space.

A java test file is added.

BUG:386742
FIXED-IN:2.23.80 (KDE Applications 17.11.80)
parent c576d4e4
package apackage;
import org.kde.BaseClass;
public class DerivedExtern extends BaseClass {
public DerivedExtern () {}
}
......@@ -241,6 +241,33 @@ UMLObject* JavaImport::resolveClass (const QString& className)
}
// now that we have the right package, the class should be findable
return findObject(baseClassName, current);
// imported class is specified but seems to be external
} else if (import.endsWith(baseClassName)) {
// we need to set the package for the class that will be resolved
// start at the root package
UMLPackage *parent = 0;
UMLPackage *current = 0;
for (QStringList::Iterator it = split.begin(); it != split.end(); ++it) {
QString name = (*it);
UMLObject *ns = Import_Utils::createUMLObject(UMLObject::ot_Package,
name, parent,
QString(), QString(),
true, true);
current = ns->asUMLPackage();
parent = current;
} // for
if (isArray) {
// we have imported the type. For arrays we want to return
// the array type
return Import_Utils::createUMLObject(UMLObject::ot_Class, className, current,
QString(), QString(), true, true);
}
// now that we have the right package, the class should be findable
return Import_Utils::createUMLObject(UMLObject::ot_Class,
baseClassName, current,
QString(), QString(),
true, true);
} // if file exists
} // if import matches
} //foreach import
......
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