hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oz...@apache.org
Subject hadoop git commit: HADOOP-11632. Cleanup Find.java to remove SupressWarnings annotations. Contributed by Akira AJISAKA.
Date Wed, 25 Feb 2015 07:26:40 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2 13e213c41 -> 75fd43be0


HADOOP-11632. Cleanup Find.java to remove SupressWarnings annotations. Contributed by Akira
AJISAKA.

(cherry picked from commit ad8ed3e802782a7a3fb3d21c5862673a8f695372)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/75fd43be
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/75fd43be
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/75fd43be

Branch: refs/heads/branch-2
Commit: 75fd43be02ab8247e43d6e6eab56be360f75394b
Parents: 13e213c
Author: Tsuyoshi Ozawa <ozawa@apache.org>
Authored: Wed Feb 25 16:25:04 2015 +0900
Committer: Tsuyoshi Ozawa <ozawa@apache.org>
Committed: Wed Feb 25 16:25:21 2015 +0900

----------------------------------------------------------------------
 hadoop-common-project/hadoop-common/CHANGES.txt |  3 ++
 .../org/apache/hadoop/fs/shell/find/Find.java   | 29 ++++++++++++--------
 2 files changed, 20 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/75fd43be/hadoop-common-project/hadoop-common/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt
index 27fee78..5a6f082 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -215,6 +215,9 @@ Release 2.7.0 - UNRELEASED
     HADOOP-11495. Convert site documentation from apt to markdown (Masatake
     Iwasaki via aw)
 
+    HADOOP-11632. Cleanup Find.java to remove SupressWarnings annotations.
+    (Akira Ajisaka via ozawa)
+
   OPTIMIZATIONS
 
     HADOOP-11323. WritableComparator#compare keeps reference to byte array.

http://git-wip-us.apache.org/repos/asf/hadoop/blob/75fd43be/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/find/Find.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/find/Find.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/find/Find.java
index 05cd818..70a8c79 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/find/Find.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/find/Find.java
@@ -25,6 +25,7 @@ import java.util.Deque;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.LinkedList;
+import java.util.Set;
 
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.classification.InterfaceStability;
@@ -63,19 +64,25 @@ public class Find extends FsCommand {
   private static final String OPTION_FOLLOW_ARG_LINK = "H";
 
   /** List of expressions recognized by this command. */
-  @SuppressWarnings("rawtypes")
-  private static final Class[] EXPRESSIONS;
+  private static final Set<Class<? extends Expression>> EXPRESSIONS =
+      new HashSet<>();
+
+  private static void addExpression(Class<?> clazz) {
+    EXPRESSIONS.add(clazz.asSubclass(Expression.class));
+  }
 
   static {
     // Initialize the static variables.
-    EXPRESSIONS = new Class[] {
-        // Operator Expressions
-        And.class,
-        // Action Expressions
-        Print.class,
-        // Navigation Expressions
-        // Matcher Expressions
-        Name.class };
+    // Operator Expressions
+    addExpression(And.class);
+
+    // Action Expressions
+    addExpression(Print.class);
+
+    // Navigation Expressions
+    // Matcher Expressions
+    addExpression(Name.class);
+
     DESCRIPTION = buildDescription(ExpressionFactory.getExpressionFactory());
 
     // Register the expressions with the expression factory.
@@ -92,7 +99,6 @@ public class Find extends FsCommand {
   private HashSet<Path> stopPaths = new HashSet<Path>();
 
   /** Register the expressions with the expression factory. */
-  @SuppressWarnings("unchecked")
   private static void registerExpressions(ExpressionFactory factory) {
     for (Class<? extends Expression> exprClass : EXPRESSIONS) {
       factory.registerExpression(exprClass);
@@ -100,7 +106,6 @@ public class Find extends FsCommand {
   }
 
   /** Build the description used by the help command. */
-  @SuppressWarnings("unchecked")
   private static String buildDescription(ExpressionFactory factory) {
     ArrayList<Expression> operators = new ArrayList<Expression>();
     ArrayList<Expression> primaries = new ArrayList<Expression>();


Mime
View raw message