Opened 20 years ago

Closed 20 years ago

#848 closed defect (fixed)

Java SWIG code compilation problem due to naming convention.

Reported by: ykchoo@… Owned by: sgillies@…
Priority: high Milestone:
Component: MapScript-SWIG Version: 4.2
Severity: normal Keywords:
Cc:

Description

Minor problem found due to naming convention use in Java and methods/struct 
members defined in mapscript.i and header file.

i) For example symbolObj has a member name points and a method getPoints() 
defined. The Java code generated by SWIG contains Java getter/setter for each 
struct defined. Thus, getPoints() are defined "twice" causing compilation 
errors.
Solution: use #ifdef SWIGJAVA to use a diffirent name for the method 
extension, e.g. 
#ifndef SWIGJAVA    
    %newobject getPoints;    
    lineObj *getPoints() {
#else
    %newobject getPoints_;
    lineObj *getPoints_() {
#endif

Attachments (3)

mapscript.i (53.4 KB ) - added by ykchoo@… 20 years ago.
modified mapscript.i file showing where the Java naming confilcts.
bug848-mapserver-4.2.3-1.tar.gz (23.8 KB ) - added by sgillies@… 20 years ago.
patched map.h and mapscript/mapscript.i 4.2.3-1
bug848-mapserver-4.2.3-2.tar.gz (24.4 KB ) - added by sgillies@… 20 years ago.
patched map.h, mapsymbol.h, mapscript/mapscript.i 4.2.3-2

Download all attachments as: .zip

Change History (10)

comment:1 by sgillies@…, 20 years ago

Component: MapScriptMapScript-SWIG
Owner: changed from sdlime to sgillies@…
The solution is to hide the points member from SWIG so that no Java
getter/setter is generated.  All programmers should use the getPoints
and setMethods methods defined in the SWIG module.

comment:2 by sgillies@…, 20 years ago

Status: newassigned
#ifndef SWIG
  pointObj points[MS_MAXVECTORPOINTS];
#endif

in both the CVS HEAD and branch-4-2.  

Can I get some confirmation of a fix?

by ykchoo@…, 20 years ago

Attachment: mapscript.i added

modified mapscript.i file showing where the Java naming confilcts.

comment:3 by sgillies@…, 20 years ago

Have committed changes to mapscript.i in branch-4-2 which avoid Java conflicts
for mapObj.clone, symbol.get/setPoints, outputFormatObj.  A patched map.h
and mapscript/mapscript.i are attached.  These will allow you to test the
fix.  Please confirm.

by sgillies@…, 20 years ago

patched map.h and mapscript/mapscript.i 4.2.3-1

by sgillies@…, 20 years ago

patched map.h, mapsymbol.h, mapscript/mapscript.i 4.2.3-2

comment:4 by ykchoo@…, 20 years ago

Patched files 4.2.3-2 works for both C# and Java. Thanks for the quick 
response.

comment:5 by ykchoo@…, 20 years ago

Resolution: fixed
Status: assignedclosed

comment:6 by sgillies@…, 20 years ago

Resolution: fixed
Status: closedreopened
Leave bug resolution to the bug owner.  Thanks for the confirmation!

comment:7 by sgillies@…, 20 years ago

Resolution: fixed
Status: reopenedclosed
closed.
Note: See TracTickets for help on using tickets.