Fridrich Strba 2024-02-13 04:18:11 +00:00 committed by Git OBS Bridge
parent 7b52197ade
commit bc1c06929e
2 changed files with 85 additions and 10 deletions

View File

@ -1,5 +1,5 @@
--- a/build.xml 2022-03-08 08:19:52.000000000 +0100
+++ b/build.xml 2024-02-13 02:31:15.760059399 +0100
--- 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}"
@ -13,8 +13,8 @@
</javac>
<delete file="${basedir}/META-INF/MANIFEST.MF" failonerror="false"/>
--- 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
--- 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)
@ -33,8 +33,8 @@
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
--- 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 @@
}
}
@ -44,8 +44,9 @@
@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
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;
@ -73,8 +74,9 @@
@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
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)
@ -93,3 +95,74 @@
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

@ -61,11 +61,13 @@ cp %{SOURCE2} scripts/binary/META-INF/MANIFEST.MF
# jar
install -dm 0755 %{buildroot}%{_javadir}/%{name}
install -pm 0644 ecj.jar %{buildroot}%{_javadir}/%{name}/ecj.jar
install -pm 0644 javax17api.jar %{buildroot}%{_javadir}/%{name}/javax17api.jar
# pom
install -dm 0755 %{buildroot}%{_mavenpomdir}/%{name}
%{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: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