Skip to content

Commit

Permalink
HADOOP-11632. Cleanup Find.java to remove SupressWarnings annotations…
Browse files Browse the repository at this point in the history
…. Contributed by Akira AJISAKA.
  • Loading branch information
oza committed Feb 25, 2015
1 parent 6cbd9f1 commit ad8ed3e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
3 changes: 3 additions & 0 deletions hadoop-common-project/hadoop-common/CHANGES.txt
Expand Up @@ -628,6 +628,9 @@ Release 2.7.0 - UNRELEASED
HADOOP-11495. Convert site documentation from apt to markdown HADOOP-11495. Convert site documentation from apt to markdown
(Masatake Iwasaki via aw) (Masatake Iwasaki via aw)


HADOOP-11632. Cleanup Find.java to remove SupressWarnings annotations.
(Akira Ajisaka via ozawa)

OPTIMIZATIONS OPTIMIZATIONS


HADOOP-11323. WritableComparator#compare keeps reference to byte array. HADOOP-11323. WritableComparator#compare keeps reference to byte array.
Expand Down
Expand Up @@ -25,6 +25,7 @@
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.Set;


import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability; import org.apache.hadoop.classification.InterfaceStability;
Expand Down Expand Up @@ -63,19 +64,25 @@ public static void registerCommands(CommandFactory factory) {
private static final String OPTION_FOLLOW_ARG_LINK = "H"; private static final String OPTION_FOLLOW_ARG_LINK = "H";


/** List of expressions recognized by this command. */ /** List of expressions recognized by this command. */
@SuppressWarnings("rawtypes") private static final Set<Class<? extends Expression>> EXPRESSIONS =
private static final Class[] EXPRESSIONS; new HashSet<>();

private static void addExpression(Class<?> clazz) {
EXPRESSIONS.add(clazz.asSubclass(Expression.class));
}


static { static {
// Initialize the static variables. // Initialize the static variables.
EXPRESSIONS = new Class[] { // Operator Expressions
// Operator Expressions addExpression(And.class);
And.class,
// Action Expressions // Action Expressions
Print.class, addExpression(Print.class);
// Navigation Expressions
// Matcher Expressions // Navigation Expressions
Name.class }; // Matcher Expressions
addExpression(Name.class);

DESCRIPTION = buildDescription(ExpressionFactory.getExpressionFactory()); DESCRIPTION = buildDescription(ExpressionFactory.getExpressionFactory());


// Register the expressions with the expression factory. // Register the expressions with the expression factory.
Expand All @@ -92,15 +99,13 @@ public static void registerCommands(CommandFactory factory) {
private HashSet<Path> stopPaths = new HashSet<Path>(); private HashSet<Path> stopPaths = new HashSet<Path>();


/** Register the expressions with the expression factory. */ /** Register the expressions with the expression factory. */
@SuppressWarnings("unchecked")
private static void registerExpressions(ExpressionFactory factory) { private static void registerExpressions(ExpressionFactory factory) {
for (Class<? extends Expression> exprClass : EXPRESSIONS) { for (Class<? extends Expression> exprClass : EXPRESSIONS) {
factory.registerExpression(exprClass); factory.registerExpression(exprClass);
} }
} }


/** Build the description used by the help command. */ /** Build the description used by the help command. */
@SuppressWarnings("unchecked")
private static String buildDescription(ExpressionFactory factory) { private static String buildDescription(ExpressionFactory factory) {
ArrayList<Expression> operators = new ArrayList<Expression>(); ArrayList<Expression> operators = new ArrayList<Expression>();
ArrayList<Expression> primaries = new ArrayList<Expression>(); ArrayList<Expression> primaries = new ArrayList<Expression>();
Expand Down

0 comments on commit ad8ed3e

Please sign in to comment.