6
0
forked from pool/ecj

Compare commits

..

15 Commits

Author SHA256 Message Date
5decfb98f0 Accepting request 1148557 from Java:packages
rpm 4.20 compat

OBS-URL: https://build.opensuse.org/request/show/1148557
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/ecj?expand=0&rev=35
2024-02-21 16:59:29 +00:00
9a0d189104 rpm 4.20 compat
OBS-URL: https://build.opensuse.org/package/show/Java:packages/ecj?expand=0&rev=70
2024-02-21 10:40:56 +00:00
5aa8d87782 Accepting request 1146470 from Java:packages
Restore possibility to run with java 8

OBS-URL: https://build.opensuse.org/request/show/1146470
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/ecj?expand=0&rev=34
2024-02-13 21:44:55 +00:00
0b19a6645f OBS-URL: https://build.opensuse.org/package/show/Java:packages/ecj?expand=0&rev=68 2024-02-13 12:11:44 +00:00
bc1c06929e OBS-URL: https://build.opensuse.org/package/show/Java:packages/ecj?expand=0&rev=67 2024-02-13 04:18:11 +00:00
7b52197ade OBS-URL: https://build.opensuse.org/package/show/Java:packages/ecj?expand=0&rev=66 2024-02-13 02:51:04 +00:00
105667c625 OBS-URL: https://build.opensuse.org/package/show/Java:packages/ecj?expand=0&rev=65 2024-02-13 01:50:55 +00:00
25aa50722a Accepting request 1105406 from Java:packages
little tiny changes fix

OBS-URL: https://build.opensuse.org/request/show/1105406
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/ecj?expand=0&rev=33
2023-08-23 12:57:40 +00:00
6841d921b5 OBS-URL: https://build.opensuse.org/package/show/Java:packages/ecj?expand=0&rev=63 2023-08-23 06:34:30 +00:00
e6af5d9dcb Accepting request 1105057 from Java:packages
4.23/3.29.0

OBS-URL: https://build.opensuse.org/request/show/1105057
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/ecj?expand=0&rev=32
2023-08-22 06:56:21 +00:00
f57020a8ae OBS-URL: https://build.opensuse.org/package/show/Java:packages/ecj?expand=0&rev=61 2023-08-21 11:49:21 +00:00
b453fe8b91 OBS-URL: https://build.opensuse.org/package/show/Java:packages/ecj?expand=0&rev=60 2023-08-21 11:42:04 +00:00
b18160cafd OBS-URL: https://build.opensuse.org/package/show/Java:packages/ecj?expand=0&rev=59 2023-08-21 11:20:37 +00:00
e6ec67ee30 OBS-URL: https://build.opensuse.org/package/show/Java:packages/ecj?expand=0&rev=58 2023-08-21 05:59:26 +00:00
e0e8b6e3d3 OBS-URL: https://build.opensuse.org/package/show/Java:packages/ecj?expand=0&rev=57 2023-08-21 05:50:40 +00:00
11 changed files with 3193 additions and 124 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -16,7 +16,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.eclipse.jdt</groupId>
<artifactId>ecj</artifactId>
<version>3.24.0</version>
<version>3.29.0</version>
<description>Eclipse Compiler for Java(TM)</description>
<name>Eclipse Compiler for Java(TM)</name>
<url>http://www.eclipse.org/jdt</url>
@@ -36,7 +36,7 @@
<url>https://bugs.eclipse.org/</url>
</issueManagement>
<scm>
<connection>scm:git:git://git.eclipse.org/gitroot/jdt/eclipse.jdt.core.git</connection>
<connection>scm:git:https://git.eclipse.org/r/jdt/eclipse.jdt.core.git</connection>
<url>https://git.eclipse.org/c/jdt/eclipse.jdt.core.git</url>
</scm>
<developers>

168
ecj-java8compat.patch Normal file
View File

@@ -0,0 +1,168 @@
--- ecj-old/build.xml 2022-03-08 08:19:52.000000000 +0100
+++ ecj-new/build.xml 2024-02-13 04:59:44.328387227 +0100
@@ -25,9 +25,9 @@
<javac srcdir="${basedir}" destdir="${output}"
debuglevel="lines,source"
- debug="true"
- release="11">
- <compilerarg line="-Xlint:none --patch-module java.compiler=javax17api.jar"/>
+ debug="true" encoding="utf-8"
+ source="8" target="8">
+ <compilerarg line="-Xlint:none" value="-Xbootclasspath/p:javax17api.jar"/>
</javac>
<delete file="${basedir}/META-INF/MANIFEST.MF" failonerror="false"/>
--- ecj-old/org/eclipse/jdt/internal/compiler/apt/util/EclipseFileManager.java 2022-03-08 08:19:50.000000000 +0100
+++ ecj-new/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<File>() {
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<Path>() {
Iterator<? extends File> original = files.iterator();
@Override
public boolean hasNext() {
--- ecj-old/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java 2022-03-08 08:19:50.000000000 +0100
+++ ecj-new/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<SyntheticMethodBinding>() {
@Override
public int compare(SyntheticMethodBinding o1, SyntheticMethodBinding o2) {
return o1.index - o2.index;
diff -urEbwB ecj-old/org/eclipse/jdt/internal/compiler/tool/EclipseCompilerImpl.java ecj-new/org/eclipse/jdt/internal/compiler/tool/EclipseCompilerImpl.java
--- ecj-old/org/eclipse/jdt/internal/compiler/tool/EclipseCompilerImpl.java 2022-03-08 08:19:50.000000000 +0100
+++ ecj-new/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<JavaFileObject> diagnostic = null;
if (diagListener != null) {
- diagnostic = new Diagnostic<>() {
+ diagnostic = new Diagnostic<JavaFileObject>() {
@Override
public String getCode() {
return Integer.toString(problemId);
@@ -316,7 +316,7 @@
DiagnosticListener<? super JavaFileObject> diagListener = EclipseCompilerImpl.this.diagnosticListener;
Diagnostic<JavaFileObject> diagnostic = null;
if (diagListener != null) {
- diagnostic = new Diagnostic<>() {
+ diagnostic = new Diagnostic<JavaFileObject>() {
@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<JavaFileObject> diagnostic = new Diagnostic<>() {
+ Diagnostic<JavaFileObject> diagnostic = new Diagnostic<JavaFileObject>() {
@Override
public String getCode() {
return null;
diff -urEbwB ecj-old/org/eclipse/jdt/internal/compiler/tool/EclipseFileManager.java ecj-new/org/eclipse/jdt/internal/compiler/tool/EclipseFileManager.java
--- ecj-old/org/eclipse/jdt/internal/compiler/tool/EclipseFileManager.java 2022-03-08 08:19:50.000000000 +0100
+++ ecj-new/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<File>() {
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<Path>() {
Iterator<? extends File> original = files.iterator();
@Override
public boolean hasNext() {
--- ecj-old/org/eclipse/jdt/internal/compiler/util/Util.java 2022-03-08 08:19:52.000000000 +0100
+++ ecj-new/org/eclipse/jdt/internal/compiler/util/Util.java 2024-02-13 04:59:18.222252584 +0100
@@ -234,6 +234,7 @@
String displayString(Object o);
}
+ private static final int DEFAULT_READING_SIZE = 8192;
private static final int DEFAULT_WRITING_SIZE = 1024;
public final static String UTF_8 = "UTF-8"; //$NON-NLS-1$
public static final String LINE_SEPARATOR = System.getProperty("line.separator"); //$NON-NLS-1$
@@ -469,7 +470,41 @@
* @throws IOException if a problem occurred reading the stream.
*/
public static byte[] getInputStreamAsByteArray(InputStream input) throws IOException {
- return input.readAllBytes(); // will have even slighly better performance as of JDK17+ see JDK-8264777
+ byte[] contents = new byte[0];
+ int contentsLength = 0;
+ int amountRead = -1;
+ do {
+ int amountRequested = Math.max(input.available(), DEFAULT_READING_SIZE); // read at least 8K
+
+ // resize contents if needed
+ if (contentsLength + amountRequested > contents.length) {
+ System.arraycopy(
+ contents,
+ 0,
+ contents = new byte[contentsLength + amountRequested],
+ 0,
+ contentsLength);
+ }
+
+ // read as many bytes as possible
+ amountRead = input.read(contents, contentsLength, amountRequested);
+
+ if (amountRead > 0) {
+ // remember length of contents
+ contentsLength += amountRead;
+ }
+ } while (amountRead != -1);
+
+ // resize contents if necessary
+ if (contentsLength < contents.length) {
+ System.arraycopy(
+ contents,
+ 0,
+ contents = new byte[contentsLength],
+ 0,
+ contentsLength);
+ }
+ return contents;
}
@@ -479,7 +514,16 @@
* @throws IOException if a problem occurred reading the stream.
*/
public static byte[] readNBytes(InputStream input, int byteLength) throws IOException {
- return input.readNBytes(byteLength);
+ byte[] contents = new byte[byteLength];
+ int len = 0;
+ int readSize = 0;
+ while ((readSize != -1) && (len != byteLength)) {
+ // See PR 1FMS89U
+ // We record first the read size. In this case len is the actual read size.
+ len += readSize;
+ readSize = input.read(contents, len, byteLength - len);
+ }
+ return contents;
}
private static Map<String, byte[]> bomByEncoding = new HashMap<String, byte[]>();

View File

@@ -1,3 +1,30 @@
-------------------------------------------------------------------
Wed Feb 21 10:40:52 UTC 2024 - Gus Kenion <gus.kenion@suse.com>
- Use %patch -P N instead of deprecated %patchN.
-------------------------------------------------------------------
Tue Feb 13 01:50:04 UTC 2024 - Fridrich Strba <fstrba@suse.com>
- Added patch:
* ecj-java8compat.patch
+ Allow building ecj with language levels 8 (bsc#1219862)
- Distribute the bundled javax17api.jar under maven coordinate of
org.eclipse:javax17api:17, so that it can be used if needed
-------------------------------------------------------------------
Mon Aug 21 11:46:03 UTC 2023 - Fridrich Strba <fstrba@suse.com>
- Upgrade to eclipse 4.23 ecj (jsc#PED-2979)
* No changelog was made available.
- Use the bundled javax17api.jar stubs, but don't distribute
them
- Removed patches:
* encoding.patch
+ handled by a simple sed run
* javaAPI.patch
+ not needed with this version
-------------------------------------------------------------------
Sun Mar 20 13:35:05 UTC 2022 - Fridrich Strba <fstrba@suse.com>
@@ -14,6 +41,7 @@ Sun Mar 20 13:35:05 UTC 2022 - Fridrich Strba <fstrba@suse.com>
Mon Oct 18 21:28:05 UTC 2021 - Marcel Witte <wittemar@googlemail.com>
- Upgrade to eclipse 4.18 ecj
* No changelog was made available.
- Switch java14api to java15api to be compatible to JDK 15
-------------------------------------------------------------------

View File

@@ -1,7 +1,7 @@
#
# spec file for package ecj
#
# Copyright (c) 2022 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
@@ -16,36 +16,26 @@
#
%global qualifier R-4.18-202012021800
%global jdk15_revision 1055f2102e6e
%global eclipse_ver 4.23
%global bundle_ver 3.29.0
%global jar_ver %{eclipse_ver}
%global drop R-%{jar_ver}-202203080310
Name: ecj
Version: 4.18
Version: %{eclipse_ver}
Release: 0
Summary: Eclipse Compiler for Java
License: EPL-2.0 AND GPL-2.0-only WITH Classpath-exception-2.0
Group: Development/Libraries/Java
URL: https://www.eclipse.org
Source0: http://download.eclipse.org/eclipse/downloads/drops4/%{qualifier}/ecjsrc-%{version}.jar
# Jdk15 sources to build Java API stubs for newer JDKs
# wget http://hg.openjdk.java.net/jdk-updates/jdk15u/archive/1055f2102e6e.tar.bz2 -O jdk15u.tar.bz2
# tar xf jdk15u.tar.bz2 && rm jdk15u.tar.bz2
# mv jdk15u-1055f2102e6e/src/java.compiler/share/classes java15api-src && mkdir -p java15api-src/jdk/internal/ && mv jdk15u-1055f2102e6e/src/java.base/share/classes/jdk/internal/PreviewFeature.java java15api-src/jdk/internal/
# rm -rf jdk15u-1055f2102e6e
# tar cJf java15api-src.tar.xz java15api-src && rm -rf java15api-src
Source1: java15api-src.tar.xz
Source2: https://repo1.maven.org/maven2/org/eclipse/jdt/ecj/3.24.0/ecj-3.24.0.pom
# Simple pom file to declare org.eclipse:java15api artifact
Source3: java15api.pom
# Extracted from https://www.eclipse.org/downloads/download.php?file=/eclipse/downloads/drops4/%%{qualifier}/ecj-%%{version}.jar
Source4: MANIFEST.MF
# Always generate debug info when building RPMs
Patch0: %{name}-rpmdebuginfo.patch
Patch1: encoding.patch
# Include java API stubs in build with java < 15
Patch2: javaAPI.patch
Source0: https://download.eclipse.org/eclipse/downloads/drops4/%{drop}/ecjsrc-%{jar_ver}.jar
Source1: https://repo1.maven.org/maven2/org/eclipse/jdt/ecj/%{bundle_ver}/ecj-%{bundle_ver}.pom
# 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 >= 10
BuildRequires: javapackages-local
BuildRequires: java-devel >= 11
BuildRequires: javapackages-local >= 6
BuildRequires: unzip
BuildArch: noarch
@@ -54,50 +44,30 @@ ECJ is the Java bytecode compiler of the Eclipse Platform. It is also known as
the JDT Core batch compiler.
%prep
%setup -q -c -a 1
%patch0 -p1
%patch1 -p1
%if %{?pkg_vcmp:%pkg_vcmp java-devel < 15}%{!?pkg_vcmp:1}
%patch2
%endif
%setup -q -c
%patch -P 0 -p1
%patch -P 1 -p1
sed -i -e 's|debuglevel=\"lines,source\"|debug=\"yes\"|g' build.xml
# Specify encoding
sed -i -e '/compilerarg/s/Xlint:none/Xlint:none -encoding cp1252/' build.xml
mkdir -p scripts/binary/META-INF/
cp %{SOURCE4} scripts/binary/META-INF/MANIFEST.MF
# JDTCompilerAdapter isn't used by the batch compiler
rm -f org/eclipse/jdt/core/JDTCompilerAdapter.java
# Cannot sign jar file with eclipse key
rm META-INF/ECLIPSE_*
cp %{SOURCE2} scripts/binary/META-INF/MANIFEST.MF
%build
mkdir -p build/classes
javac --patch-module java.compiler=java15api-src -XDignore.symbol.file=true -d build/classes --release 10 \
$(find java15api-src/javax -name \*.java | xargs)
jar -cf java15api.jar -C build/classes .
# Remove everything except the jar, since ant looks for java files in "."
rm -rf java15api-src build/classes
%ant \
%if %{?pkg_vcmp:%pkg_vcmp java-devel < 15}%{!?pkg_vcmp:1}
-Djavaapi=java15api.jar \
%endif
build
%{ant}
%install
# jar
install -dm 0755 %{buildroot}%{_javadir}/%{name}
install -pm 0644 ecj.jar %{buildroot}%{_javadir}/%{name}/ecj.jar
install -pm 0644 java15api.jar %{buildroot}%{_javadir}/%{name}/java15api.jar
install -pm 0644 javax17api.jar %{buildroot}%{_javadir}/%{name}/javax17api.jar
# pom
install -dm 0755 %{buildroot}%{_mavenpomdir}/%{name}
install -pm 0644 %{SOURCE2} %{buildroot}%{_mavenpomdir}/%{name}/ecj.pom
%{mvn_install_pom} %{SOURCE1} %{buildroot}%{_mavenpomdir}/%{name}/ecj.pom
%add_maven_depmap %{name}/ecj.pom %{name}/ecj.jar -a "org.eclipse.jdt:core,org.eclipse.jdt.core.compiler:ecj,org.eclipse.tycho:org.eclipse.jdt.core,org.eclipse.tycho:org.eclipse.jdt.compiler.apt"
%add_maven_depmap org.eclipse:java15api:15 %{name}/java15api.jar -a "org.eclipse:java9api,org.eclipse:java10api"
%add_maven_depmap org.eclipse:javax17api:17 %{name}/javax17api.jar -a "org.eclipse:java9api,org.eclipse:java10api:org.eclipse:java15api"
# Install the ecj wrapper script
%jpackage_script org.eclipse.jdt.internal.compiler.batch.Main '' '' ecj ecj true

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ed2419d5d449062cfd3e3ed48a471d292cb8993c8157a99ebc57b6cbcd3cc683
size 2248232

BIN
ecjsrc-4.23.jar (Stored with Git LFS) Normal file

Binary file not shown.

View File

@@ -1,10 +0,0 @@
--- ecj-4.18.orig/build.xml 2022-03-20 14:23:39.947886348 +0100
+++ ecj-4.18/build.xml 2022-03-20 14:26:28.600913037 +0100
@@ -24,6 +24,7 @@
<mkdir dir="${output}" />
<javac srcdir="${basedir}" destdir="${output}"
+ encoding="utf-8"
debuglevel="lines,source"
source="1.8"
target="1.8">

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9af70c3935b210d9044400a74df095d9aaf23fef855b4fd1b76675849af2924d
size 73108

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" xsi:noNamespaceSchemaLocation="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<groupId>org.eclipse</groupId>
<artifactId>java15api</artifactId>
<version>15</version>
</project>

View File

@@ -1,21 +0,0 @@
--- build.xml.orig 2020-09-02 22:05:12.000000000 +0200
+++ build.xml 2021-03-16 14:41:19.331235267 +0100
@@ -18,6 +18,9 @@
<property name="output" value="bin" />
<property name="jar_file" value="ecj.jar" />
+ <path id="build.path">
+ <pathelement path="${javaapi}"/>
+ </path>
<target name="build">
<delete file="${basedir}/${jar_file}" failonerror="no" />
<delete dir="${output}" failonerror="no" />
@@ -28,7 +31,7 @@
debuglevel="lines,source"
source="1.8"
target="1.8">
- <compilerarg line="-Xlint:none"/>
+ <compilerarg line="-Xlint:none" value="-Xbootclasspath/p:${toString:build.path}"/>
</javac>
<delete file="${basedir}/META-INF/MANIFEST.MF" failonerror="false"/>