From 063bb917f1f6db9e9db3d2b94097224404ea0c37 Mon Sep 17 00:00:00 2001 From: CoprDistGit Date: Fri, 11 Sep 2026 10:00:50 +0000 Subject: automatic import of javaparser --- .gitignore | 1 + 0001-Port-to-OpenJDK-21.patch | 78 ++++++++++++++ 0003-javacc-grammar-avoid-diamond-operator.patch | 11 ++ javaparser.spec | 131 +++++++++++++++++++++++ sources | 1 + 5 files changed, 222 insertions(+) create mode 100644 0001-Port-to-OpenJDK-21.patch create mode 100644 0003-javacc-grammar-avoid-diamond-operator.patch create mode 100644 javaparser.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore index e69de29..4fb265d 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/javaparser-parent-3.27.1.tar.gz 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/0003-javacc-grammar-avoid-diamond-operator.patch b/0003-javacc-grammar-avoid-diamond-operator.patch new file mode 100644 index 0000000..e17c7fd --- /dev/null +++ b/0003-javacc-grammar-avoid-diamond-operator.patch @@ -0,0 +1,11 @@ +--- a/javaparser-core/src/main/javacc/java.jj ++++ b/javaparser-core/src/main/javacc/java.jj +@@ -3383,7 +3383,7 @@ + NodeList PatternList(): + { + PatternExpr pattern; +- NodeList ret = new NodeList<>(); ++ NodeList ret = new NodeList(); + } + { + "(" diff --git a/javaparser.spec b/javaparser.spec new file mode 100644 index 0000000..73146b6 --- /dev/null +++ b/javaparser.spec @@ -0,0 +1,131 @@ +%bcond_with bootstrap + +%if %{without bootstrap} +%bcond_without bnd_maven_plugin +%else +%bcond_with bnd_maven_plugin +%endif + +Name: javaparser +Version: 3.27.1 +Release: 4 +Summary: Java 1 to 13 Parser and Abstract Syntax Tree for Java +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 +BuildArch: noarch + +Patch0: 0001-Port-to-OpenJDK-21.patch +Patch1: 0003-javacc-grammar-avoid-diamond-operator.patch + +%if %{with bnd_maven_plugin} +BuildRequires: mvn(biz.aQute.bnd:bnd-maven-plugin) +%endif +%if %{with bootstrap} +BuildRequires: javapackages-bootstrap +%else +BuildRequires: maven-local +BuildRequires: mvn(junit:junit) +BuildRequires: mvn(javax.annotation:javax.annotation-api) +BuildRequires: mvn(net.java.dev.javacc:javacc) +BuildRequires: mvn(org.codehaus.mojo:build-helper-maven-plugin) +BuildRequires: mvn(org.codehaus.mojo:javacc-maven-plugin) +%endif + +%description +This package contains a Java 1 to 13 Parser with AST generation and +visitor support. The AST records the source code structure, javadoc +and comments. It is also possible to change the AST nodes or create new +ones to modify the source code. + +%package javadoc +Summary: Javadoc for %{name} +%description javadoc +This package contains API documentation for %{name}. + +%prep +%autosetup -n %{name}-%{name}-parent-%{version} -p1 +sed -i 's/\r//' readme.md + +%pom_remove_dep -r :junit-bom + +%pom_remove_plugin :maven-source-plugin +%pom_remove_plugin :central-publishing-maven-plugin +%pom_remove_plugin -r :jacoco-maven-plugin + +%if %{without bnd_maven_plugin} +%pom_remove_plugin :bnd-maven-plugin javaparser-core +mkdir -p javaparser-core/target/classes/META-INF/ +touch javaparser-core/target/classes/META-INF/MANIFEST.MF +%endif + +%mvn_alias :javaparser-core com.google.code.javaparser:javaparser +sed -i \ + -e 's/ph-javacc-maven-plugin/javacc-maven-plugin/' \ + -e 's/com.helger.maven/org.codehaus.mojo/' \ + javaparser-core/pom.xml +%pom_remove_plugin :templating-maven-plugin javaparser-core +%pom_xpath_inject "pom:build" " + + + src/main/java-templates + true + \${basedir}/src/main/java + +" javaparser-core +%pom_disable_module javaparser-core-testing +%pom_disable_module javaparser-core-testing-bdd +%pom_disable_module javaparser-symbol-solver-core +%pom_disable_module javaparser-symbol-solver-testing +%pom_disable_module javaparser-core-generators +%pom_disable_module javaparser-core-metamodel-generator +%pom_disable_module javaparser-core-serialization + +%build +%mvn_build + +%install +%mvn_install + +%files -f .mfiles +%doc readme.md changelog.md +%license LICENSE LICENSE.APACHE LICENSE.GPL LICENSE.LGPL + +%files javadoc -f .mfiles-javadoc +%license LICENSE LICENSE.APACHE LICENSE.GPL LICENSE.LGPL + +%changelog +* Tue Sep 08 2026 Yuki-Noa <9-nine-noa@users.noreply.github.com> - 3.27.1-4 +- Add patch 0003-javacc-grammar-avoid-diamond-operator.patch to replace + the diamond operator in java.jj with an explicit type argument, since + the distro's JavaCC 7.0.2 cannot parse it (build error: ParseException + "Encountered >" at line 3386 of java.jj). + +* Thu Feb 26 2026 yaoxin <1024769339@qq.com> - 3.27.1-3 +- Unuse bootstrap + +* Fri Feb 13 2026 yaoxin <1024769339@qq.com> - 3.27.1-2 +- Adapting to maven upgrade + +* Thu Oct 16 2025 yaoxin <1024769339@qq.com> - 3.27.1-1 +- Update to 3.27.1: + * Fix: Adjusts the range limits of lambda expression parameters + to ignore brackets. + * Fix: issue 4832 Resolving type of fully qualified varargs + invocation throws IndexOutOfBoundsException + * Fix: Issue 4829 Infinite loop in DifferenceElementCalculator + when calling setPermittedTypes + * XmlPrinter: fix duplicate attribute name in generated xml + * Use lambda parameter counts and block bodies for improved resolution + +* Thu May 15 2025 yaoxin <1024769339@qq.com> - 3.25.10-1 +- Upgrade to 3.25.10: + * Fix strange error when trying to find erasure of generic type + where one of two type parameters is an array + * Fix prevent infinite cycles with static imports + * Refactor ResolvedReferenceType#equals + * Fix cannot be 'abstract' and also 'private'. for a private + method in an interface + +* Sat Aug 1 2020 Jeffery.Gao - 3.3.5-1 +- Package init diff --git a/sources b/sources new file mode 100644 index 0000000..7d4bc41 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +2ed9195ec8319a4fd6a5a063a7ebd890 javaparser-parent-3.27.1.tar.gz -- cgit v1.2.3