Codebase list libxstream-java / 4efc44e
Patch to compile with Java 7 Emmanuel Bourg 8 years ago
3 changed file(s) with 29 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
00 libxstream-java (1.4.8-1) unstable; urgency=medium
11
22 * New upstream release
3 * Added a patch to compile with Java 7
34 * Moved the package to Git
45
56 -- Emmanuel Bourg <ebourg@apache.org> Wed, 29 Apr 2015 17:53:25 +0200
0 Description: Replaces the call to Method.isDefault() by a reflexive call to compile with Java 7
1 Author: Emmanuel Bourg <ebourg@apache.org>
2 Forwarded: not-needed
3 --- a/xstream/src/java/com/thoughtworks/xstream/mapper/LambdaMapper.java
4 +++ b/xstream/src/java/com/thoughtworks/xstream/mapper/LambdaMapper.java
5 @@ -42,7 +42,7 @@
6 for (int i = 0; replacement == null && i < interfaces.length; i++) {
7 final Class<?> iface = interfaces[i];
8 for (final Method method : iface.getMethods()) {
9 - if (!method.isDefault() && !Modifier.isStatic(method.getModifiers())) {
10 + if (!isDefault(method) && !Modifier.isStatic(method.getModifiers())) {
11 replacement = iface;
12 break;
13 }
14 @@ -57,4 +57,12 @@
15 }
16 return super.serializedClass(replacement == null ? type : replacement);
17 }
18 +
19 + private boolean isDefault(Method m) {
20 + try {
21 + return (Boolean) Method.class.getMethod("isDefault").invoke(m);
22 + } catch (Exception e) {
23 + return false;
24 + }
25 + }
26 }
0 01-java7-compatibility.patch