Fix for SourceForge Bug #1278
* Modify test-suite to test Java directors with multi-level namespaces. * Path java module to correctly generate method descriptors when multilevel namespaces are used.
This commit is contained in:
parent
ac75e4ae53
commit
7ff0dfe426
4 changed files with 70 additions and 52 deletions
7
.gitignore
vendored
Normal file
7
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
# Compiled Source
|
||||||
|
*.o
|
||||||
|
*.class
|
||||||
|
|
||||||
|
# Local PCRE
|
||||||
|
prce
|
||||||
|
*.gz
|
||||||
|
|
@ -8,28 +8,31 @@ SWIG_JAVABODY_TYPEWRAPPER(public, public, public, SWIGTYPE)
|
||||||
%{
|
%{
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace Bar
|
namespace TopLevel
|
||||||
{
|
{
|
||||||
class FooBar {
|
namespace Bar
|
||||||
public:
|
{
|
||||||
FooBar() {}
|
class FooBar {
|
||||||
FooBar(const FooBar&) {}
|
public:
|
||||||
virtual ~FooBar() {}
|
FooBar() {}
|
||||||
|
FooBar(const FooBar&) {}
|
||||||
|
virtual ~FooBar() {}
|
||||||
|
|
||||||
std::string FooBarDo() { return "Bar::Foo2::Foo2Bar()"; }
|
std::string FooBarDo() { return "Bar::Foo2::Foo2Bar()"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class Foo {
|
class Foo {
|
||||||
public:
|
public:
|
||||||
virtual ~Foo() {}
|
virtual ~Foo() {}
|
||||||
virtual std::string ping() { return "Bar::Foo::ping()"; }
|
virtual std::string ping() { return "Bar::Foo::ping()"; }
|
||||||
virtual std::string pong() { return "Bar::Foo::pong();" + ping(); }
|
virtual std::string pong() { return "Bar::Foo::pong();" + ping(); }
|
||||||
virtual std::string fooBar(FooBar* fb) { return fb->FooBarDo(); }
|
virtual std::string fooBar(FooBar* fb) { return fb->FooBarDo(); }
|
||||||
virtual Foo makeFoo() { return Foo(); }
|
virtual Foo makeFoo() { return Foo(); }
|
||||||
virtual FooBar makeFooBar() { return FooBar(); }
|
virtual FooBar makeFooBar() { return FooBar(); }
|
||||||
|
|
||||||
static Foo* get_self(Foo *self_) {return self_;}
|
static Foo* get_self(Foo *self_) {return self_;}
|
||||||
};
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
@ -38,36 +41,39 @@ namespace Bar
|
||||||
|
|
||||||
// nspace feature only supported by these languages
|
// nspace feature only supported by these languages
|
||||||
#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGD)
|
#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGD)
|
||||||
%nspace Bar::Foo;
|
%nspace TopLevel::Bar::Foo;
|
||||||
%nspace Bar::FooBar;
|
%nspace TopLevel::Bar::FooBar;
|
||||||
#else
|
#else
|
||||||
#warning nspace feature not yet supported in this target language
|
#warning nspace feature not yet supported in this target language
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
%feature("director") Bar::Foo;
|
%feature("director") TopLevel::Bar::Foo;
|
||||||
|
|
||||||
namespace Bar
|
namespace TopLevel
|
||||||
{
|
{
|
||||||
class FooBar {
|
namespace Bar
|
||||||
public:
|
|
||||||
FooBar();
|
|
||||||
FooBar(const FooBar&);
|
|
||||||
virtual ~FooBar();
|
|
||||||
|
|
||||||
std::string FooBarDo();
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
class Foo
|
|
||||||
{
|
{
|
||||||
public:
|
class FooBar {
|
||||||
virtual ~Foo();
|
public:
|
||||||
virtual std::string ping();
|
FooBar();
|
||||||
virtual std::string pong();
|
FooBar(const FooBar&);
|
||||||
virtual std::string fooBar(FooBar* fb);
|
virtual ~FooBar();
|
||||||
virtual Foo makeFoo();
|
|
||||||
virtual FooBar makeFooBar();
|
|
||||||
|
|
||||||
static Foo* get_self(Foo *self_);
|
std::string FooBarDo();
|
||||||
};
|
|
||||||
|
};
|
||||||
|
|
||||||
|
class Foo
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual ~Foo();
|
||||||
|
virtual std::string ping();
|
||||||
|
virtual std::string pong();
|
||||||
|
virtual std::string fooBar(FooBar* fb);
|
||||||
|
virtual Foo makeFoo();
|
||||||
|
virtual FooBar makeFooBar();
|
||||||
|
|
||||||
|
static Foo* get_self(Foo *self_);
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ public class director_nspace_runme {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class director_nspace_MyBarFoo extends director_nspacePackage.Bar.Foo {
|
class director_nspace_MyBarFoo extends director_nspacePackage.TopLevel.Bar.Foo {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String ping() {
|
public String ping() {
|
||||||
|
|
@ -32,17 +32,17 @@ class director_nspace_MyBarFoo extends director_nspacePackage.Bar.Foo {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String fooBar(director_nspacePackage.Bar.FooBar fooBar) {
|
public String fooBar(director_nspacePackage.TopLevel.Bar.FooBar fooBar) {
|
||||||
return fooBar.FooBarDo();
|
return fooBar.FooBarDo();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public director_nspacePackage.Bar.Foo makeFoo() {
|
public director_nspacePackage.TopLevel.Bar.Foo makeFoo() {
|
||||||
return new director_nspacePackage.Bar.Foo();
|
return new director_nspacePackage.TopLevel.Bar.Foo();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public director_nspacePackage.Bar.FooBar makeFooBar() {
|
public director_nspacePackage.TopLevel.Bar.FooBar makeFooBar() {
|
||||||
return new director_nspacePackage.Bar.FooBar();
|
return new director_nspacePackage.TopLevel.Bar.FooBar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4253,8 +4253,13 @@ public:
|
||||||
Wrapper *w = NewWrapper();
|
Wrapper *w = NewWrapper();
|
||||||
|
|
||||||
if (Len(package_path) > 0)
|
if (Len(package_path) > 0)
|
||||||
if (Len(getNSpace()) > 0)
|
if (Len(getNSpace()) > 0) {
|
||||||
internal_classname = NewStringf("%s/%s/%s", package_path, getNSpace(), classname);
|
internal_classname = NewStringf("%s/%s/%s", package_path, getNSpace(), classname);
|
||||||
|
|
||||||
|
// If the namespace is multiple levels, the result of getNSpace() will have inserted
|
||||||
|
// .'s to delimit namespaces, so we need to replace those with /'s
|
||||||
|
Replace(internal_classname, ".", "/", DOH_REPLACE_ANY);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
internal_classname = NewStringf("%s/%s", package_path, classname);
|
internal_classname = NewStringf("%s/%s", package_path, classname);
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue