Discussion:
JCC exclude single constructor
Ethan Aubin
2015-06-30 16:15:25 UTC
Permalink
Can I get JCC to omit the binding for a particular constructor? I've
wrapping a java class that looks like:

package eg;
public class Eg {
public Eg() {}
public <T extends Eg> Eg(T event) {}
public String foo() { return "foo"; }
}


and the generated bindings generate a constructor redeclaration error:

python -m jcc --classpath ./src --package eg eg.Eg --python Test --build

In file included from build/_Test/__init__.cpp:44:
build/_Test/eg/Eg.h:37:5: error: constructor cannot be redeclared
Eg(const Eg &);
^
build/_Test/eg/Eg.h:34:5: note: previous declaration is here
Eg(const Eg& obj) : ::java::lang::Object(obj) {}
Andi Vajda
2015-06-30 16:49:41 UTC
Permalink
Post by Ethan Aubin
Can I get JCC to omit the binding for a particular constructor? I've
package eg;
public class Eg {
public Eg() {}
public <T extends Eg> Eg(T event) {}
public String foo() { return "foo"; }
}
python -m jcc --classpath ./src --package eg eg.Eg --python Test --build
build/_Test/eg/Eg.h:37:5: error: constructor cannot be redeclared
Eg(const Eg &);
^
build/_Test/eg/Eg.h:34:5: note: previous declaration is here
Eg(const Eg& obj) : ::java::lang::Object(obj) {}
It looks like you found a bug here.
You can exclude a class via --exclude but not an individual method.
Your options:
- add such a flag (excluding by signature, should be easy enough)
- make the constructor non public
- disable generics support with --no-generics
- fix the bug that causes the failure (a check needs to be added to
exclude the double-declared constructor)

Andi..

Loading...