snowballstem / snowball

Snowball compiler and stemming algorithms
https://snowballstem.org/
BSD 3-Clause "New" or "Revised" License
757 stars 173 forks source link

Generated Java code does not inherit from the correct class #134

Closed urieli closed 4 years ago

urieli commented 4 years ago

In the java TestApp, we have the statement at https://github.com/snowballstem/snowball/blob/master/java/org/tartarus/snowball/TestApp.java#L31

SnowballStemmer stemmer = (SnowballStemmer) stemClass.newInstance();

However, the generated Java class inherits from org.tartarus.snowball.SnowballProgram rather than org.tartarus.snowball.SnowballStemmer.

By simply making the generated class inherit from org.tartarus.snowball.SnowballStemmer (already a subclass of org.tartarus.snowball.SnowballProgram) the TestApp works out of the box.

ojwb commented 4 years ago

It looks to me like generated classes already inherit from SnowballStemmer:

$ grep extends java/org/tartarus/snowball/ext/spanishStemmer.java 
public class spanishStemmer extends org.tartarus.snowball.SnowballStemmer {

TestApp is used by make check_java, which currently passes, so it already works out of the box!

If you still think something needs changing, can you open a PR with the changes you're proposing? That avoids me having to interpret what you're trying to suggest, and also means the changes get automatically testing by the CI.

urieli commented 4 years ago

My excuses, I must have used a downloaded version of the snowball library against the github source code. I thought I had built directly from the github source code.