[ 
https://issues.apache.org/jira/browse/IMPALA-7867?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16721615#comment-16721615
 ] 

ASF subversion and git services commented on IMPALA-7867:
---------------------------------------------------------

Commit 520a2b150cade5b83611bb11abea7997cf535cdc in impala's branch 
refs/heads/master from [~paul-rogers]
[ https://git-wip-us.apache.org/repos/asf?p=impala.git;h=520a2b1 ]

IMPALA-7867 (Part 2): ArrayList cleanup in analyzer

Follow-on to prior patch for this JIRA. Replaces all use of ArrayList
in variable and method declarations with the interface List. Retains
the use of ArrayList for list implementations (i.e. "new" statements.)

Also replaces "List.newArrayList()" with the more modern
"new ArrayList<>()". Cleaned up a few Map and Set declarations and
added a few missing @Override annotations found during this process.

Similar changes made for HashMap/newHashMap() and HashSet/newHashSet().
Where I noticed old-style new calls (List<Foo> = new ArrayList<Foo>())
these were replaced with diamond-notation: new ArrayList<>().

Tests: This is purely a source-level change; no functional change. Ran
all client unit tests.

Change-Id: I7c0b5f40a0504fc2d324055bd2a962e35f8e744a
Reviewed-on: http://gerrit.cloudera.org:8080/11995
Reviewed-by: Fredy Wijaya <fwij...@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenk...@cloudera.com>


> Expose collection interfaces, not implementations
> -------------------------------------------------
>
>                 Key: IMPALA-7867
>                 URL: https://issues.apache.org/jira/browse/IMPALA-7867
>             Project: IMPALA
>          Issue Type: Improvement
>          Components: Frontend
>    Affects Versions: Impala 3.0
>            Reporter: Paul Rogers
>            Assignee: Paul Rogers
>            Priority: Minor
>
> When using Java collections, a common Java best practice is to expose the 
> collection interface, but hide the implementation choice. This pattern allows 
> us to start with a generic implementation (an {{ArrayList}}, say), but evolve 
> to a more specific implementation to achieve certain goals (a {{LinkedList}} 
> or {{ImmutableList}}, say.)
> For whatever reason, the Impala FE code exposes {{ArrayList}}, {{HashMap}} 
> and other implementation choices as variable types and in method signatures.
> This ticket tracks a gradual process of revising the declarations and 
> signatures to use the interfaces {{List}} instead of the implementation 
> {{ArrayList}}.
> Also, the FE code appears to predate Java 7, so that declarations of lists 
> tend to be in one of two forms (with or without Guava):
> {code:java}
> foo1 = new ArrayList<Bar>();
> foo2 = Lists.newArrayList();
> {code}
> Since Java 7, the preferred form is:
> {code:java}
> foo = new ArrayList<>();
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscr...@impala.apache.org
For additional commands, e-mail: issues-all-h...@impala.apache.org

Reply via email to