Skip to content

Apache Lucene open-source search software

LUCENE-3902: start enforcing class javadocs for modules that don't have problems

Robert Muir5ede77e922d7
diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/util/ResourceLoader.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/util/ResourceLoader.java
index 4d1ff374c46..042379b2c31 100644
--- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/util/ResourceLoader.java
+++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/util/ResourceLoader.java
@@ -21,6 +21,9 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.List;
+/**
+ * Abstraction for loading resources (streams, files, and classes).
+ */
public interface ResourceLoader {
public InputStream openResource(String resource) throws IOException;
diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/util/ResourceLoaderAware.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/util/ResourceLoaderAware.java
index c3ccd77f876..386e8451d99 100644
--- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/util/ResourceLoaderAware.java
+++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/util/ResourceLoaderAware.java
@@ -17,6 +17,12 @@
package org.apache.lucene.analysis.util;
+/**
+ * Interface for a component that needs to be initialized by
+ * an implementation of {@link ResourceLoader}.
+ *
+ * @see ResourceLoader
+ */
public interface ResourceLoaderAware {
void inform(ResourceLoader loader);
diff --git a/lucene/analysis/common/src/java/org/tartarus/snowball/Among.java b/lucene/analysis/common/src/java/org/tartarus/snowball/Among.java
index 93ed6c67678..57aa1593c38 100644
--- a/lucene/analysis/common/src/java/org/tartarus/snowball/Among.java
+++ b/lucene/analysis/common/src/java/org/tartarus/snowball/Among.java
@@ -33,6 +33,15 @@ package org.tartarus.snowball;
import java.lang.reflect.Method;
+/**
+ * This is the rev 502 of the Snowball SVN trunk,
+ * but modified:
+ * made abstract and introduced abstract method stem to avoid expensive reflection in filter class.
+ * refactored StringBuffers to StringBuilder
+ * uses char[] as buffer instead of StringBuffer/StringBuilder
+ * eq_s,eq_s_b,insert,replace_s take CharSequence like eq_v and eq_v_b
+ * reflection calls (Lovins, etc) use EMPTY_ARGS/EMPTY_PARAMS
+ */
public class Among {
private static final Class<?>[] EMPTY_PARAMS = new Class[0];
public Among (String s, int substring_i, int result,
diff --git a/lucene/analysis/common/src/java/org/tartarus/snowball/TestApp.java b/lucene/analysis/common/src/java/org/tartarus/snowball/TestApp.java
deleted file mode 100644
index 3da6f8ccf2f..00000000000
--- a/lucene/analysis/common/src/java/org/tartarus/snowball/TestApp.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
-
-Copyright (c) 2001, Dr Martin Porter
-Copyright (c) 2002, Richard Boulton
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the copyright holders nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- */
-
-package org.tartarus.snowball;
-
-import java.lang.reflect.Method;
-import java.io.Reader;
-import java.io.Writer;
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStreamWriter;
-import java.io.OutputStream;
-import java.io.FileOutputStream;
-
-public class TestApp {
- private static void usage()
- {
- System.err.println("Usage: TestApp <algorithm> <input file> [-o <output file>]");
- }
-
- public static void main(String [] args) throws Throwable {
- if (args.length < 2) {
- usage();
- return;
- }
-
- Class<? extends SnowballProgram> stemClass = Class.forName("org.tartarus.snowball.ext." +
- args[0] + "Stemmer").asSubclass(SnowballProgram.class);
- SnowballProgram stemmer = stemClass.newInstance();
- Method stemMethod = stemClass.getMethod("stem", new Class[0]);
-
- Reader reader;
- reader = new InputStreamReader(new FileInputStream(args[1]));
- reader = new BufferedReader(reader);
-
- StringBuffer input = new StringBuffer();
-
- OutputStream outstream;
-
- if (args.length > 2) {
- if (args.length == 4 && args[2].equals("-o")) {
- outstream = new FileOutputStream(args[3]);
- } else {
- usage();
- return;
- }
- } else {
- outstream = System.out;
- }
- Writer output = new OutputStreamWriter(outstream);
- output = new BufferedWriter(output);
-
- int repeat = 1;
- if (args.length > 4) {
- repeat = Integer.parseInt(args[4]);
- }
-
- Object [] emptyArgs = new Object[0];
- int character;
- while ((character = reader.read()) != -1) {
- char ch = (char) character;
- if (Character.isWhitespace(ch)) {
- if (input.length() > 0) {
- stemmer.setCurrent(input.toString());
- for (int i = repeat; i != 0; i--) {
- stemMethod.invoke(stemmer, emptyArgs);
- }
- output.write(stemmer.getCurrent());
- output.write('\n');
- input.delete(0, input.length());
- }
- } else {
- input.append(Character.toLowerCase(ch));
- }
- }
- output.flush();
- }
-}
diff --git a/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/JapaneseTokenizer.java b/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/JapaneseTokenizer.java
index f6f49ac5c03..8e7ed49986f 100644
--- a/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/JapaneseTokenizer.java
+++ b/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/JapaneseTokenizer.java
@@ -100,9 +100,21 @@ public final class JapaneseTokenizer extends Tokenizer {
*/
public static final Mode DEFAULT_MODE = Mode.SEARCH;
+ /**
+ * Token type reflecting the original source of this token
+ */
public enum Type {
+ /**
+ * Known words from the system dictionary.
+ */
KNOWN,
+ /**
+ * Unknown words (heuristically segmented).
+ */
UNKNOWN,
+ /**
+ * Known words from the user dictionary.
+ */
USER
}
diff --git a/lucene/analysis/morfologik/src/java/org/apache/lucene/analysis/morfologik/MorphosyntacticTagAttributeImpl.java b/lucene/analysis/morfologik/src/java/org/apache/lucene/analysis/morfologik/MorphosyntacticTagAttributeImpl.java
index 45fce769ae9..3a82535d026 100644
--- a/lucene/analysis/morfologik/src/java/org/apache/lucene/analysis/morfologik/MorphosyntacticTagAttributeImpl.java
+++ b/lucene/analysis/morfologik/src/java/org/apache/lucene/analysis/morfologik/MorphosyntacticTagAttributeImpl.java
@@ -21,6 +21,7 @@ package org.apache.lucene.analysis.morfologik;
import org.apache.lucene.util.AttributeImpl;
/**
+ * Morphosyntactic annotations for surface forms.
* @see MorphosyntacticTagAttribute
*/
public class MorphosyntacticTagAttributeImpl extends AttributeImpl
diff --git a/lucene/build.xml b/lucene/build.xml
index afb12c26175..3ec293b61c6 100644
--- a/lucene/build.xml
+++ b/lucene/build.xml
@@ -194,6 +194,34 @@
<check-broken-links dir="build/docs"/>
<!-- TODO: change this level=class -->
<check-missing-javadocs dir="build/docs" level="package"/>
+ <!-- too many classes to fix overall to just enable
+ the above to be level="class" right now, but we
+ can prevent the modules that don't have problems
+ from getting any worse -->
+ <check-missing-javadocs dir="build/docs/analyzers-common" level="class"/>
+ <check-missing-javadocs dir="build/docs/analyzers-icu" level="class"/>
+ <check-missing-javadocs dir="build/docs/analyzers-kuromoji" level="class"/>
+ <check-missing-javadocs dir="build/docs/analyzers-kuromoji" level="class"/>
+ <check-missing-javadocs dir="build/docs/analyzers-morfologik" level="class"/>
+ <check-missing-javadocs dir="build/docs/analyzers-phonetic" level="class"/>
+ <check-missing-javadocs dir="build/docs/analyzers-smartcn" level="class"/>
+ <check-missing-javadocs dir="build/docs/analyzers-stempel" level="class"/>
+ <check-missing-javadocs dir="build/docs/analyzers-uima" level="class"/>
+ <!-- benchmark: problems -->
+ <!-- core: problems -->
+ <!-- demo: problems -->
+ <!-- facet: problems -->
+ <!-- grouping: problems -->
+ <!-- highlighter: problems -->
+ <check-missing-javadocs dir="build/docs/join" level="class"/>
+ <check-missing-javadocs dir="build/docs/memory" level="class"/>
+ <!-- misc: problems -->
+ <!-- queries: problems -->
+ <!-- queryparser: problems -->
+ <!-- sandbox: problems -->
+ <!-- spatial: problems -->
+ <!-- suggest: problems -->
+ <!-- test-framework: problems -->
</sequential>
</target>