Skip to content

feat: Java 21 modernization — symbology - #9

Open
devin-ai-integration[bot] wants to merge 3 commits into
developfrom
devin/java21-symbology
Open

feat: Java 21 modernization — symbology#9
devin-ai-integration[bot] wants to merge 3 commits into
developfrom
devin/java21-symbology

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented May 26, 2026

Copy link
Copy Markdown

Description of the Change

Java 21 modernization of the src/gov/nasa/worldwind/symbology/ package. Converts all 50 instanceof-then-cast patterns to pattern matching instanceof (JEP 394, finalized in Java 16).

Before / After Counts

Pattern Before After
instanceof with cast (old style) 50 0
Pattern matching instanceof 0 50
SAM anonymous inner classes 0 0

26 files touched across the symbology package hierarchy — no public API signatures changed, no test files modified, no unrelated packages touched.

Why Should This Be In Core?

Part of the systematic Java 21 migration effort. Pattern matching instanceof eliminates redundant casts, reducing boilerplate and the risk of ClassCastException from mismatched type checks and casts.

Benefits

  • Eliminates 50 redundant explicit casts — the compiler guarantees type safety via pattern variables
  • Improved readabilityif (o instanceof Color color) is clearer than if (o instanceof Color) { Color c = (Color) o; ... }
  • Removes stale Java 7 workaround comments — e.g. "Store the Iterable in an unnecessary variable to suppress Java 7 compiler warnings on Windows"
  • Zero behavioral change — every conversion is a mechanical refactor with identical semantics

Potential Drawbacks

None. Pattern matching instanceof has been stable since Java 16 and is a drop-in replacement for the traditional check-then-cast idiom.

Applicable Issues

Java 21 migration initiative. Branched from devin/java21-foundation.


Build verification: ant -f release-build.xml passes cleanly on JDK 21 (only pre-existing deprecation warning for System.runFinalization()).

Public API diff check: git diff --stat on public method signatures shows zero changes.

Verdict: Safe to merge — mechanical refactor only, no semantic changes.

Session: https://app.devin.ai/sessions/3d8ea42a306c4bba95b3eacb06af22f2

Requested by: @jakexcosme


Devin Review

Status Commit
⚪ Not started

Run Devin Review

💡 Connect your GitHub account to enable automatic code reviews.

Open in Devin Review (Staging)

devin-ai-integration Bot and others added 3 commits May 26, 2026 15:45
Convert 50 instanceof-then-cast patterns to pattern matching instanceof
across 26 files in src/gov/nasa/worldwind/symbology/.

No SAM anonymous inner classes found in this package.

Changes are internal only — no public API, test, or unrelated changes.

Co-Authored-By: Jake Cosme <[email protected]>
@devin-ai-integration

Copy link
Copy Markdown
Author
Original prompt from Jake

You are a child Devin session for COG-GTM/WorldWindJava Java 21 migration. Authorized to start. Work ONLY on package symbology: src/gov/nasa/worldwind/symbology/. Branch from origin/devin/java21-foundation into devin/java21-symbology. Target PR base develop. Follow package workflow: pre-count SAM/instanceof, conservative Java 21 modernizations, no public API/test/unrelated changes, JDK21 ant -f release-build.xml, public API diff check, PR title "feat: Java 21 modernization — symbology", body with before/after counts/rationale/session/verdict/flags. Return structured output.

@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

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