From e10eaf4008837b715a56da5c27d6eeee581a5427 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Tue, 26 May 2026 15:45:18 +0000 Subject: [PATCH 1/3] feat: retarget build to JDK 21 --- .travis.yml | 2 +- BASELINE-METRICS.txt | 33 +++++++++++++++++++++++++++++++++ nbproject/project.properties | 4 ++-- release-build.properties | 2 +- release-build.xml | 2 +- 5 files changed, 38 insertions(+), 5 deletions(-) create mode 100644 BASELINE-METRICS.txt diff --git a/.travis.yml b/.travis.yml index 0eadda7688..909b77aa12 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ language: java # Configure the build to use Oracle JDK 9 jdk: - - openjdk11 + - openjdk21 # Install the Ant JUnit package, which is missing from the Travis CI environment. See the Travis documentation: https://docs.travis-ci.com/user/installing-dependencies/#Adding-APT-Packages addons: diff --git a/BASELINE-METRICS.txt b/BASELINE-METRICS.txt new file mode 100644 index 0000000000..565ee9692c --- /dev/null +++ b/BASELINE-METRICS.txt @@ -0,0 +1,33 @@ +WorldWindJava Java 11 Pre-Migration Baseline +Captured: 2026-05-26T15:41:55Z +Branch: develop +Commit: 2543c234349c76f4a290e318b49f071ac156d2a0 + +JDK: +openjdk version "11.0.30" 2026-01-20 +OpenJDK Runtime Environment (build 11.0.30+7-post-Ubuntu-1ubuntu122.04) +OpenJDK 64-Bit Server VM (build 11.0.30+7-post-Ubuntu-1ubuntu122.04, mixed mode, sharing) + +File count +src java files: 1727 + +Anonymous inner class counts +new Runnable(): 148 +new ActionListener(): 185 +new Callable(): 0 +new MouseListener(): 2 +new KeyListener(): 0 +new ChangeListener(): 60 +new PropertyChangeListener(): 44 +new WindowListener(): 0 + +instanceof pattern-match candidates +instanceof: 1303 + +Deprecated usage +@Deprecated: 131 +new Integer(: 0 +new Double(: 0 +new Float(: 0 +new Long(: 0 +new Boolean(: 0 diff --git a/nbproject/project.properties b/nbproject/project.properties index fab181db51..de8a7bdfc9 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -56,8 +56,8 @@ javac.modulepath= javac.processormodulepath= javac.processorpath=\ ${javac.classpath} -javac.source=11 -javac.target=11 +javac.source=21 +javac.target=21 javac.test.classpath=\ ${javac.classpath}:\ ${build.classes.dir} diff --git a/release-build.properties b/release-build.properties index cde1c0e4de..689b787445 100644 --- a/release-build.properties +++ b/release-build.properties @@ -38,7 +38,7 @@ worldwind.classes.dir=${worldwind.build.dir}/classes worldwind.doc.dir=${worldwind.build.dir}/doc worldwind.jar.dir=${worldwind.build.dir}/jar worldwind.test.results.dir=${worldwind.build.dir}/test-results -worldwind.jdk=11 +worldwind.jdk=21 #worldwind.exclude.jackson=true # MIL-STD-2525 package build properties diff --git a/release-build.xml b/release-build.xml index 9810ad732d..7948d88789 100644 --- a/release-build.xml +++ b/release-build.xml @@ -126,7 +126,7 @@ - + From 84c5d2accd1cad57e666ba61e7312fc91a3434e5 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Tue, 26 May 2026 15:46:31 +0000 Subject: [PATCH 2/3] chore: keep foundation diff to build config only --- BASELINE-METRICS.txt | 33 --------------------------------- 1 file changed, 33 deletions(-) delete mode 100644 BASELINE-METRICS.txt diff --git a/BASELINE-METRICS.txt b/BASELINE-METRICS.txt deleted file mode 100644 index 565ee9692c..0000000000 --- a/BASELINE-METRICS.txt +++ /dev/null @@ -1,33 +0,0 @@ -WorldWindJava Java 11 Pre-Migration Baseline -Captured: 2026-05-26T15:41:55Z -Branch: develop -Commit: 2543c234349c76f4a290e318b49f071ac156d2a0 - -JDK: -openjdk version "11.0.30" 2026-01-20 -OpenJDK Runtime Environment (build 11.0.30+7-post-Ubuntu-1ubuntu122.04) -OpenJDK 64-Bit Server VM (build 11.0.30+7-post-Ubuntu-1ubuntu122.04, mixed mode, sharing) - -File count -src java files: 1727 - -Anonymous inner class counts -new Runnable(): 148 -new ActionListener(): 185 -new Callable(): 0 -new MouseListener(): 2 -new KeyListener(): 0 -new ChangeListener(): 60 -new PropertyChangeListener(): 44 -new WindowListener(): 0 - -instanceof pattern-match candidates -instanceof: 1303 - -Deprecated usage -@Deprecated: 131 -new Integer(: 0 -new Double(: 0 -new Float(: 0 -new Long(: 0 -new Boolean(: 0 From d6a4c82c9da397c15731ad9410a3684886d9569f Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Tue, 26 May 2026 16:18:04 +0000 Subject: [PATCH 3/3] =?UTF-8?q?feat:=20Java=2021=20modernization=20?= =?UTF-8?q?=E2=80=94=20terrain?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../worldwind/terrain/CompoundElevationModel.java | 12 ++++++------ .../nasa/worldwind/terrain/LocalElevationModel.java | 8 ++++---- .../worldwind/terrain/RectangularTessellator.java | 11 +++++------ .../nasa/worldwind/terrain/SectorGeometryList.java | 8 ++++---- .../nasa/worldwind/terrain/WCSElevationModel.java | 4 ++-- .../worldwind/terrain/WMSBasicElevationModel.java | 4 ++-- 6 files changed, 23 insertions(+), 24 deletions(-) diff --git a/src/gov/nasa/worldwind/terrain/CompoundElevationModel.java b/src/gov/nasa/worldwind/terrain/CompoundElevationModel.java index 56eb6653f0..a53675419e 100644 --- a/src/gov/nasa/worldwind/terrain/CompoundElevationModel.java +++ b/src/gov/nasa/worldwind/terrain/CompoundElevationModel.java @@ -76,9 +76,9 @@ public boolean containsElevationModel(ElevationModel em) // Check if the elevation model is a child of any CompoundElevationModels in our list. for (ElevationModel child : this.elevationModels) { - if (child instanceof CompoundElevationModel) + if (child instanceof CompoundElevationModel compoundChild) { - if (((CompoundElevationModel) child).containsElevationModel(em)) + if (compoundChild.containsElevationModel(em)) return true; } } @@ -174,8 +174,8 @@ public void removeElevationModel(ElevationModel em) for (ElevationModel child : this.elevationModels) { - if (child instanceof CompoundElevationModel) - ((CompoundElevationModel) child).removeElevationModel(em); + if (child instanceof CompoundElevationModel compoundChild) + compoundChild.removeElevationModel(em); } this.elevationModels.remove(em); @@ -743,9 +743,9 @@ public double getUnmappedLocalSourceElevation(Angle latitude, Angle longitude) for (int i = this.elevationModels.size() - 1; i >= 0; i--) { ElevationModel em = this.elevationModels.get(i); - if (em instanceof BasicElevationModel && em.isEnabled()) + if (em instanceof BasicElevationModel basicElevationModel && em.isEnabled()) { - double e = ((BasicElevationModel) em).getUnmappedLocalSourceElevation(latitude, longitude); + double e = basicElevationModel.getUnmappedLocalSourceElevation(latitude, longitude); if (e != em.getMissingDataSignal()) { elevation = e; diff --git a/src/gov/nasa/worldwind/terrain/LocalElevationModel.java b/src/gov/nasa/worldwind/terrain/LocalElevationModel.java index 2007d45c4f..da3ad80a08 100644 --- a/src/gov/nasa/worldwind/terrain/LocalElevationModel.java +++ b/src/gov/nasa/worldwind/terrain/LocalElevationModel.java @@ -472,11 +472,11 @@ public void addElevations(ByteBuffer byteBuffer, Sector sector, int width, int h Double minElevation = null; Double maxElevation = null; Object o = bufferParams.getValue(AVKey.ELEVATION_MIN); - if (o instanceof Double) - minElevation = (Double) o; + if (o instanceof Double min) + minElevation = min; o = bufferParams.getValue(AVKey.ELEVATION_MAX); - if (o instanceof Double) - maxElevation = (Double) o; + if (o instanceof Double max) + maxElevation = max; String dataType = bufferParams.getStringValue(AVKey.DATA_TYPE); if (WWUtil.isEmpty(dataType)) diff --git a/src/gov/nasa/worldwind/terrain/RectangularTessellator.java b/src/gov/nasa/worldwind/terrain/RectangularTessellator.java index 07ea6ba500..597536e8d4 100644 --- a/src/gov/nasa/worldwind/terrain/RectangularTessellator.java +++ b/src/gov/nasa/worldwind/terrain/RectangularTessellator.java @@ -886,8 +886,8 @@ protected void renderVA(DrawContext dc, RectTile tile, int numTextureUnits) gl.glClientActiveTexture(GL2.GL_TEXTURE0 + i); gl.glEnableClientState(GL2.GL_TEXTURE_COORD_ARRAY); Object texCoords = dc.getValue(AVKey.TEXTURE_COORDINATES); - if (texCoords != null && texCoords instanceof DoubleBuffer) - gl.glTexCoordPointer(2, GL.GL_FLOAT, 0, ((DoubleBuffer) texCoords).rewind()); + if (texCoords instanceof DoubleBuffer doubleBuffer) + gl.glTexCoordPointer(2, GL.GL_FLOAT, 0, doubleBuffer.rewind()); else gl.glTexCoordPointer(2, GL.GL_FLOAT, 0, tile.ri.texCoords.rewind()); } @@ -1121,8 +1121,8 @@ protected void renderBoundingVolume(DrawContext dc, RectTile tile) if (extent == null) return; - if (extent instanceof Renderable) - ((Renderable) extent).render(dc); + if (extent instanceof Renderable renderable) + renderable.render(dc); } protected void renderTileID(DrawContext dc, RectTile tile) @@ -1565,9 +1565,8 @@ protected Intersection[] intersect(RectTile tile, double elevation) // Check whether the tile includes the intersection elevation - assume cylinder as Extent // TODO: replace this test with a generic test against Extent - if (tile.getExtent() instanceof Cylinder) + if (tile.getExtent() instanceof Cylinder cylinder) { - Cylinder cylinder = ((Cylinder) tile.getExtent()); if (!(globe.isPointAboveElevation(cylinder.getBottomCenter(), elevation) ^ globe.isPointAboveElevation(cylinder.getTopCenter(), elevation))) return null; diff --git a/src/gov/nasa/worldwind/terrain/SectorGeometryList.java b/src/gov/nasa/worldwind/terrain/SectorGeometryList.java index e23cd94d6f..e8f2b7a6dd 100644 --- a/src/gov/nasa/worldwind/terrain/SectorGeometryList.java +++ b/src/gov/nasa/worldwind/terrain/SectorGeometryList.java @@ -102,8 +102,8 @@ public void beginRendering(DrawContext dc) { } // TODO: add the beginRendering interface to Tessellator in order to eliminate this type test - if (dc.getGlobe().getTessellator() instanceof RectangularTessellator) { - ((RectangularTessellator) dc.getGlobe().getTessellator()).beginRendering(dc); + if (dc.getGlobe().getTessellator() instanceof RectangularTessellator tessellator) { + tessellator.beginRendering(dc); } } @@ -120,8 +120,8 @@ public void endRendering(DrawContext dc) { throw new IllegalStateException(message); } - if (dc.getGlobe().getTessellator() instanceof RectangularTessellator) { - ((RectangularTessellator) dc.getGlobe().getTessellator()).endRendering(dc); + if (dc.getGlobe().getTessellator() instanceof RectangularTessellator tessellator) { + tessellator.endRendering(dc); } } diff --git a/src/gov/nasa/worldwind/terrain/WCSElevationModel.java b/src/gov/nasa/worldwind/terrain/WCSElevationModel.java index 615d3ab925..d550d7834f 100644 --- a/src/gov/nasa/worldwind/terrain/WCSElevationModel.java +++ b/src/gov/nasa/worldwind/terrain/WCSElevationModel.java @@ -400,9 +400,9 @@ protected void downloadElevations(WMSBasicElevationModel.ElevationCompositionTil public void getRestorableStateForAVPair(String key, Object value, RestorableSupport rs, RestorableSupport.StateObject context) { - if (value instanceof URLBuilder) + if (value instanceof URLBuilder urlBuilder) { - rs.addStateValueAsString(context, AVKey.WCS_VERSION, ((URLBuilder) value).serviceVersion); + rs.addStateValueAsString(context, AVKey.WCS_VERSION, urlBuilder.serviceVersion); } else if (!(value instanceof WCS100DescribeCoverage)) { diff --git a/src/gov/nasa/worldwind/terrain/WMSBasicElevationModel.java b/src/gov/nasa/worldwind/terrain/WMSBasicElevationModel.java index 0d54437588..f6baf995f3 100644 --- a/src/gov/nasa/worldwind/terrain/WMSBasicElevationModel.java +++ b/src/gov/nasa/worldwind/terrain/WMSBasicElevationModel.java @@ -537,9 +537,9 @@ protected boolean isDeleteOnExit(File outFile) public void getRestorableStateForAVPair(String key, Object value, RestorableSupport rs, RestorableSupport.StateObject context) { - if (value instanceof URLBuilder) + if (value instanceof URLBuilder urlBuilder) { - rs.addStateValueAsString(context, "wms.Version", ((URLBuilder) value).wmsVersion); + rs.addStateValueAsString(context, "wms.Version", urlBuilder.wmsVersion); rs.addStateValueAsString(context, "wms.Crs", ((URLBuilder) value).crs); } else