Skip to content

Commit

Permalink
fix: Remove Error Prone JdkObsolete warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
juherr committed Feb 19, 2024
1 parent 5bde4c6 commit 6c97402
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 16 deletions.
10 changes: 6 additions & 4 deletions testng-core/src/main/java/org/testng/internal/Graph.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package org.testng.internal;

import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
Expand Down Expand Up @@ -190,9 +192,9 @@ public List<T> findPredecessors(T o) {
// already encountered. "queue" is the queue of items whose
// predecessors we haven't yet explored.

LinkedList<T> result = new LinkedList<>();
Deque<T> result = new ArrayDeque<>();
Set<T> visited = new HashSet<>();
LinkedList<T> queue = new LinkedList<>();
Deque<T> queue = new ArrayDeque<>();
visited.add(o);
queue.addLast(o);

Expand All @@ -206,7 +208,7 @@ public List<T> findPredecessors(T o) {
}
}

return result;
return new ArrayList<>(result);
}

@Override
Expand Down
6 changes: 3 additions & 3 deletions testng-core/src/main/java/org/testng/internal/Tarjan.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package org.testng.internal;

import java.util.ArrayDeque;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Stack;
import org.testng.collections.Lists;
import org.testng.collections.Maps;

Expand All @@ -14,13 +14,13 @@
*/
public class Tarjan<T> {
int m_index = 0;
private final Stack<T> stack;
private final ArrayDeque<T> stack;
Map<T, Integer> visitedNodes = Maps.newHashMap();
Map<T, Integer> m_lowlinks = Maps.newHashMap();
private List<T> m_cycle;

public Tarjan(Graph<T> graph, T start) {
stack = new Stack<>();
stack = new ArrayDeque<>();
run(graph, start);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package test.dataprovider.issue2327;

import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
Expand All @@ -16,7 +17,7 @@ public void setup(Method method, Object[] params) {

@DataProvider(name = "dp", parallel = true)
public Iterator<Object> dp() {
LinkedList<Object> objects = new LinkedList<>();
List<Object> objects = new ArrayList<>();
objects.add("Dataset1");
objects.add("Dataset2");
return objects.iterator();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
package test.junitreports;

import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Deque;
import java.util.List;
import java.util.Stack;
import org.xml.sax.Attributes;
import org.xml.sax.helpers.DefaultHandler;

public class TestSuiteHandler extends DefaultHandler {
private static final List<String> tags = Arrays.asList("error", "skipped", "ignored", "failure");
private final Testsuite testsuite = new Testsuite();
private final Stack<String> elementStack = new Stack<>();
private final Stack<Testcase> testcaseStack = new Stack<>();
private final Deque<String> elementStack = new ArrayDeque<>();
private final Deque<Testcase> testcaseStack = new ArrayDeque<>();

@Override
public void startElement(String uri, String localName, String qName, Attributes attributes) {
Expand Down
4 changes: 2 additions & 2 deletions testng-core/src/test/java/test/junitreports/Testsuite.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package test.junitreports;

import java.util.LinkedList;
import java.util.ArrayList;
import java.util.List;
import org.xml.sax.Attributes;

Expand Down Expand Up @@ -92,5 +92,5 @@ public String toString() {
private int failures;
private int skipped;
private int errors;
private List<Testcase> testcase = new LinkedList<>();
private List<Testcase> testcase = new ArrayList<>();
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.testng.internal;

import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;
Expand All @@ -27,7 +27,7 @@ public class LiteWeightTestNGMethod implements ITestNGMethod {
private String missingGroup;
private final String[] beforeGroups;
private final String[] afterGroups;
private final List<String> methodsDependedUpon = new LinkedList<>();
private final List<String> methodsDependedUpon = new ArrayList<>();
private int priority;
private int interceptedPriority;
private final XmlTest xmlTest;
Expand Down

0 comments on commit 6c97402

Please sign in to comment.