[ https://issues.apache.org/jira/browse/PYLUCENE-55?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17181772#comment-17181772 ]
Andrea Sterbini edited comment on PYLUCENE-55 at 8/21/20, 9:59 AM: ------------------------------------------------------------------- Thanks for the solution. Still sometimes I find that something is missing. E.g. one of the methods I need is it.uniroma1.lcl.babelnet.BabelNet.getSynsets(...), which has many implementations (I need at least the first three) {code:java} // from it/uniroma1/lcl/babelnet/BabelNet.class public java.util.List<it.uniroma1.lcl.babelnet.BabelSynset> getSynsets(java.lang.String); public java.util.List<it.uniroma1.lcl.babelnet.BabelSynset> getSynsets(java.lang.String, it.uniroma1.lcl.jlt.util.Language); public java.util.List<it.uniroma1.lcl.babelnet.BabelSynset> getSynsets(java.lang.String, it.uniroma1.lcl.jlt.util.Language, com.babelscape.util.POS); public java.util.List<it.uniroma1.lcl.babelnet.BabelSynset> getSynsets(java.lang.String, java.util.Collection<it.uniroma1.lcl.jlt.util.Language>); public java.util.List<it.uniroma1.lcl.babelnet.BabelSynset> getSynsets(java.lang.String, java.util.Collection<it.uniroma1.lcl.jlt.util.Language>, com.babelscape.util.POS); public java.util.List<it.uniroma1.lcl.babelnet.BabelSynset> getSynsets(it.uniroma1.lcl.kb.ResourceID...); {code} Yet, after building and installing the module the resulting BabelNet class shows only 3 versions of the method {code:java} // from ... build/_babelnet/it/uniroma1/lcl/babelnet/BabelNet.h ::java::util::List getSynsets(const JArray< ::it::uniroma1::lcl::kb::ResourceID > &) const; ::java::util::List getSynsets(const ::java::lang::String &) const; ::java::util::List getSynsets(const ::java::lang::String &, jboolean) const; {code} I have tried also to add the methods I need to the mappings but the result is the same, non-deterministic, the resulting module could have or could have not the methods. {code:java} // from the Makefile MAPPING= MAPPING+=--mapping it/uniroma1/lcl/babelnet/BabelNet 'getSynsets:(Ljava/lang/String;Lit/uniroma1/lcl/jlt/util/Language;)Ljava/lang/List<it/uniroma1/lcl/babelnet/BabelSynset>;' MAPPING+=--mapping it/uniroma1/lcl/babelnet/BabelNet 'getSynsets:(Ljava/lang/String;Lit/uniroma1/lcl/jlt/util/Language;com/babelscape/util/POS;)Ljava/lang/List<it/uniroma1/lcl/babelnet/BabelSynset>;' MAPPING+=--mapping it/uniroma1/lcl/babelnet/BabelSynset 'getLemmas:()Ljava/lang/List<it/uniroma1/lcl/babelnet/data/BabelLemma>;' {code} What is the reason for so different generated modules? How the order of class wrapper generation influences the resulting methods? Why some methods sometimes are NON generated? was (Author: a.sterbini): Thanks for the solution. Still sometimes I find that something is missing. E.g. one of the methods I need is it.uniroma1.lcl.babelnet.BabelNet.getSynsets(...), which has many implementations (I need at least the first three) {code:java} // from it/uniroma1/lcl/babelnet/BabelNet.class public java.util.List<it.uniroma1.lcl.babelnet.BabelSynset> getSynsets(java.lang.String); public java.util.List<it.uniroma1.lcl.babelnet.BabelSynset> getSynsets(java.lang.String, it.uniroma1.lcl.jlt.util.Language); public java.util.List<it.uniroma1.lcl.babelnet.BabelSynset> getSynsets(java.lang.String, it.uniroma1.lcl.jlt.util.Language, com.babelscape.util.POS); public java.util.List<it.uniroma1.lcl.babelnet.BabelSynset> getSynsets(java.lang.String, java.util.Collection<it.uniroma1.lcl.jlt.util.Language>); public java.util.List<it.uniroma1.lcl.babelnet.BabelSynset> getSynsets(java.lang.String, java.util.Collection<it.uniroma1.lcl.jlt.util.Language>, com.babelscape.util.POS); public java.util.List<it.uniroma1.lcl.babelnet.BabelSynset> getSynsets(it.uniroma1.lcl.kb.ResourceID...); {code} Yet, after building and installing the module the resulting BabelNet class shows only 3 versions of the method {code:java} // from ... build/_babelnet/it/uniroma1/lcl/babelnet/BabelNet.h ::java::util::List getSynsets(const JArray< ::it::uniroma1::lcl::kb::ResourceID > &) const; ::java::util::List getSynsets(const ::java::lang::String &) const; ::java::util::List getSynsets(const ::java::lang::String &, jboolean) const; {code} I have tried also to add the methods I need to the mappings but the result is the same, non-deterministic, the resulting module could have or could have not the methods. {code:java} // from the Makefile MAPPING= MAPPING+=--mapping it/uniroma1/lcl/babelnet/BabelNet 'getSynsets:(Ljava/lang/String;Lit/uniroma1/lcl/jlt/util/Language;)Ljava/lang/List<it/uniroma1/lcl/babelnet/BabelSynset>;' MAPPING+=--mapping it/uniroma1/lcl/babelnet/BabelNet 'getSynsets:(Ljava/lang/String;Lit/uniroma1/lcl/jlt/util/Language;com/babelscape/util/POS;)Ljava/lang/List<it/uniroma1/lcl/babelnet/BabelSynset>;' MAPPING+=--mapping it/uniroma1/lcl/babelnet/BabelSynset 'getLemmas:()Ljava/lang/List<it/uniroma1/lcl/babelnet/data/BabelLemma>;' {code} What is the reason for so different generated modules? How the order of class wrapper generation influences the resulting methods? Why some methods sometimes are NON generated? > JCC creates the classes in non-deterministic order > -------------------------------------------------- > > Key: PYLUCENE-55 > URL: https://issues.apache.org/jira/browse/PYLUCENE-55 > Project: PyLucene > Issue Type: Bug > Reporter: Andrea Sterbini > Priority: Major > > I am trying to wrap the BabelNet API code. > The resulting module is non-deterministically not-working (once every 5 I get > it OK). > This seems to be related to the order the classes are handled, because they > are kept in a set, which has nondeterministic order. > By changing cpp.py at line 696 to sort the class names I get a working module. > {code:java} > // changed from > for cls in todo: > {code} > {code:java} > // to > for cls in sorted(todo, key=lambda c: c.getName()):{code} > I have been luky with this way to order the classes. Possibly a better > algorithm exists to fix this bug. -- This message was sent by Atlassian Jira (v8.3.4#803005)