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 48e6f90a1a24a78926f22cf783baa5becc4c66f7 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:54:06 +0000 Subject: [PATCH 3/3] =?UTF-8?q?feat:=20Java=2021=20modernization=20?= =?UTF-8?q?=E2=80=94=20wms?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Diamond operator (<>): 16 redundant type arguments removed across 5 files - Pattern matching instanceof: 3 casts eliminated (Capabilities.java, WMSTiledImageLayer.java) - Lambda expression: 1 anonymous RetrievalPostProcessor replaced (Capabilities.java) - StringBuffer → StringBuilder: 2 local-scope usages converted (Request.java, WMSTiledImageLayer.java) - Raw-type cast cleanup: 5 unnecessary (Map.Entry) casts removed (Request.java) No public API changes. Build verified with JDK 21. Co-Authored-By: Jake Cosme --- src/gov/nasa/worldwind/wms/Capabilities.java | 37 ++++++++----------- .../nasa/worldwind/wms/CapabilitiesV111.java | 4 +- .../nasa/worldwind/wms/CapabilitiesV130.java | 4 +- src/gov/nasa/worldwind/wms/Request.java | 14 +++---- .../worldwind/wms/WMSTiledImageLayer.java | 12 +++--- 5 files changed, 33 insertions(+), 38 deletions(-) diff --git a/src/gov/nasa/worldwind/wms/Capabilities.java b/src/gov/nasa/worldwind/wms/Capabilities.java index 3d81fe5c6f..8f89b0a74b 100644 --- a/src/gov/nasa/worldwind/wms/Capabilities.java +++ b/src/gov/nasa/worldwind/wms/Capabilities.java @@ -83,13 +83,8 @@ public static Capabilities retrieve(URI uri, String service, Integer connectTime CapabilitiesRequest req = new CapabilitiesRequest(uri, service); URL capsURL = req.getUri().toURL(); - URLRetriever retriever = URLRetriever.createRetriever(capsURL, new RetrievalPostProcessor() - { - public ByteBuffer run(Retriever retriever) - { - return retriever.getBuffer(); - } - }); + URLRetriever retriever = URLRetriever.createRetriever(capsURL, + (Retriever r) -> r.getBuffer()); if (retriever == null) { @@ -281,7 +276,7 @@ protected String[] getUniqueText(Element context, String path) if (strings == null) return null; - ArrayList sarl = new ArrayList(); + ArrayList sarl = new ArrayList<>(); for (String s : strings) { if (!sarl.contains(s)) @@ -300,7 +295,7 @@ protected Element getElement(Element context, String path) if (node == null) return null; - return node instanceof Element ? (Element) node : null; + return node instanceof Element e ? e : null; } catch (XPathExpressionException e) { @@ -321,8 +316,8 @@ protected Element[] getElements(Element context, String path) for (int i = 0; i < nodes.getLength(); i++) { Node node = nodes.item(i); - if (node instanceof Element) - elements[i] = (Element) node; + if (node instanceof Element e) + elements[i] = e; } return elements; } @@ -338,7 +333,7 @@ protected Element[] getUniqueElements(Element context, String path, String uniqu if (elements == null) return null; - HashMap styles = new HashMap(); + HashMap styles = new HashMap<>(); for (Element e : elements) { String name = this.getText(e, uniqueTag); @@ -349,8 +344,8 @@ protected Element[] getUniqueElements(Element context, String path, String uniqu return styles.values().toArray(new Element[1]); } - private HashMap namedLayerElements = new HashMap(); - private HashMap namedLayers = new HashMap(); + private HashMap namedLayerElements = new HashMap<>(); + private HashMap namedLayers = new HashMap<>(); private void fillLayerList() { @@ -643,7 +638,7 @@ public Element getLayer() protected static class Layer { - protected HashMap styleElements = new HashMap(); + protected HashMap styleElements = new HashMap<>(); protected final Element element; protected Layer layer; protected String name; @@ -725,8 +720,8 @@ public Element[] getLayerDimensions(Element layer) if (dims == null || dims.length == 0) return null; - ArrayList uniqueDims = new ArrayList(); - ArrayList dimNames = new ArrayList(); + ArrayList uniqueDims = new ArrayList<>(); + ArrayList dimNames = new ArrayList<>(); for (Element e : dims) { // Filter out dimensions with same name. @@ -749,8 +744,8 @@ public Element[] getLayerExtents(Element layer) if (extents == null || extents.length == 0) return null; - ArrayList uniqueExtents = new ArrayList(); - ArrayList extentNames = new ArrayList(); + ArrayList uniqueExtents = new ArrayList<>(); + ArrayList extentNames = new ArrayList<>(); for (Element e : extents) { // Filter out dimensions with same name. @@ -846,7 +841,7 @@ public Element[] getLayerStyles(Element layerElement) if (styleElements == null) return null; - layer.styleElements = new HashMap(); + layer.styleElements = new HashMap<>(); for (Element se : styleElements) { Style style = new Style(se, layer); @@ -912,7 +907,7 @@ public String getLayerExtremeElevationsMax(Element layer) // ********* Style Items ********* // - protected HashMap styleElements = new HashMap(); + protected HashMap styleElements = new HashMap<>(); protected static class Style { diff --git a/src/gov/nasa/worldwind/wms/CapabilitiesV111.java b/src/gov/nasa/worldwind/wms/CapabilitiesV111.java index d5861df5e8..a24268fa2c 100644 --- a/src/gov/nasa/worldwind/wms/CapabilitiesV111.java +++ b/src/gov/nasa/worldwind/wms/CapabilitiesV111.java @@ -63,8 +63,8 @@ public BoundingBox[] getLayerBoundingBoxes(Element layer) if (es == null) return null; - ArrayList bboxes = new ArrayList(); - ArrayList crses = new ArrayList(); + ArrayList bboxes = new ArrayList<>(); + ArrayList crses = new ArrayList<>(); for (Element e : es) { diff --git a/src/gov/nasa/worldwind/wms/CapabilitiesV130.java b/src/gov/nasa/worldwind/wms/CapabilitiesV130.java index 43c85042aa..716175d3f1 100644 --- a/src/gov/nasa/worldwind/wms/CapabilitiesV130.java +++ b/src/gov/nasa/worldwind/wms/CapabilitiesV130.java @@ -63,8 +63,8 @@ public BoundingBox[] getLayerBoundingBoxes(Element layer) if (es == null) return null; - ArrayList bboxes = new ArrayList(); - ArrayList crses = new ArrayList(); + ArrayList bboxes = new ArrayList<>(); + ArrayList crses = new ArrayList<>(); for (Element e : es) { diff --git a/src/gov/nasa/worldwind/wms/Request.java b/src/gov/nasa/worldwind/wms/Request.java index fccfb380df..90280619ec 100644 --- a/src/gov/nasa/worldwind/wms/Request.java +++ b/src/gov/nasa/worldwind/wms/Request.java @@ -45,7 +45,7 @@ public abstract class Request // Use a TreeMap to hold the query params so that they'll always be attached to the // URL query string in the same order. This allows a simple string comparison to // determine whether two url strings address the same document. - private TreeMap queryParams = new TreeMap(); + private TreeMap queryParams = new TreeMap<>(); /** Constructs a request for the default service, WMS. */ protected Request() @@ -130,7 +130,7 @@ private void copyParamsTo(Request destinationRequest) for (Map.Entry entry : this.queryParams.entrySet()) { - destinationRequest.setParam((String) ((Map.Entry) entry).getKey(), (String) ((Map.Entry) entry).getValue()); + destinationRequest.setParam(entry.getKey(), entry.getValue()); } } @@ -226,18 +226,18 @@ public URI getUri() throws URISyntaxException private String buildQueryString(String existingQueryString) { - StringBuffer queryString = new StringBuffer(existingQueryString != null ? existingQueryString : ""); + StringBuilder queryString = new StringBuilder(existingQueryString != null ? existingQueryString : ""); if (queryString.length() > 1 && queryString.lastIndexOf("&") != queryString.length() - 1) - queryString = queryString.append("&"); + queryString.append("&"); for (Map.Entry entry : this.queryParams.entrySet()) { - if (((Map.Entry) entry).getKey() != null && ((Map.Entry) entry).getValue() != null) + if (entry.getKey() != null && entry.getValue() != null) { - queryString.append(((Map.Entry) entry).getKey()); + queryString.append(entry.getKey()); queryString.append("="); - queryString.append(((Map.Entry) entry).getValue()); + queryString.append(entry.getValue()); queryString.append("&"); } } diff --git a/src/gov/nasa/worldwind/wms/WMSTiledImageLayer.java b/src/gov/nasa/worldwind/wms/WMSTiledImageLayer.java index 315533bfee..2a4745b1fb 100644 --- a/src/gov/nasa/worldwind/wms/WMSTiledImageLayer.java +++ b/src/gov/nasa/worldwind/wms/WMSTiledImageLayer.java @@ -216,10 +216,10 @@ public URLBuilder(AVList params) public URL getURL(Tile tile, String altImageFormat) throws MalformedURLException { - StringBuffer sb; + StringBuilder sb; if (this.URLTemplate == null) { - sb = new StringBuffer(WWXML.fixGetMapString(tile.getLevel().getService())); + sb = new StringBuilder(WWXML.fixGetMapString(tile.getLevel().getService())); if (!sb.toString().toLowerCase().contains("service=wms")) sb.append("service=WMS"); @@ -236,7 +236,7 @@ public URL getURL(Tile tile, String altImageFormat) throws MalformedURLException } else { - sb = new StringBuffer(this.URLTemplate); + sb = new StringBuilder(this.URLTemplate); } String format = (altImageFormat != null) ? altImageFormat : this.imageFormat; @@ -396,10 +396,10 @@ protected Document createConfigurationDocument(AVList params) 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.Crs", ((URLBuilder) value).crs); + rs.addStateValueAsString(context, "wms.Version", urlBuilder.wmsVersion); + rs.addStateValueAsString(context, "wms.Crs", urlBuilder.crs); } else {