feat: Java 21 modernization — awt - #4
Conversation
- 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]>
Original prompt from Jake
|
🤖 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:
|
Description of the Change
Conservative Java 21 modernization of the
gov.nasa.worldwind.awtpackage. All changes are internal implementation details — zero public API surface changes.Before → After counts:
instanceofwith subsequent castinstanceofguard-only (no cast)switchstatements (SAM candidates)Changes applied (3 files, 8 insertions, 8 deletions):
AWTInputHandler.java—instanceof GLJPanel+ cast → pattern variableglJPanelAbstractViewInputHandler.java—instanceof OrbitView+ cast → pattern variableorbitViewViewInputAttributes.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
instanceofpattern matching (JEP 394)ant -f release-build.xml— BUILD SUCCESSFUL)Potential Drawbacks
None. All changes are source-compatible and produce identical bytecode semantics.
Applicable Issues
Java 21 migration initiative —
awtpackage scope.Build verdict: ✅
ant -f release-build.xmlpasses with JDK 21 (1 pre-existing deprecation warning inCachedDataRaster.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