Skip to content

modernize: upgrade to Java 17, Dropwizard 4.0.9, and apply code quality recipes#109

Open
PaulaPaul wants to merge 1 commit into
mainfrom
agents/modernization-efforts
Open

modernize: upgrade to Java 17, Dropwizard 4.0.9, and apply code quality recipes#109
PaulaPaul wants to merge 1 commit into
mainfrom
agents/modernization-efforts

Conversation

@PaulaPaul

Copy link
Copy Markdown

Summary

This PR modernizes the Wizard Registry Dropwizard 4 service, applying automated Java and dependency upgrades via Moderne CLI and OpenRewrite recipes.

Based on Moderne Prethink context (dependencies, test gaps, project identity), the following areas were identified as high priority:

  • Java 11 → 17 (LTS upgrade with new language features available)
  • Dropwizard 4.0.2 → 4.0.9 (security vulnerability fixes)
  • Code quality: instanceof casts, SQL string concatenation, import ordering, test naming conventions

Recipes Applied

1. org.openrewrite.java.migrate.UpgradeToJava17

  • Bumps maven.compiler.source/target/release from 11 → 17
  • Upgrades maven-compiler-plugin 3.11.0 → 3.15.0
  • Applies instanceof pattern matching in WizardService.describeRegistrationEvent()
  • Updates CI workflow to JDK 17

2. org.openrewrite.java.migrate.lang.UseTextBlocks

  • Converts multi-line SQL string concatenation in WizardDAO to Java 15 text blocks
  • Affects: CREATE TABLE, INSERT, and UPDATE queries — much more readable

3. org.openrewrite.staticanalysis.CommonStaticAnalysis

  • Sorts imports to canonical order (jakarta., java., then 3rd-party)
  • Removes unused imports (ConfigurationException, IOException in tests)
  • Replaces wildcard Mockito import with explicit imports in WizardServiceTest

4. org.openrewrite.java.dependencies.DependencyVulnerabilityCheck

  • Upgrades Dropwizard 4.0.2 → 4.0.9 (security CVE patches)
  • Removes pinned h2.version property (now managed by Dropwizard BOM)

5. org.openrewrite.java.testing.junit5.JUnit5BestPractices

  • Removes test prefix from test method names per JUnit 5 convention
  • Removes redundant checked exception declarations from test signatures

6. org.openrewrite.maven.BestPractices

  • Sorts dependency declarations alphabetically within groups

Test Results

All 22 tests pass after modernization:

  • 11 unit tests (WizardServiceTest + WizardRegistryConfigurationTest)
  • 11 integration tests (WizardRegistryApplicationIT with DropwizardAppExtension + H2)

Prethink Risk Analysis

The top-risk untested methods (from test-gaps.csv) were considered but these recipes focus on automated safe transformations only — the application logic is unchanged.


This change was produced with Moderne CLI and Moderne Agent Tools (MCP), informed by Moderne Prethink context (dependencies, test gaps, project identity).

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

…ty recipes

Based on Moderne Prethink context (dependencies, test gaps, project identity):

## Changes applied via OpenRewrite/Moderne recipes

### Java 17 Migration (org.openrewrite.java.migrate.UpgradeToJava17)
- Bump maven.compiler.source/target/release from 11 → 17
- Upgrade maven-compiler-plugin 3.11.0 → 3.15.0
- Apply instanceof pattern matching in WizardService.describeRegistrationEvent()
  (e.g. `if (event instanceof Wizard w)` instead of cast)
- Update CI workflow to use JDK 17

### Text Blocks (org.openrewrite.java.migrate.lang.UseTextBlocks)
- Convert multi-line SQL string concatenation in WizardDAO to text blocks
  (createTable, insert, and update queries are now far more readable)

### Common Static Analysis (org.openrewrite.staticanalysis.CommonStaticAnalysis)
- Sort imports to canonical order (jakarta.*, java.*, then 3rd-party)
- Remove unused imports (ConfigurationException, IOException in tests)
- Replace wildcard Mockito import with explicit imports in WizardServiceTest

### Dependency Vulnerability Fixes (org.openrewrite.java.dependencies.DependencyVulnerabilityCheck)
- Upgrade Dropwizard 4.0.2 → 4.0.9 (patches security CVEs)
- Remove pinned h2.version property (now managed by Dropwizard BOM)

### JUnit 5 Best Practices (org.openrewrite.java.testing.junit5.JUnit5BestPractices)
- Remove 'test' prefix from test method names per JUnit 5 convention
  (e.g. testSupportAccessible → supportAccessible in IT tests)
- Remove redundant exception declarations from test method signatures

### Maven Best Practices (org.openrewrite.maven.BestPractices)
- Sort dependency declarations alphabetically within groups

All 22 tests pass after modernization (11 unit + 11 integration tests).

This change was produced with Moderne CLI and Moderne Agent Tools (MCP),
informed by Moderne Prethink context (dependencies, test gaps, project identity).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

1 participant