[ https://issues.apache.org/jira/browse/PYLUCENE-55?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17179256#comment-17179256 ]
Andrea Sterbini edited comment on PYLUCENE-55 at 8/17/20, 10:21 PM: -------------------------------------------------------------------- Hi, with "not working" I mean that some of the methods of the java classes are missing in the resulting wrapper depending on the order the classes are processed by cpp.py . I agree with you that my patch is NOT a solution, I wrote it only to see if the order mattered, and for this specific library the order seems to matter. To reproduce the error: (my environment is: 16G RAM, Fedora Linux 32, Anaconda python 3.7 64 bit, jcc 3.7) * download and unzip [https://babelnet.org/data/4.0/BabelNet-API-4.0.1.zip] * copy the Makefile below in the resulting directory and build and install the module (make) * The resulting module sometimes comes *without* the method getLemmas of the BabelSynset class, sometimes *with* ** *ipython* ** *from babelnet import ** ** *BabelSynset.getLemmas() # sometimes this method is missing, sometimes not* (notice, the code above just checks if the method is present) By sorting the classes at line 696 of cpp.py I get the method always (but I have not checked if other stuff is missing) I am not so well versed in all jcc details but I hope this bug-report will tell you where to look. This is my Makefile {code:java} JNI_DIR:=/usr/lib/jvm/java CPLUS_INCLUDE_PATH:=$(JNI_DIR)/include:$(JNI_DIR)/include/linux JARS= --jar babelnet-api-4.0.1.jar JARS+= --jar lib/babelscape-data-commons-1.0.jar INCLUDE+=--include lib/commons-beanutils-1.7.0.jar INCLUDE+=--include lib/commons-beanutils-core-1.7.0.jar INCLUDE+=--include lib/commons-codec-1.8.jar INCLUDE+=--include lib/commons-collections-3.2.jar INCLUDE+=--include lib/commons-configuration-1.5.jar INCLUDE+=--include lib/commons-digester-1.8.jar INCLUDE+=--include lib/commons-lang-2.3.jar INCLUDE+=--include lib/commons-logging-1.1.jar INCLUDE+=--include lib/gson-2.8.2.jar INCLUDE+=--include lib/guava-23.0.jar INCLUDE+=--include lib/httpclient-4.3.6.jar INCLUDE+=--include lib/httpcore-4.3.3.jar INCLUDE+=--include lib/icu4j-56.1.jar INCLUDE+=--include lib/jwi-2.2.3.jar INCLUDE+=--include lib/lcl-jlt-2.4.jar INCLUDE+=--include lib/logback-classic-1.2.3.jar INCLUDE+=--include lib/logback-core-1.2.3.jar INCLUDE+=--include lib/lucene-analyzers-common-7.2.0.jar INCLUDE+=--include lib/lucene-core-7.2.0.jar INCLUDE+=--include lib/lucene-queries-7.2.0.jar INCLUDE+=--include lib/lucene-queryparser-7.2.0.jar INCLUDE+=--include lib/lucene-sandbox-7.2.0.jar INCLUDE+=--include lib/slf4j-api-1.7.25.jar MAPPING+=--mapping it/uniroma1/lcl/babelnet/BabelNetQuery/Builder 'from:(Lit/uniroma1/lcl/babelnet/Language;)Lit/uniroma1/lcl/babelnet/BabelNetQuery/Builder;' MAPPING+=--mapping it/uniroma1/lcl/babelnet/BabelNet 'getSynsets:(Lit/uniroma1/lcl/babelnet/BabelNetQuery;)Ljava/lang/List<it/uniroma1/lcl/babelnet/BabelSynset>;' JCC:=python -m jcc all: CPLUS_INCLUDE_PATH=$(CPLUS_INCLUDE_PATH) $(JCC) $(INCLUDE) $(JARS) $(MAPPING) --python babelnet --build --install --version 4.0.1 {code} was (Author: a.sterbini): Hi, with "not working" I mean that some of the methods of the java classes are missing in the resulting wrapper depending on the order the classes are processed by cpp.py . I agree with you that my patch is NOT a solution, I wrote it only to see if the order mattered, and for this specific library the order seems to matter. To reproduce the error: (my environment is: 16G RAM, Fedora Linux 32, Anaconda python 3.7 64 bit, jcc 3.7) * download and unzip [https://babelnet.org/data/4.0/BabelNet-API-4.0.1.zip] * copy the Makefile below in the resulting directory and build and install the module (make) * The resulting module sometimes comes *without* the method getLemmas of the BabelSynset class, sometimes *with* ** *ipython* ** *from babelnet import ** ** *BabelSynset.getLemmas() # sometimes this method is missing, sometimes not* (notice, the code above just checks if the method is present) By sorting the classes at line 696 of cpp.py I get the method always (but I have not checked if other stuff is missing) I am not so well versed in all jcc details but I hope this bug-report will tell you where to look. This is my Makefile {code:java} JNI_DIR:=/usr/lib/jvm/java CPLUS_INCLUDE_PATH:=$(JNI_DIR)/include:$(JNI_DIR)/include/linux JARS= --jar babelnet-api-4.0.1.jar JARS+= --jar lib/babelscape-data-commons-1.0.jar CP=config:lib:lib/commons-beanutils-1.7.0.jar:lib/commons-beanutils-core-1.7.0.jar:lib/commons-codec-1.8.jar:lib/commons-collections-3.2.jar:lib/commons-configuration-1.5.jar:lib/commons-digester-1.8.jar:lib/commons-lang-2.3.jar:lib/commons-logging-1.1.jar:lib/gson-2.8.2.jar:lib/guava-23.0.jar:lib/httpclient-4.3.6.jar:lib/httpcore-4.3.3.jar:lib/icu4j-56.1.jar:lib/jwi-2.2.3.jar:lib/lcl-jlt-2.4.jar:lib/logback-classic-1.2.3.jar:lib/logback-core-1.2.3.jar:lib/lucene-analyzers-common-7.2.0.jar:lib/lucene-core-7.2.0.jar:lib/lucene-queries-7.2.0.jar:lib/lucene-queryparser-7.2.0.jar:lib/lucene-sandbox-7.2.0.jar:lib/slf4j-api-1.7.25.jar INCLUDE+=--include lib/commons-beanutils-1.7.0.jar INCLUDE+=--include lib/commons-beanutils-core-1.7.0.jar INCLUDE+=--include lib/commons-codec-1.8.jar INCLUDE+=--include lib/commons-collections-3.2.jar INCLUDE+=--include lib/commons-configuration-1.5.jar INCLUDE+=--include lib/commons-digester-1.8.jar INCLUDE+=--include lib/commons-lang-2.3.jar INCLUDE+=--include lib/commons-logging-1.1.jar INCLUDE+=--include lib/gson-2.8.2.jar INCLUDE+=--include lib/guava-23.0.jar INCLUDE+=--include lib/httpclient-4.3.6.jar INCLUDE+=--include lib/httpcore-4.3.3.jar INCLUDE+=--include lib/icu4j-56.1.jar INCLUDE+=--include lib/jwi-2.2.3.jar INCLUDE+=--include lib/lcl-jlt-2.4.jar INCLUDE+=--include lib/logback-classic-1.2.3.jar INCLUDE+=--include lib/logback-core-1.2.3.jar INCLUDE+=--include lib/lucene-analyzers-common-7.2.0.jar INCLUDE+=--include lib/lucene-core-7.2.0.jar INCLUDE+=--include lib/lucene-queries-7.2.0.jar INCLUDE+=--include lib/lucene-queryparser-7.2.0.jar INCLUDE+=--include lib/lucene-sandbox-7.2.0.jar INCLUDE+=--include lib/slf4j-api-1.7.25.jar MAPPING+=--mapping it/uniroma1/lcl/babelnet/BabelNetQuery/Builder 'from:(Lit/uniroma1/lcl/babelnet/Language;)Lit/uniroma1/lcl/babelnet/BabelNetQuery/Builder;' MAPPING+=--mapping it/uniroma1/lcl/babelnet/BabelNet 'getSynsets:(Lit/uniroma1/lcl/babelnet/BabelNetQuery;)Ljava/lang/List<it/uniroma1/lcl/babelnet/BabelSynset>;' JCC:=python -m jcc all: CPLUS_INCLUDE_PATH=$(CPLUS_INCLUDE_PATH) $(JCC) $(INCLUDE) $(JARS) $(MAPPING) --python babelnet --build --install --version 4.0.1 {code} > 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)