#959 Bug with typemap javaconstruct

closed-invalid
java (79)
5
2008-12-23
2008-10-28
J. Bedouet
No

The typemap 'javaconstruct' is applied to all constructors, not the one referred by the typemap.

I would like to only modify contructor A (int) but the generated code is

public A() {
this(testJNI.new_A__SWIG_1(arg0), true);
System.out.println ("A(int)");
}

public A(int arg0) {
this(testJNI.new_A__SWIG_1(arg0), true);
System.out.println ("A(int)");
}

Command lines:
swig -c++ -java test.i

swig -version
SWIG Version 1.3.36

Discussion

  • J. Bedouet

    J. Bedouet - 2008-10-28
     
  • William Fulton

    William Fulton - 2008-12-23
    • status: open --> closed-invalid
     
  • William Fulton

    William Fulton - 2008-12-23

    Typemaps cannot target particular methods so this is not possible. What you could instead do is the following where $imcall expands to the jni call:

    %typemap(javaconstruct) A {
    this($imcall, true);
    System.out.println ("$imcall");
    }

    Probably not quite what you want, so consider using %exception and the $decl special variable to display the method name. Details in Customization.html#Customization_exception_special_variables - "Special variables for %exception" section.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks