Generics Policeman ticket

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@948234 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2010-05-25 22:44:36 +00:00
parent a0c72afb31
commit 9e61dd591f
1 changed files with 3 additions and 2 deletions

View File

@ -63,8 +63,9 @@ public final class SnowballFilter extends TokenFilter {
public SnowballFilter(TokenStream in, String name) {
super(in);
try {
Class<?> stemClass = Class.forName("org.tartarus.snowball.ext." + name + "Stemmer");
stemmer = (SnowballProgram) stemClass.newInstance();
Class<? extends SnowballProgram> stemClass =
Class.forName("org.tartarus.snowball.ext." + name + "Stemmer").asSubclass(SnowballProgram.class);
stemmer = stemClass.newInstance();
} catch (Exception e) {
throw new RuntimeException(e.toString());
}