-
Notifications
You must be signed in to change notification settings - Fork 74
MLE-23146 Address compile warnings in src/main/java #1810
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR addresses compilation warnings across the MarkLogic Java Client API codebase by fixing unchecked operations, deprecation warnings, and other code quality issues. The changes improve type safety and modernize the codebase to reduce compiler warnings.
Key changes include:
- Added generic type parameters to collections and removed raw type usage
- Replaced deprecated API calls with modern alternatives
- Added
@SuppressWarnings
annotations where necessary for unavoidable warnings - Updated method calls to use current non-deprecated versions
Reviewed Changes
Copilot reviewed 36 out of 36 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
IOTestUtil.java | Added @SafeVarargs annotation and removed unused method |
XMLSplitterTest.java | Added generic types to XMLSplitter instances and fixed File constructor |
QueryBatcherTest.java | Added generic types to Set declaration |
JacksonCSVSplitterTest.java | Updated deprecated fields() call to properties() |
JSONSplitterTest.java | Added generic types to JSONSplitter instances |
ApplyTransformTest.java | Added generic type to List declaration |
PlanExpressionTest.java | Fixed array parameter usage |
JacksonStreamTest.java | Updated deprecated getCurrentName() calls and removed unused import |
JacksonHandleTest.java | Replaced deprecated put() calls with set() |
BulkReadWriteTest.java | Added proper charset encoding and exception handling |
DatabaseClientPropertySourceTest.java | Simplified HashMap initialization |
Multiple test files | Added @SuppressWarnings annotations and updated deprecated method calls |
// test with 1 arg | ||
String contents; | ||
try { | ||
contents = URLEncoder.encode(uri, "UTF-8").replaceFirst(".*", regex); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using StandardCharsets.UTF_8 instead of the hardcoded "UTF-8" string to avoid potential typos and improve code maintainability.
contents = URLEncoder.encode(uri, "UTF-8").replaceFirst(".*", regex); | |
contents = URLEncoder.encode(uri, StandardCharsets.UTF_8.name()).replaceFirst(".*", regex); |
Copilot uses AI. Check for mistakes.
@@ -1402,7 +1433,7 @@ public JsonNode expectedJSONDocument(String filename) throws JsonParseException, | |||
// get json document for expected result | |||
ObjectMapper mapper = new ObjectMapper(); | |||
JsonFactory jfactory = new JsonFactory(); | |||
JsonParser jParser = jfactory.createJsonParser(new File("src/test/java/com/marklogic/client/functionaltest/data/" + filename)); | |||
JsonParser jParser = jfactory.createParser(new File("src/test/java/com/marklogic/client/functionaltest/data/" + filename)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider using Path.of() or Paths.get() with proper path separators instead of string concatenation for file paths to improve cross-platform compatibility.
JsonParser jParser = jfactory.createParser(new File("src/test/java/com/marklogic/client/functionaltest/data/" + filename)); | |
JsonParser jParser = jfactory.createParser(new File(Path.of("src", "test", "java", "com", "marklogic", "client", "functionaltest", "data", filename).toString())); |
Copilot uses AI. Check for mistakes.
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.
ae13e3b
to
b73461f
Compare
Copilot got a little carried away and knocked out some issues in src/test/java too. More to come after this PR.
Addresses unchecked and deprecation warnings by:
finalize()
methods.