Opened 19 years ago
Closed 19 years ago
#1106 closed defect (fixed)
Compatibility issues between java mapscript 4.2.X and 4.4.0
Reported by: | unicoletti | Owned by: | |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | MapScript-SWIG | Version: | 4.4 |
Severity: | major | Keywords: | |
Cc: |
Description
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.
Attachments (2)
Change History (8)
by , 19 years ago
Attachment: | patchPointObj-compatibility.diff added |
---|
comment:1 by , 19 years ago
Component: | MapScript → MapScript-SWIG |
---|---|
Owner: | changed from | to
comment:2 by , 19 years ago
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?
comment:3 by , 19 years ago
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.
comment:4 by , 19 years ago
Status: | new → assigned |
---|
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?
comment:5 by , 19 years ago
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.
comment:6 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
thanks, Umberto! I committed to branch 4-4 and HEAD and am closing down this bug.
Note:
See TracTickets
for help on using tickets.
This patch introduces a backwards compatible contructor for pointObj in Java mapscript