From c24abff3e12267442156804550e45d8fc3e58280 Mon Sep 17 00:00:00 2001 From: Marian Koncek Date: Thu, 22 Feb 2024 12:00:39 +0100 Subject: [PATCH] Port to OpenJDK 21 Resolves: RHEL-52805 --- 0001-Port-to-OpenJDK-21.patch | 78 +++++++++++++++++++++++++++++++++++ javaparser.spec | 8 ++++ 2 files changed, 86 insertions(+) create mode 100644 0001-Port-to-OpenJDK-21.patch diff --git a/0001-Port-to-OpenJDK-21.patch b/0001-Port-to-OpenJDK-21.patch new file mode 100644 index 0000000..3de19b1 --- /dev/null +++ b/0001-Port-to-OpenJDK-21.patch @@ -0,0 +1,78 @@ +From 229820ea9a9fccbe9ba91a0678411a878b4c070b Mon Sep 17 00:00:00 2001 +From: Marian Koncek +Date: Tue, 20 Feb 2024 17:39:06 +0100 +Subject: [PATCH] Port to OpenJDK 21 + +--- + .../com/github/javaparser/ast/NodeList.java | 18 ++++++++---------- + .../ast/body/CallableDeclaration.java | 2 +- + 2 files changed, 9 insertions(+), 11 deletions(-) + +diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/NodeList.java b/javaparser-core/src/main/java/com/github/javaparser/ast/NodeList.java +index d78ed2a..8a77597 100644 +--- a/javaparser-core/src/main/java/com/github/javaparser/ast/NodeList.java ++++ b/javaparser-core/src/main/java/com/github/javaparser/ast/NodeList.java +@@ -186,17 +186,15 @@ public class NodeList implements List, Iterable, HasParent + /** + * Inserts the node before all other nodes. + */ +- public NodeList addFirst(N node) { ++ public void addFirst(N node) { + add(0, node); +- return this; + } + + /** + * Inserts the node after all other nodes. (This is simply an alias for add.) + */ +- public NodeList addLast(N node) { ++ public void addLast(N node) { + add(node); +- return this; + } + + /** +@@ -230,21 +228,21 @@ public class NodeList implements List, Iterable, HasParent + /** + * @return the first node, or empty if the list is empty. + */ +- public Optional getFirst() { ++ public N getFirst() { + if (isEmpty()) { +- return Optional.empty(); ++ throw new NoSuchElementException(); + } +- return Optional.of(get(0)); ++ return get(0); + } + + /** + * @return the last node, or empty if the list is empty. + */ +- public Optional getLast() { ++ public N getLast() { + if (isEmpty()) { +- return Optional.empty(); ++ throw new NoSuchElementException(); + } +- return Optional.of(get(size() - 1)); ++ return get(size() - 1); + } + + @Override +diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/body/CallableDeclaration.java b/javaparser-core/src/main/java/com/github/javaparser/ast/body/CallableDeclaration.java +index 9d5d5c6..782eb11 100644 +--- a/javaparser-core/src/main/java/com/github/javaparser/ast/body/CallableDeclaration.java ++++ b/javaparser-core/src/main/java/com/github/javaparser/ast/body/CallableDeclaration.java +@@ -445,7 +445,7 @@ public abstract class CallableDeclaration> exte + * Returns true if the method has a variable number of arguments + */ + public boolean isVariableArityMethod() { +- return getParameters().size() > 0 && getParameters().getLast().get().isVarArgs(); ++ return getParameters().size() > 0 && getParameters().getLast().isVarArgs(); + } + + /* +-- +2.43.0 + diff --git a/javaparser.spec b/javaparser.spec index b09774b..3dc5b63 100644 --- a/javaparser.spec +++ b/javaparser.spec @@ -14,6 +14,8 @@ License: LGPL-2.0-or-later OR Apache-2.0 URL: https://javaparser.org Source0: https://github.com/javaparser/javaparser/archive/%{name}-parent-%{version}.tar.gz +Patch1: 0001-Port-to-OpenJDK-21.patch + %if %{with bootstrap} BuildRequires: javapackages-bootstrap %else @@ -46,6 +48,8 @@ This package contains API documentation for %{name}. %prep %setup -q -n %{name}-%{name}-parent-%{version} +%patch 1 -p1 + sed -i 's/\r//' readme.md # Remove plugins unnecessary for RPM builds @@ -108,6 +112,10 @@ sed -i \ %license LICENSE LICENSE.APACHE LICENSE.GPL LICENSE.LGPL %changelog +* Mon Aug 05 2024 Mikolaj Izdebski - 3.25.6-6 +- Port to OpenJDK 21 +- Resolves: RHEL-52805 + * Thu Aug 01 2024 Troy Dawson - 3.25.6-6 - Bump release for Aug 2024 java mass rebuild