Another possible solution is to add a command line parameter that disables this error. The documentation for which would explain the requirements for successfully using %nspace without -package.

Brant

On 1/8/13 10:25 AM, Brant K. Kyser wrote:
Currently, swig produces and error when generating java wrappers when %nspace is used without specifying a top level package with -package. With the project on which I am working, it is undesirable to have a single top level package. I have found that I can use %nspace without -package as long as I use %nspace for all of my types exposed using swig and specify the JNI class's package using %pragma(java) jniclasspackage=PackageInWhichIWantTheJniCode. Doing these two things ensures that all of the generated Java code ends up in a package which avoids the issue of java types declared in a named package cannot access types in an unnamed package described in 24.3.31 of the Swig documentation.

What I would like to do is change the error produced when %nspace is used without -package to a warning describing the limitations of doing so. Thoughts?

Brant