File: 01-java9-compatibility.patch

package info (click to toggle)
libisnativec-java 5.3.20100629%2Bfix-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 424 kB
  • sloc: java: 2,145; sh: 12; makefile: 5
file content (23 lines) | stat: -rw-r--r-- 737 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Description: Fixes the compatibility issues with Java 9
Author: Emmanuel Bourg <ebourg@apache.org>
Forwarded: no
--- a/src/de/intarsys/nativec/api/NativeInterface.java
+++ b/src/de/intarsys/nativec/api/NativeInterface.java
@@ -31,7 +31,7 @@
 
 import java.util.Iterator;
 
-import sun.misc.Service;
+import java.util.ServiceLoader;
 
 /**
  * Access the VM singleton for {@link INativeInterface}.
@@ -81,7 +81,7 @@
 		if (loader == null) {
 			loader = NativeInterface.class.getClassLoader();
 		}
-		Iterator ps = Service.providers(INativeInterface.class, loader);
+		Iterator ps = ServiceLoader.load(INativeInterface.class, loader).iterator();
 		if (ps.hasNext()) {
 			try {
 				return (INativeInterface) ps.next();