You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pylucene-dev@lucene.apache.org by Ethan Aubin <et...@gmail.com> on 2015/06/30 18:15:25 UTC

JCC exclude single constructor

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) {}

Re: JCC exclude single constructor

Posted by Andi Vajda <va...@apache.org>.
On Tue, 30 Jun 2015, Ethan Aubin wrote:

> 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) {}

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..