File: 002-java9-compatibility.patch

package info (click to toggle)
libcommons-jexl3-java 3.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 1,976 kB
  • sloc: java: 22,447; xml: 2,499; makefile: 4; sh: 1
file content (70 lines) | stat: -rw-r--r-- 2,139 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
Description: Disables the tests that fail to run with Java 9
Author: Emmanuel Bourg <ebourg@apache.org>
Forwarded: not-needed
--- a/src/test/java/org/apache/commons/jexl3/ClassCreatorTest.java
+++ b/src/test/java/org/apache/commons/jexl3/ClassCreatorTest.java
@@ -35,6 +35,7 @@
  * Basic check on automated class creation
  */
 @SuppressWarnings({"UnnecessaryBoxing", "AssertEqualsBetweenInconvertibleTypes"})
+@org.junit.Ignore
 public class ClassCreatorTest extends JexlTestCase {
     static final Log logger = LogFactory.getLog(JexlTestCase.class);
     static final int LOOPS = 8;
--- a/src/test/java/org/apache/commons/jexl3/SynchronizedArithmetic.java
+++ b/src/test/java/org/apache/commons/jexl3/SynchronizedArithmetic.java
@@ -21,7 +21,6 @@
 import java.util.Map;
 import java.util.NoSuchElementException;
 import java.util.concurrent.atomic.AtomicInteger;
-import sun.misc.Unsafe;
 
 /**
  *
@@ -60,7 +59,6 @@
          * @param o the monitored object
          */
         protected void monitorEnter(Object o) {
-            UNSAFE.monitorEnter(o);
             enters.incrementAndGet();
         }
 
@@ -69,7 +67,6 @@
          * @param o the monitored object
          */
         protected void monitorExit(Object o) {
-            UNSAFE.monitorExit(o);
             exits.incrementAndGet();
         }
 
@@ -92,30 +89,14 @@
     }
 
     /**
-     * You should know better than to use this...
-     */
-    private static Unsafe UNSAFE;
-    static {
-        try {
-            Field f = Unsafe.class.getDeclaredField("theUnsafe");
-            f.setAccessible(true);
-            UNSAFE = (Unsafe) f.get(null);
-        } catch (Exception e) {
-            UNSAFE = null;
-        }
-    }
-
-    /**
      * Using the unsafe to enter & exit object intrinsic monitors.
      */
     static class UnsafeMonitor extends Monitor {
         @Override protected void monitorEnter(Object o) {
-            UNSAFE.monitorEnter(o);
             super.monitorEnter(o);
         }
 
         @Override protected void monitorExit(Object o) {
-            UNSAFE.monitorExit(o);
             super.monitorExit(o);
         }
     }