Skip to content

Comments

MLE-26918 Refactor: Changed config class back to a non-record class#1910

Merged
rjrudin merged 1 commit intodevelopfrom
feature/26918-no-record
Feb 23, 2026
Merged

MLE-26918 Refactor: Changed config class back to a non-record class#1910
rjrudin merged 1 commit intodevelopfrom
feature/26918-no-record

Conversation

@rjrudin
Copy link
Contributor

@rjrudin rjrudin commented Feb 23, 2026

Had a discussion with Copilot, agreed that a record isn't a fit here as it implies immutability but that's not currently the case.

Had a discussion with Copilot, agreed that a record isn't a fit here as it implies immutability but that's not currently the case.
@rjrudin rjrudin requested a review from BillFarber as a code owner February 23, 2026 19:47
Copilot AI review requested due to automatic review settings February 23, 2026 19:47
@rjrudin rjrudin requested a review from stevebio as a code owner February 23, 2026 19:47
@github-actions
Copy link

Copyright Validation Results
Total: 4 | Passed: 4 | Failed: 0 | Skipped: 0 | at: 2026-02-23 19:48:24 UTC | commit: 7d44a69

✅ Valid Files

  • marklogic-client-api/src/main/java/com/marklogic/client/datamovement/filter/IncrementalWriteConfig.java
  • marklogic-client-api/src/main/java/com/marklogic/client/datamovement/filter/IncrementalWriteFilter.java
  • marklogic-client-api/src/main/java/com/marklogic/client/datamovement/filter/IncrementalWriteFromLexiconsFilter.java
  • marklogic-client-api/src/main/java/com/marklogic/client/datamovement/filter/IncrementalWriteFromViewFilter.java

✅ All files have valid copyright headers!

Copy link

Copilot AI left a 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 pull request refactors IncrementalWriteConfig from a Java record to a regular class with explicit field declarations, constructor, and getter methods. The decision was made because the class does not maintain true immutability despite the record's immutability semantics.

Changes:

  • Converted IncrementalWriteConfig from a record to a standard class with private final fields and public getter methods
  • Updated all accessor calls across three filter classes to use standard getter method syntax instead of record accessor syntax
  • Maintained the custom getXmlNamespaces() behavior that returns an empty map instead of null

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
IncrementalWriteConfig.java Refactored from record to class with explicit fields, constructor, and getter methods
IncrementalWriteFilter.java Updated all config accessor calls to use getter methods (e.g., config.hashKeyName()config.getHashKeyName())
IncrementalWriteFromViewFilter.java Updated config accessor calls to use getter methods
IncrementalWriteFromLexiconsFilter.java Updated config accessor call to use getter method

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +60 to +62
public String[] getJsonExclusions() {
return jsonExclusions;
}
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The array fields jsonExclusions and xmlExclusions should be defensively copied in their getters to prevent external modification. Unlike Java records which automatically provide defensive copies for arrays, the current implementation allows callers to modify the internal array state. Consider returning Arrays.copyOf(jsonExclusions, jsonExclusions.length) or jsonExclusions != null ? jsonExclusions.clone() : null instead of returning the array directly.

Copilot uses AI. Check for mistakes.
@Override
public Map<String, String> xmlNamespaces() {
public String[] getXmlExclusions() {
return xmlExclusions;
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The array field xmlExclusions should be defensively copied in its getter to prevent external modification. Unlike Java records which automatically provide defensive copies for arrays, the current implementation allows callers to modify the internal array state. Consider returning Arrays.copyOf(xmlExclusions, xmlExclusions.length) or xmlExclusions != null ? xmlExclusions.clone() : null instead of returning the array directly.

Suggested change
return xmlExclusions;
return xmlExclusions != null ? xmlExclusions.clone() : null;

Copilot uses AI. Check for mistakes.
@rjrudin rjrudin merged commit 5f25dcc into develop Feb 23, 2026
9 checks passed
@rjrudin rjrudin deleted the feature/26918-no-record branch February 23, 2026 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants