Skip to content

feat: Java 21 modernization — awt - #4

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

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

Conversation

@devin-ai-integration

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

Copy link
Copy Markdown

Description of the Change

Conservative Java 21 modernization of the gov.nasa.worldwind.awt package. All changes are internal implementation details — zero public API surface changes.

Before → After counts:

Pattern Before After Delta
instanceof with subsequent cast 2 0 −2
instanceof guard-only (no cast) 2 2 0
switch statements (SAM candidates) 0 0 0
Redundant diamond type args 4 0 −4

Changes applied (3 files, 8 insertions, 8 deletions):

  1. AWTInputHandler.javainstanceof GLJPanel + cast → pattern variable glJPanel
  2. AbstractViewInputHandler.javainstanceof OrbitView + cast → pattern variable orbitView
  3. ViewInputAttributes.java — 4× new HashMap<Type, Type>()new HashMap<>()

Why Should This Be In Core?

Part of the Java 21 migration initiative. These modernizations reduce boilerplate, improve type safety, and prepare the codebase for future Java LTS releases. Branched from devin/java21-foundation.

Benefits

  • Eliminates 2 unchecked casts via instanceof pattern matching (JEP 394)
  • Removes 4 redundant type arguments via diamond operator
  • Verified build with JDK 21 (ant -f release-build.xml — BUILD SUCCESSFUL)
  • No behavioral changes — pure syntactic modernization

Potential Drawbacks

None. All changes are source-compatible and produce identical bytecode semantics.

Applicable Issues

Java 21 migration initiative — awt package scope.


Build verdict:ant -f release-build.xml passes with JDK 21 (1 pre-existing deprecation warning in CachedDataRaster.java — not in scope)

Public API diff: No changes to public/protected method signatures, class hierarchies, or field declarations.

Flagged for review: None — all changes are mechanical and safe.

Session: https://app.devin.ai/sessions/933ff30a792440c2a13bd6e0e146d9e0

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
- instanceof pattern matching: 2 conversions (GLJPanel, OrbitView)
- Diamond operator: 4 redundant type arguments removed (ViewInputAttributes)
- No public API changes
- Build verified with JDK 21

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 awt: src/gov/nasa/worldwind/awt/. Branch from origin/devin/java21-foundation into devin/java21-awt. 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 — awt", 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