Skip to content

Commit b73461f

Browse files
committed
MLE-23146 Fixed compiler warnings in all tests
Some of these have SuppressWarnings at the class level because they have so much unchecked warnings. Many of those are due to rampant copy/paste of duplicated code.
1 parent c469ad7 commit b73461f

38 files changed

+146
-94
lines changed

examples/src/main/java/com/marklogic/client/example/handle/GSONHandleExample.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public static void runShortcut(ExampleProperties props) throws IOException {
5555
String docId = "/example/"+filename;
5656

5757
// parse the example file with GSON
58-
JsonElement writeDocument = new JsonParser().parse(
58+
JsonElement writeDocument = JsonParser.parseReader(
5959
new InputStreamReader(docStream, "UTF-8"));
6060

6161
// write the document
@@ -99,7 +99,7 @@ public static void runStrongTyped(ExampleProperties props) throws IOException {
9999
GSONHandle writeHandle = new GSONHandle();
100100

101101
// parse the example file with GSON
102-
JsonElement writeDocument = writeHandle.getParser().parse(
102+
JsonElement writeDocument = JsonParser.parseReader(
103103
new InputStreamReader(docStream, "UTF-8"));
104104
writeHandle.set(writeDocument);
105105

marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/datamovement/functionaltests/TestSplitters.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636

3737
import static org.junit.jupiter.api.Assertions.*;
3838

39+
@SuppressWarnings("unchecked")
3940
public class TestSplitters extends BasicJavaClientREST {
4041
private static String dbName = "TestSplittersDB";
4142
private static String[] fNames = {"TestSplittersDB-1"};
@@ -1050,6 +1051,7 @@ public void setFileStream(FileInputStream fileStream) {
10501051
}
10511052

10521053
@Override
1054+
@SuppressWarnings("unchecked")
10531055
public void run() {
10541056
Stream<StringHandle> contentStream = null;
10551057
Charset cs = Charset.forName("UTF-8");

marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/fastfunctest/RowBatcherFuncTest.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ public void testRowBatcherWithJackson() {
6868
PlanBuilder p = rowMgr.newPlanBuilder();
6969
PlanBuilder.ModifyPlan plan = p.fromView("opticFunctionalTest", "detail");
7070
rowsBatcherOfJsonObj.withBatchView(plan);
71-
ArrayList<Double> exptdAmt = new ArrayList(Arrays.asList(10.01,20.02,30.03,40.04,50.05,60.06));
72-
ArrayList<Double> resultAmt = new ArrayList<>();
71+
List<Double> exptdAmt = Arrays.asList(10.01,20.02,30.03,40.04,50.05,60.06);
72+
List<Double> resultAmt = new ArrayList<>();
7373

7474
rowsBatcherOfJsonObj.onSuccess(e ->{
7575
JsonNode resDoc = e.getRowsDoc().get("rows");
@@ -117,8 +117,8 @@ public void testJoinInner() {
117117
p.col( "color")
118118
);
119119
rowsBatcherOfJsonObj.withBatchView(plan3);
120-
ArrayList<Double> exptdAmt = new ArrayList(Arrays.asList(10.01,20.02,30.03,40.04,50.05,60.06));
121-
ArrayList<Double> resultAmt = new ArrayList<>();
120+
List<Double> exptdAmt = Arrays.asList(10.01,20.02,30.03,40.04,50.05,60.06);
121+
List<Double> resultAmt = new ArrayList<>();
122122

123123
rowsBatcherOfJsonObj.onSuccess(e ->{
124124
JsonNode resDoc = e.getRowsDoc().get("rows");
@@ -168,8 +168,8 @@ public void testWithExpressioncolumns() {
168168
p.as("divided", p.divide(p.col("amount"), p.multiply(p.col("amount"), p.viewCol("detail", "id"))))
169169
);
170170
rowsBatcherOfJsonObj.withBatchView(plan3);
171-
ArrayList<Double> exptdAmt = new ArrayList(Arrays.asList(11.01, 22.02, 31.03, 42.04, 51.05, 62.06));
172-
ArrayList<Double> resultAmt = new ArrayList<>();
171+
List<Double> exptdAmt = Arrays.asList(11.01, 22.02, 31.03, 42.04, 51.05, 62.06);
172+
List<Double> resultAmt = new ArrayList<>();
173173

174174
rowsBatcherOfJsonObj.onSuccess(e -> {
175175
JsonNode resDoc = e.getRowsDoc().get("rows");
@@ -259,9 +259,9 @@ public void testMultipleSuccessListener() {
259259
PlanBuilder p = rowMgr.newPlanBuilder();
260260
PlanBuilder.ModifyPlan plan = p.fromView("opticFunctionalTest", "detail");
261261
rowsBatcherOfJsonObj.withBatchView(plan);
262-
ArrayList<Double> exptdAmt = new ArrayList(Arrays.asList(10.01,20.02,30.03,40.04,50.05,60.06));
263-
ArrayList<Double> resultAmt1 = new ArrayList<>();
264-
ArrayList<Double> resultAmt2 = new ArrayList<>();
262+
List<Double> exptdAmt = Arrays.asList(10.01,20.02,30.03,40.04,50.05,60.06);
263+
List<Double> resultAmt1 = new ArrayList<>();
264+
List<Double> resultAmt2 = new ArrayList<>();
265265
rowsBatcherOfJsonObj.onSuccess(e ->{
266266
JsonNode resDoc = e.getRowsDoc().get("rows");
267267

@@ -364,8 +364,8 @@ public void testExceptionInSecondSuccessListener() {
364364
PlanBuilder p = rowMgr.newPlanBuilder();
365365
PlanBuilder.ModifyPlan plan = p.fromView("opticFunctionalTest", "detail");
366366
rowsBatcherOfJsonObj.withBatchView(plan);
367-
ArrayList<Double> exptdAmt = new ArrayList(Arrays.asList(10.01, 20.02, 30.03, 40.04, 50.05, 60.06));
368-
ArrayList<Double> resultAmt1 = new ArrayList<>();
367+
List<Double> exptdAmt = Arrays.asList(10.01, 20.02, 30.03, 40.04, 50.05, 60.06);
368+
List<Double> resultAmt1 = new ArrayList<>();
369369

370370
rowsBatcherOfJsonObj.onSuccess(e -> {
371371
JsonNode resDoc = e.getRowsDoc().get("rows");

marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/fastfunctest/TestDocumentFormat.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@
2626
import java.security.KeyManagementException;
2727
import java.security.NoSuchAlgorithmException;
2828

29-
30-
31-
29+
@SuppressWarnings("unchecked")
3230
public class TestDocumentFormat extends AbstractFunctionalTest {
3331

3432
@BeforeAll

marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/fastfunctest/TestDocumentMimetype.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import java.security.KeyManagementException;
1919
import java.security.NoSuchAlgorithmException;
2020

21+
@SuppressWarnings("unchecked")
2122
public class TestDocumentMimetype extends AbstractFunctionalTest {
2223

2324
@Test

marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/fastfunctest/TestEvalJavaScript.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ public void testJSReturningDifferentTypesOrder3fromModules() throws Exception {
515515
DocumentMetadataHandle metadataHandle = new DocumentMetadataHandle();
516516
metadataHandle.getPermissions().add("test-js-eval",
517517
Capability.UPDATE, Capability.READ, Capability.EXECUTE);
518-
DocumentManager dm = moduleClient.newDocumentManager();
518+
TextDocumentManager dm = moduleClient.newTextDocumentManager();
519519
dm.write("/data/javascriptQueries.sjs", metadataHandle, ish);
520520
/*DocumentBuilder db = DocumentBuilderFactory.newInstance()
521521
.newDocumentBuilder();*/
@@ -648,7 +648,7 @@ public void testJavaScriptModules() {
648648
mjsString + "export default output;" :
649649
mjsString + "output";
650650

651-
DocumentManager dm = moduleClient.newDocumentManager();
651+
TextDocumentManager dm = moduleClient.newTextDocumentManager();
652652
DocumentMetadataHandle metadataHandle = new DocumentMetadataHandle();
653653
metadataHandle.getPermissions().add("test-js-eval",
654654
Capability.UPDATE, Capability.READ, Capability.EXECUTE);

marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/fastfunctest/TestEvalXquery.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import com.marklogic.client.DatabaseClient;
99
import com.marklogic.client.FailedRequestException;
1010
import com.marklogic.client.document.DocumentManager;
11+
import com.marklogic.client.document.TextDocumentManager;
1112
import com.marklogic.client.eval.EvalResult;
1213
import com.marklogic.client.eval.EvalResult.Type;
1314
import com.marklogic.client.eval.EvalResultIterator;
@@ -413,7 +414,7 @@ public void testXqueryInvokeModuleRetDiffTypes() throws Exception {
413414
ish.set(inputStream);
414415
DocumentMetadataHandle metadataHandle = new DocumentMetadataHandle();
415416
metadataHandle.getPermissions().add("test-eval", Capability.UPDATE, Capability.READ, Capability.EXECUTE);
416-
DocumentManager dm = moduleClient.newDocumentManager();
417+
TextDocumentManager dm = moduleClient.newTextDocumentManager();
417418
dm.write("/data/xquery-modules-with-diff-variable-types.xqy", metadataHandle, ish);
418419
DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
419420
InputSource is = new InputSource();

marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/fastfunctest/TestOpticEnhancements.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import java.util.regex.Pattern;
2222

2323

24+
@SuppressWarnings("unchecked")
2425
public class TestOpticEnhancements extends AbstractFunctionalTest {
2526

2627
private static Map<String, Object>[] literals1 = new HashMap[10];

marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/fastfunctest/TestOpticOnLiterals.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import java.util.HashMap;
3232
import java.util.Map;
3333

34+
@SuppressWarnings("unchecked")
3435
public class TestOpticOnLiterals extends AbstractFunctionalTest {
3536

3637
private static Map<String, Object>[] literals1 = new HashMap[5];

marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/fastfunctest/TestOpticOnMixedViews.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
/* The tests here are for sanity checks when we have plans from different sources
2424
* such as fromLexicons and fromtriples.
2525
*/
26-
26+
@SuppressWarnings("unchecked")
2727
public class TestOpticOnMixedViews extends AbstractFunctionalTest {
2828

2929
@BeforeAll

0 commit comments

Comments
 (0)