[procyon] 01/01: Backported a Java 9 fix (Closes: #894286)
Emmanuel Bourg
ebourg-guest at moszumanska.debian.org
Fri Mar 30 08:41:51 BST 2018
This is an automated email from the git hooks/post-receive script.
ebourg-guest pushed a commit to branch master
in repository procyon.
commit 571598178340b567e25b4cff7224ed3601f59542
Author: Emmanuel Bourg <ebourg at apache.org>
Date: Fri Mar 30 09:19:31 2018 +0200
Backported a Java 9 fix (Closes: #894286)
---
debian/changelog | 6 ++
debian/patches/03-java9-compatibility.patch | 126 ++++++++++++++++++++++++++++
debian/patches/series | 1 +
3 files changed, 133 insertions(+)
diff --git a/debian/changelog b/debian/changelog
index 38e5c48..185beb1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+procyon (0.5.32-3) unstable; urgency=medium
+
+ * Backported a Java 9 fix (Closes: #894286)
+
+ -- Emmanuel Bourg <ebourg at apache.org> Fri, 30 Mar 2018 09:19:21 +0200
+
procyon (0.5.32-2) unstable; urgency=medium
[ Kai-Chung Yan ]
diff --git a/debian/patches/03-java9-compatibility.patch b/debian/patches/03-java9-compatibility.patch
new file mode 100644
index 0000000..253f138
--- /dev/null
+++ b/debian/patches/03-java9-compatibility.patch
@@ -0,0 +1,126 @@
+Description: Java 9 Compatibility Fixes
+Origin: backport, https://bitbucket.org/mstrobel/procyon/commits/7f19d10
+--- a/Procyon.CompilerTools/src/main/java/com/strobel/assembler/metadata/ClasspathTypeLoader.java
++++ b/Procyon.CompilerTools/src/main/java/com/strobel/assembler/metadata/ClasspathTypeLoader.java
+@@ -16,19 +16,11 @@
+
+ package com.strobel.assembler.metadata;
+
+-import com.strobel.core.StringUtilities;
+-import com.strobel.core.VerifyArgument;
+-import sun.misc.Resource;
+-import sun.misc.URLClassPath;
+-
+-import java.io.File;
+ import java.io.IOException;
+-import java.lang.reflect.UndeclaredThrowableException;
+-import java.net.MalformedURLException;
++import java.io.InputStream;
+ import java.net.URL;
+ import java.util.logging.Level;
+ import java.util.logging.Logger;
+-import java.util.regex.Pattern;
+
+ /**
+ * @author Mike Strobel
+@@ -36,34 +28,14 @@
+ public final class ClasspathTypeLoader implements ITypeLoader {
+ private final static Logger LOG = Logger.getLogger(ClasspathTypeLoader.class.getSimpleName());
+
+- private final URLClassPath _classPath;
++ private final ClassLoader _loader;
+
+ public ClasspathTypeLoader() {
+- this(
+- StringUtilities.join(
+- System.getProperty("path.separator"),
+- System.getProperty("java.class.path"),
+- System.getProperty("sun.boot.class.path")
+- )
+- );
++ _loader = ClassLoader.getSystemClassLoader();
+ }
+
+ public ClasspathTypeLoader(final String classPath) {
+- final String[] parts = VerifyArgument.notNull(classPath, "classPath")
+- .split(Pattern.quote(System.getProperty("path.separator")));
+-
+- final URL[] urls = new URL[parts.length];
+-
+- for (int i = 0; i < parts.length; i++) {
+- try {
+- urls[i] = new File(parts[i]).toURI().toURL();
+- }
+- catch (MalformedURLException e) {
+- throw new UndeclaredThrowableException(e);
+- }
+- }
+-
+- _classPath = new URLClassPath(urls);
++ throw new UnsupportedOperationException("Custom classpaths are temporarily unsupported.");
+ }
+
+ @Override
+@@ -73,29 +45,32 @@
+ }
+
+ final String path = internalName.concat(".class");
+- final Resource resource = _classPath.getResource(path, false);
++ final URL resource = _loader.getResource(path);
+
+ if (resource == null) {
+ return false;
+ }
+
+- final byte[] data;
++ try (final InputStream stream = _loader.getResourceAsStream(path)) {
++ final byte[] temp = new byte[4096];
+
+- try {
+- data = resource.getBytes();
+- assert data.length == resource.getContentLength();
+- }
+- catch (IOException e) {
+- return false;
+- }
++ int bytesRead;
+
+- buffer.reset(data.length);
+- System.arraycopy(data, 0, buffer.array(), 0, data.length);
++ while ((bytesRead = stream.read(temp, 0, temp.length)) > 0) {
++ buffer.ensureWriteableBytes(bytesRead);
++ buffer.putByteArray(temp, 0, bytesRead);
++ }
+
+- if (LOG.isLoggable(Level.FINE)) {
+- LOG.fine("Type loaded from " + resource.getURL() + ".");
+- }
++ buffer.flip();
+
+- return true;
++ if (LOG.isLoggable(Level.FINE)) {
++ LOG.fine("Type loaded from " + resource + ".");
++ }
++
++ return true;
++ }
++ catch (final IOException ignored) {
++ return false;
++ }
+ }
+ }
+--- a/Procyon.Expressions/src/main/java/com/strobel/expressions/LambdaCompiler.java
++++ b/Procyon.Expressions/src/main/java/com/strobel/expressions/LambdaCompiler.java
+@@ -2792,10 +2792,10 @@
+ }
+
+ if (name != null) {
+- return String.format("%s.%s[0x%3$04x]", p.getName(), name, nextId.getAndIncrement());
++ return String.format("%s.%s$0x%3$04x", p.getName(), name, nextId.getAndIncrement());
+ }
+
+- return String.format("%s.f__Lambda[0x%2$04x]", p.getName(), nextId.getAndIncrement());
++ return String.format("%s.f__Lambda$0x%2$04x", p.getName(), nextId.getAndIncrement());
+ }
+
+ private void emitLambdaBody() {
diff --git a/debian/patches/series b/debian/patches/series
index 5acf0d1..df0fe30 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
01-disable-fatjar-plugin.patch
02-cli-program-name.patch
+03-java9-compatibility.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/procyon.git
More information about the pkg-java-commits
mailing list