Skip to content

Commit

Permalink
GEODE-6588 removed raw arraylists, assigning them each a type (apache…
Browse files Browse the repository at this point in the history
  • Loading branch information
jackw26 authored and jinmeiliao committed Jun 4, 2019
1 parent 51733cd commit fcefe67
Show file tree
Hide file tree
Showing 13 changed files with 29 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ public void testDurableReconnectWithOneRedundantServerDown() throws Exception {

instance.determineAndVerfiyRedundantServers(redundantServersAfterReconnect);

List redundantServersHistory = new ArrayList();
List<String> redundantServersHistory = new ArrayList<>();
redundantServersHistory.addAll(redundantServersAfterReconnect);
redundantServersHistory.add(rServer1);
instance.determineAndVerfiyNonRedundantServers(redundantServersHistory);
Expand Down Expand Up @@ -309,7 +309,7 @@ public void testDurableReconnectWithBothRedundantServersDown() throws Exception
redundantServersAfterReconnect.add(pool.getPrimaryName());


List redundantServersHistory = new ArrayList();
List<String> redundantServersHistory = new ArrayList<>();
redundantServersHistory.addAll(redundantServersAfterReconnect);
redundantServersHistory.add(rServer1);
redundantServersHistory.add(rServer2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public void testNestedQueriesResultsasStructSet() throws Exception {

class QueryObserverImpl extends QueryObserverAdapter {
boolean isIndexesUsed = false;
ArrayList indexesUsed = new ArrayList();
ArrayList<String> indexesUsed = new ArrayList<>();

@Override
public void beforeIndexLookup(Index index, int oper, Object key) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ class DistributedSystemHealthMonitor implements Runnable, GemFireVM {
/**
* The most recent <code>OKAY_HEALTH</code> diagnoses of the GemFire system
*/
private List okayDiagnoses;
private List<String> okayDiagnoses;

/**
* The most recent <code>POOR_HEALTH</code> diagnoses of the GemFire system
*/
private List poorDiagnoses;
private List<String> poorDiagnoses;

////////////////////// Constructors //////////////////////

Expand All @@ -102,8 +102,8 @@ class DistributedSystemHealthMonitor implements Runnable, GemFireVM {
this.eval = eval;
this.healthImpl = healthImpl;
this.interval = interval;
this.okayDiagnoses = new ArrayList();
this.poorDiagnoses = new ArrayList();
this.okayDiagnoses = new ArrayList<>();
this.poorDiagnoses = new ArrayList<>();

String name = String.format("Health monitor for %s",
eval.getDescription());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ public class GemFireHealthEvaluator {
/**
* The most recent <code>OKAY_HEALTH</code> diagnoses of the GemFire system
*/
private List okayDiagnoses;
private List<String> okayDiagnoses;

/**
* The most recent <code>POOR_HEALTH</code> diagnoses of the GemFire system
*/
private List poorDiagnoses;
private List<String> poorDiagnoses;

/////////////////////// Constructors ///////////////////////

Expand All @@ -81,8 +81,8 @@ public GemFireHealthEvaluator(GemFireHealthConfig config, ClusterDistributionMan
this.config = config;
this.memberHealth = new MemberHealthEvaluator(config, dm);
this.cacheHealth = new CacheHealthEvaluator(config, dm);
this.okayDiagnoses = new ArrayList();
this.poorDiagnoses = new ArrayList();
this.okayDiagnoses = new ArrayList<>();
this.poorDiagnoses = new ArrayList<>();
}

////////////////////// Instance Methods //////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
public class LogCollator {

private GfManagerAgent system;
private List logTails;
private List<Loglet> logTails;

public LogCollator() {}

Expand All @@ -42,7 +42,7 @@ public String collateLogs(GfManagerAgent system) {
return "";
}
this.system = system;
this.logTails = new ArrayList();
this.logTails = new ArrayList<>();
gatherActiveLogs();
gatherInactiveLogs();
return mergeLogs();
Expand All @@ -58,7 +58,7 @@ private String mergeLogs() {
// combine logs...
Map<String, InputStream> logFiles = new HashMap<>();
for (int i = 0; i < this.logTails.size(); i++) {
Loglet loglet = (Loglet) this.logTails.get(i);
Loglet loglet = this.logTails.get(i);
logFiles.put(loglet.name, new ByteArrayInputStream(loglet.tail.getBytes()));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -483,11 +483,11 @@ protected SystemMemberCache createSystemMemberCache(GemFireVM vm)
/** Wrap the internal stats with impls of {@link StatisticResource} */
protected StatisticResource[] getStatsImpl(StatResource[] stats)
throws org.apache.geode.admin.AdminException {
List statList = new ArrayList();
List<StatisticResource> statList = new ArrayList<>();
for (int i = 0; i < stats.length; i++) {
statList.add(createStatisticResource(stats[i]));
}
return (StatisticResource[]) statList.toArray(new StatisticResource[0]);
return statList.toArray(new StatisticResource[0]);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ private void resolve() throws NameResolutionException {
private void resolveGeneral() throws NameResolutionException {
Method[] allMethods = _targetClass.getMethods();
// keep only ones whose method names match and have the same number of args
List candidates = new ArrayList();
List<Method> candidates = new ArrayList<>();
for (int i = 0; i < allMethods.length; i++) {
Method meth = allMethods[i];
/*
Expand Down Expand Up @@ -134,16 +134,16 @@ private void resolveGeneral() throws NameResolutionException {
// now we have a list of accessible and applicable method,
// choose the most specific
if (candidates.size() == 1) {
_method = (Method) candidates.get(0);
_method = candidates.get(0);
return;
}


sortByDecreasingSpecificity(candidates);
// get the first two methods in the sorted list,
// if they are equally specific, then throw AmbiguousMethodException
Method meth1 = (Method) candidates.get(0);
Method meth2 = (Method) candidates.get(1);
Method meth1 = candidates.get(0);
Method meth2 = candidates.get(1);
// if meth1 cannot be type-converted to meth2, then meth1 is not more
// specific than meth2 and the invocation is ambiguous.
// special case a null argument type in this case, since there should
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ private static int getMatchLevel(String[] queryDefintions, String[] indexDefinit
* @return the collection of indexes for the specified region and type
*/
public Collection getIndexes(IndexType indexType) {
ArrayList list = new ArrayList();
ArrayList<Index> list = new ArrayList<>();
Iterator it = this.indexes.values().iterator();
while (it.hasNext()) {
Object ind = it.next();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public int getNumberOfIndexedBuckets() {
*/
public List getBucketIndexes() {
synchronized (this.bucketIndexes) {
List indexes = new ArrayList();
List<Index> indexes = new ArrayList<>();
for (List<Index> indexList : bucketIndexes.values()) {
indexes.addAll(indexList);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,7 @@ public void run2() throws CacheException {
}

public String[] generateCqQueries(boolean uniqueQueries) {
ArrayList initQueries = new ArrayList();
ArrayList<String> initQueries = new ArrayList<>();
// From Portfolio object.
String[] names = {"aaa", "bbb", "ccc", "ddd"};
int nameIndex = 0;
Expand All @@ -968,7 +968,7 @@ public String[] generateCqQueries(boolean uniqueQueries) {
}

int numMatchedQueries = 10;
ArrayList cqQueries = new ArrayList();
ArrayList<String> cqQueries = new ArrayList<>();
Iterator iter = initQueries.iterator();
while (iter.hasNext()) {
String query = (String) iter.next();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void testAllPostOps() throws Exception {
server2.invoke(() -> closeCache());

// Perform all the ops on the clients
List opBlock = new ArrayList();
List<OperationWithAction> opBlock = new ArrayList<>();
Random rnd = new Random();

for (int opNum = 0; opNum < allOps.length; ++opNum) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public boolean authorizeOperation(String regionName, OperationContext context) {
Object value = queryContext.getQueryResult();
if (value instanceof SelectResults) {
SelectResults results = (SelectResults) value;
List newResults = new ArrayList();
List<Object> newResults = new ArrayList<>();
Iterator resultIter = results.iterator();
while (resultIter.hasNext()) {
Object obj = resultIter.next();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,14 @@ private void createDispatcher() {
}

@Test
public void testLogBatchExceptions() throws Exception {
public void testLogBatchExceptions() {

// Create AckReaderThread
GatewaySenderEventRemoteDispatcher.AckReaderThread thread =
this.dispatcher.new AckReaderThread(this.sender, "AckReaderThread");

// Create parent BatchException containing a NullPointerException with no index
List<BatchException70> batchExceptions = new ArrayList();
List<BatchException70> batchExceptions = new ArrayList<>();
batchExceptions
.add(new BatchException70("null pointer exception", new NullPointerException(), -1, 0));
BatchException70 batchException = new BatchException70(batchExceptions);
Expand Down

0 comments on commit fcefe67

Please sign in to comment.