From a825a6d1de6cfd6cfb9cdd50398b1438c5c3803f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 9 Jun 2026 01:05:44 +0000 Subject: [PATCH 1/2] Initial plan From b192958227583ea729a3d4915efa5d3755d4b0f4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 9 Jun 2026 01:14:02 +0000 Subject: [PATCH 2/2] feat: migrate project configuration toward Java 25 Co-authored-by: patrick-vuong <107423518+patrick-vuong@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- pom.xml | 18 +++++---- .../magic/resources/WizardResource.java | 2 +- .../ministry/magic/service/WizardService.java | 38 ++++++------------- 4 files changed, 24 insertions(+), 36 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e1b7507..5dafb72 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: - name: Set up JDK 11 uses: actions/setup-java@v5 with: - java-version: '11' + java-version: '25' distribution: 'temurin' cache: maven diff --git a/pom.xml b/pom.xml index 99c0f48..4623ac4 100644 --- a/pom.xml +++ b/pom.xml @@ -13,10 +13,9 @@ Ministry of Magic — Registered Wizards Management Service + 25 UTF-8 - 11 - 11 - 11 + 25 4.0.2 2.2.224 org.ministry.magic.WizardRegistryApplication @@ -117,9 +116,9 @@ org.apache.maven.plugins maven-compiler-plugin - 3.11.0 + 3.15.0 - 11 + 25 @@ -159,18 +158,18 @@ org.apache.maven.plugins maven-surefire-plugin - 3.2.2 + 3.5.6 **/*IT.java - -Dnet.bytebuddy.experimental=true + -Dnet.bytebuddy.experimental=true --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/jdk.internal.misc=ALL-UNNAMED --add-opens java.base/jdk.internal.reflect=ALL-UNNAMED org.apache.maven.plugins maven-failsafe-plugin - 3.2.2 + 3.5.6 @@ -179,6 +178,9 @@ + + --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/jdk.internal.misc=ALL-UNNAMED --add-opens java.base/jdk.internal.reflect=ALL-UNNAMED -Dnet.bytebuddy.experimental=true + diff --git a/src/main/java/org/ministry/magic/resources/WizardResource.java b/src/main/java/org/ministry/magic/resources/WizardResource.java index b831959..23b9118 100644 --- a/src/main/java/org/ministry/magic/resources/WizardResource.java +++ b/src/main/java/org/ministry/magic/resources/WizardResource.java @@ -85,7 +85,7 @@ public WizardResponse updateStatus(@PathParam("id") UUID id, String newStatus) { try { RegistrationStatus status = RegistrationStatus.valueOf(newStatus.trim().toUpperCase()); return WizardResponse.fromWizard(service.updateStatus(id, status)); - } catch (IllegalArgumentException e) { + } catch (IllegalArgumentException _) { throw new WebApplicationException("Invalid status: " + newStatus, Response.Status.BAD_REQUEST); } } diff --git a/src/main/java/org/ministry/magic/service/WizardService.java b/src/main/java/org/ministry/magic/service/WizardService.java index 487e433..58940f1 100644 --- a/src/main/java/org/ministry/magic/service/WizardService.java +++ b/src/main/java/org/ministry/magic/service/WizardService.java @@ -59,7 +59,7 @@ public List listWizards() { public List findByHouse(String house) { try { return dao.findByHouse(org.ministry.magic.core.House.valueOf(house.toUpperCase())); - } catch (IllegalArgumentException e) { + } catch (IllegalArgumentException _) { throw new WebApplicationException("Invalid house: " + house, Response.Status.BAD_REQUEST); } } @@ -67,7 +67,7 @@ public List findByHouse(String house) { public List findByStatus(String status) { try { return dao.findByStatus(RegistrationStatus.valueOf(status.toUpperCase())); - } catch (IllegalArgumentException e) { + } catch (IllegalArgumentException _) { throw new WebApplicationException("Invalid status: " + status, Response.Status.BAD_REQUEST); } } @@ -123,38 +123,24 @@ public long countActiveWizards() { } public String describeRegistrationEvent(Object event) { - if (event instanceof Wizard) { - Wizard w = (Wizard) event; + if (event instanceof Wizard w) { return "Wizard registration: " + w.getFirstName() + " " + w.getLastName(); - } else if (event instanceof String) { - String msg = (String) event; + } else if (event instanceof String msg) { return "Registry message: " + msg; - } else if (event instanceof List) { - List list = (List) event; + } else if (event instanceof List list) { return "Batch event: " + list.size() + " records"; } return "Unknown event type"; } public String getHouseDescription(org.ministry.magic.core.House house) { - String description; - switch (house) { - case GRYFFINDOR: - description = "Brave at heart, dwell in nerve and chivalry"; - break; - case HUFFLEPUFF: - description = "Just and loyal, patient and true"; - break; - case RAVENCLAW: - description = "Wit beyond measure is man's greatest treasure"; - break; - case SLYTHERIN: - description = "Cunning folk use any means to achieve their ends"; - break; - default: - description = "Unaffiliated with a Hogwarts house"; - } - return description; + return switch (house) { + case GRYFFINDOR -> "Brave at heart, dwell in nerve and chivalry"; + case HUFFLEPUFF -> "Just and loyal, patient and true"; + case RAVENCLAW -> "Wit beyond measure is man's greatest treasure"; + case SLYTHERIN -> "Cunning folk use any means to achieve their ends"; + default -> "Unaffiliated with a Hogwarts house"; + }; } public String buildWizardSummaryHtml(Wizard wizard) {