[libxstream-java] 03/03: Patch to compile with Java 7

Emmanuel Bourg ebourg-guest at moszumanska.debian.org
Wed Apr 29 16:27:28 UTC 2015


This is an automated email from the git hooks/post-receive script.

ebourg-guest pushed a commit to branch master
in repository libxstream-java.

commit 4efc44e41c4f11057aa4883c1d208169b152c98f
Author: Emmanuel Bourg <ebourg at apache.org>
Date:   Wed Apr 29 18:25:37 2015 +0200

    Patch to compile with Java 7
---
 debian/changelog                            |  1 +
 debian/patches/01-java7-compatibility.patch | 27 +++++++++++++++++++++++++++
 debian/patches/series                       |  1 +
 3 files changed, 29 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index ddd4737..053c25c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,7 @@
 libxstream-java (1.4.8-1) unstable; urgency=medium
 
   * New upstream release
+  * Added a patch to compile with Java 7
   * Moved the package to Git
 
  -- Emmanuel Bourg <ebourg at apache.org>  Wed, 29 Apr 2015 17:53:25 +0200
diff --git a/debian/patches/01-java7-compatibility.patch b/debian/patches/01-java7-compatibility.patch
new file mode 100644
index 0000000..07def27
--- /dev/null
+++ b/debian/patches/01-java7-compatibility.patch
@@ -0,0 +1,27 @@
+Description: Replaces the call to Method.isDefault() by a reflexive call to compile with Java 7
+Author: Emmanuel Bourg <ebourg at apache.org>
+Forwarded: not-needed
+--- a/xstream/src/java/com/thoughtworks/xstream/mapper/LambdaMapper.java
++++ b/xstream/src/java/com/thoughtworks/xstream/mapper/LambdaMapper.java
+@@ -42,7 +42,7 @@
+                     for (int i = 0; replacement == null && i < interfaces.length; i++) {
+                         final Class<?> iface = interfaces[i];
+                         for (final Method method : iface.getMethods()) {
+-                            if (!method.isDefault() && !Modifier.isStatic(method.getModifiers())) {
++                            if (!isDefault(method) && !Modifier.isStatic(method.getModifiers())) {
+                                 replacement = iface;
+                                 break;
+                             }
+@@ -57,4 +57,12 @@
+         }
+         return super.serializedClass(replacement == null ? type : replacement);
+     }
++
++    private boolean isDefault(Method m) {
++        try {
++            return (Boolean) Method.class.getMethod("isDefault").invoke(m);
++        } catch (Exception e) {
++            return false;
++        }
++    }
+ }
diff --git a/debian/patches/series b/debian/patches/series
index e69de29..8aa9df0 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -0,0 +1 @@
+01-java7-compatibility.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/libxstream-java.git



More information about the pkg-java-commits mailing list