MapServer / MapServer-import

3 stars 2 forks source link

Compatibility issues between java mapscript 4.2.X and 4.4.0 #1106

Open tbonfort opened 12 years ago

tbonfort commented 12 years ago

Reporter: unicoletti Date: 2004/12/05 - 19:50

When upgrading from Java mapscript 4.2.X to 4.4.0 my application failed to compile.
The problem lies in the new pointObj constructor that takes four arguments
(x,y,x,m) in place of the three (x,y,z) in previous versions.

Side note:
While this is a minor annoyance that is easy to fix, incompatibility between
different versions seems to be a pattern in java mapscript. In fact I had a
similar problem when upgrading from 4.0 to 4.2, and in that case I simply
changed my code (a very small code base) to be 4.2 compliant. Now that the
application is reaching maturity playing catch up with mapscript is becoming
more and more difficult, so I think we should work out a test suite for Java
mapscript that will make it easier to spot issues like this. Let me know what
your opinions are on this topic.
tbonfort commented 12 years ago

Author: sgillies@frii.com Date: 2004/12/06 - 17:29

The problem is that the old code was

   pointObj(x, y, m)

and now that we have Z for points in mapserver, it has been changed to

   pointObj(x, y, z, m)

In the Python case, swig emits constructors in which arguments with specified
values are *optional*.  The pointObj constructors is defined in point.i as

   pointObj(double x=-1, double y=-1, double z=0, double m=0)

so for Python we can do

   >>> p = pointObj()  # same as -1,-1,0,0
   >>> p = pointObj(10,10) # same as 10,10,0,0

It seems to be that there are no optional arguments for Java?
tbonfort commented 12 years ago

Author: unicoletti Date: 2004/12/07 - 10:03

Default arguments support for Java has been introduced in swig 1.3.23.
See
http://www.swig.org/Doc1.3/SWIGPlus.html#SWIGPlus_default_args

for more info. Upgrading swig is a bit difficult at the moment for me as gentoo
still ships 1.3.21 and 1.3.22 is unstable.
tbonfort commented 12 years ago

Author: sgillies@frii.com Date: 2005/01/30 - 17:41

Umberto, I didn't realize that SWIG would generate multiple pointObj constructors
based on the signatures.  This is good :)

I have moved the Java pointObj constructors into java/javaextend.i to keep the
point.i file as simple as possible.

Can you test this for me?
tbonfort commented 12 years ago

Author: unicoletti Date: 2005/02/01 - 10:11

OK, it works.

I have written a small java program that can be used to test this patch, I
attach it. It can go in mapscript/java/examples.
No modifications to Makefile are required as the only requirement is that it
compiles.
tbonfort commented 12 years ago

Author: sgillies@frii.com Date: 2005/02/01 - 16:23

thanks, Umberto!  I committed to branch 4-4 and HEAD and am closing down this
bug.