refactor: Modernize codebase from Java 7 to Java 8 - #36
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
refactor: Modernize codebase from Java 7 to Java 8#36devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
- Update jackson-datatype-jdk7 to jackson-datatype-jdk8 in BulkDownloader - Replace Jdk7Module with Jdk8Module in DownloadJob - Apply diamond operator (<>) across all modules (~100 files) - Convert for-loops to streams/lambdas in core classes: - Patent, Description, ClaimTreeBuilder, Figure - JsonMapper, JsonMapperFlat (mapDocIds, toJsonArray, valueOrEmpty) - FormattedText (sgml, xml) getParagraphText - Filter classes (FileFilterChain, StringFilterChain, SuffixFilter, etc.) - StopWord (contains, remove methods) - DownloadJob (getTaskCompleted) - Modernize date handling with java.time APIs: - DocumentDate: Calendar -> java.time.LocalDate/ZoneOffset - CertificateValidator: java.util.Date -> java.time.Instant - Use method references where applicable (forEach, map, filter) - Use Collections.addAll instead of manual loops - Update README with Java 8 prerequisites, build instructions, and features - Update .gitignore for IDE files Co-Authored-By: Sam Fertig <sam.huntfertig@gmail.com>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
refactor: Modernize codebase from Java 7 to Java 8
Summary
Upgrades the codebase to use Java 8 language features and APIs across all four modules (Common, PatentDocument, BulkDownloader, AuthenticationService). Key changes:
<>): Applied across ~120 files to remove redundant generic type parametersDescription,Patent,ClaimTreeBuilder,StopWord,JsonMapper,JsonMapperFlat, filter chain classes,DownloadJob)java.timeAPI: Replacedjava.util.Date/CalendarwithInstantinCertificateValidatorandZoneOffset-based date handling inDocumentDatejackson-datatype-jdk7→jackson-datatype-jdk8and updatedJdk7Module→Jdk8ModuleinDownloadJobAll 3 test failures observed (
OrgSynonymGeneratorTest,FormattedTextCustomizeTest,FormattedTextTest) are pre-existing onmaster— verified by running the test suite on the unmodified code.Review & Testing Checklist for Human
jackson-datatype-jdk7tojackson-datatype-jdk8is NOT a drop-in replacement. These modules serve different purposes:jdk7: Supports Java 7 types likejava.nio.file.Pathjdk8: Supports Java 8 types likeOptional<T>,Stream<T>Since
DownloadJobserializesPath downloadDir(line 40), this could break serialization/deserialization at runtime:DownloadJob.save(), thenDownloadJob.restore()to verify serialization works with the new Jackson moduleDownloadJob)Pathserialization still works: The originalJdk7Moduleexplicitly handledjava.nio.file.Path. Confirm this works withJdk8Moduleor if the module swap needs to be reconsideredOther items to verify:
CertificateValidator.validateValidity()now usesInstantinstead ofDate. Test certificate expiry/validity checks to ensure logic is preservedremove(String text)method now usesCollectors.joining(" ")instead ofStringBuilder. Test with edge cases (leading/trailing whitespace, multiple spaces) to ensure output matches original behaviorgetAllRawText(),getPlainText()were converted to streams withCollectors.joining. Verify output formatting (newlines, empty lines) matches original for-loop behaviorRecommended test plan:
mvn clean test(should see same 3 pre-existing failures, no new failures)DownloadJobpersistence)Notes
Link to Devin Session: https://app.devin.ai/sessions/21dd7debe9874a0c97b827935b483a71
Requested by: @samfert