diff --git a/ecj-java8compat.patch b/ecj-java8compat.patch
new file mode 100644
index 0000000..984f7d4
--- /dev/null
+++ b/ecj-java8compat.patch
@@ -0,0 +1,93 @@
+--- a/build.xml 2022-03-08 08:19:52.000000000 +0100
++++ b/build.xml 2024-02-13 02:31:15.760059399 +0100
+@@ -26,8 +26,8 @@
+
+-
++ source="8" target="8">
++
+
+
+
+--- a/org/eclipse/jdt/internal/compiler/apt/util/EclipseFileManager.java 2022-03-08 08:19:50.000000000 +0100
++++ b/org/eclipse/jdt/internal/compiler/apt/util/EclipseFileManager.java 2024-02-13 02:40:37.158638361 +0100
+@@ -1281,7 +1281,7 @@
+ private Iterable extends File> getFiles(final Iterable extends Path> paths) {
+ if (paths == null)
+ return null;
+- return () -> new Iterator<>() {
++ return () -> new Iterator() {
+ Iterator extends Path> original = paths.iterator();
+ @Override
+ public boolean hasNext() {
+@@ -1296,7 +1296,7 @@
+ private Iterable extends Path> getPaths(final Iterable extends File> files) {
+ if (files == null)
+ return null;
+- return () -> new Iterator<>() {
++ return () -> new Iterator() {
+ Iterator extends File> original = files.iterator();
+ @Override
+ public boolean hasNext() {
+--- a/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java 2022-03-08 08:19:50.000000000 +0100
++++ b/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java 2024-02-13 02:32:54.251379205 +0100
+@@ -3319,7 +3319,7 @@
+ }
+ }
+ // sort them in according to their own indexes
+- Arrays.sort(bindings, new Comparator<>() {
++ Arrays.sort(bindings, new Comparator() {
+ @Override
+ public int compare(SyntheticMethodBinding o1, SyntheticMethodBinding o2) {
+ return o1.index - o2.index;
+--- a/org/eclipse/jdt/internal/compiler/tool/EclipseCompilerImpl.java 2022-03-08 08:19:50.000000000 +0100
++++ b/org/eclipse/jdt/internal/compiler/tool/EclipseCompilerImpl.java 2024-02-13 02:38:57.913975827 +0100
+@@ -239,7 +239,7 @@
+ DiagnosticListener super JavaFileObject> diagListener = EclipseCompilerImpl.this.diagnosticListener;
+ Diagnostic diagnostic = null;
+ if (diagListener != null) {
+- diagnostic = new Diagnostic<>() {
++ diagnostic = new Diagnostic() {
+ @Override
+ public String getCode() {
+ return Integer.toString(problemId);
+@@ -316,7 +316,7 @@
+ DiagnosticListener super JavaFileObject> diagListener = EclipseCompilerImpl.this.diagnosticListener;
+ Diagnostic diagnostic = null;
+ if (diagListener != null) {
+- diagnostic = new Diagnostic<>() {
++ diagnostic = new Diagnostic() {
+ @Override
+ public String getCode() {
+ return Integer.toString(problemId);
+@@ -797,7 +797,7 @@
+ Iterator iterator = this.extraProblems.iterator(); iterator.hasNext(); ) {
+ final CategorizedProblem problem = (CategorizedProblem) iterator.next();
+ if (this.diagnosticListener != null && !isIgnored(problem)) {
+- Diagnostic diagnostic = new Diagnostic<>() {
++ Diagnostic diagnostic = new Diagnostic() {
+ @Override
+ public String getCode() {
+ return null;
+--- a/org/eclipse/jdt/internal/compiler/tool/EclipseFileManager.java 2022-03-08 08:19:50.000000000 +0100
++++ b/org/eclipse/jdt/internal/compiler/tool/EclipseFileManager.java 2024-02-13 02:41:33.840827055 +0100
+@@ -1310,7 +1310,7 @@
+ private Iterable extends File> getFiles(final Iterable extends Path> paths) {
+ if (paths == null)
+ return null;
+- return () -> new Iterator<>() {
++ return () -> new Iterator() {
+ Iterator extends Path> original = paths.iterator();
+ @Override
+ public boolean hasNext() {
+@@ -1325,7 +1325,7 @@
+ private Iterable extends Path> getPaths(final Iterable extends File> files) {
+ if (files == null)
+ return null;
+- return () -> new Iterator<>() {
++ return () -> new Iterator() {
+ Iterator extends File> original = files.iterator();
+ @Override
+ public boolean hasNext() {
diff --git a/ecj.changes b/ecj.changes
index 43a79fa..033e0aa 100644
--- a/ecj.changes
+++ b/ecj.changes
@@ -1,3 +1,10 @@
+-------------------------------------------------------------------
+Tue Feb 13 01:50:04 UTC 2024 - Fridrich Strba
+
+- Added patch:
+ * ecj-java8compat.patch
+ + Allow building ecj with language levels 8
+
-------------------------------------------------------------------
Mon Aug 21 11:46:03 UTC 2023 - Fridrich Strba
diff --git a/ecj.spec b/ecj.spec
index 8aeacf5..8f906a0 100644
--- a/ecj.spec
+++ b/ecj.spec
@@ -1,7 +1,7 @@
#
# spec file for package ecj
#
-# Copyright (c) 2023 SUSE LLC
+# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -32,6 +32,7 @@ Source1: https://repo1.maven.org/maven2/org/eclipse/jdt/ecj/%{bundle_ver}
# Extracted from https://download.eclipse.org/eclipse/downloads/drops4/%%{drop}/ecj-%%{jar_ver}.jar
Source2: MANIFEST.MF
Patch0: ecj-rpmdebuginfo.patch
+Patch1: ecj-java8compat.patch
BuildRequires: ant
BuildRequires: java-devel >= 11
BuildRequires: javapackages-local >= 6
@@ -45,6 +46,7 @@ the JDT Core batch compiler.
%prep
%setup -q -c
%patch0 -p1
+%patch1 -p1
# Specify encoding
sed -i -e '/compilerarg/s/Xlint:none/Xlint:none -encoding cp1252/' build.xml