Skip to content

Commit afa9242

Browse files
committed
Remove JNA
1 parent a58eed6 commit afa9242

File tree

8 files changed

+6
-534
lines changed

8 files changed

+6
-534
lines changed

pom.xml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@
7474
<checkerframework.version>3.49.5</checkerframework.version>
7575
<junit.version>5.13.2</junit.version>
7676
<log4j.version>2.25.0</log4j.version>
77-
<jna.version>5.17.0</jna.version>
7877
<maven.compiler.source>11</maven.compiler.source>
7978
<maven.compiler.target>11</maven.compiler.target>
8079
<watch.mac.backend>fsevents</watch.mac.backend>
@@ -242,16 +241,6 @@
242241
<version>${log4j.version}</version>
243242
<scope>test</scope>
244243
</dependency>
245-
<dependency>
246-
<groupId>net.java.dev.jna</groupId>
247-
<artifactId>jna</artifactId>
248-
<version>${jna.version}</version>
249-
</dependency>
250-
<dependency>
251-
<groupId>net.java.dev.jna</groupId>
252-
<artifactId>jna-platform</artifactId>
253-
<version>${jna.version}</version>
254-
</dependency>
255244
</dependencies>
256245

257246
<profiles>

src/main/java/engineering/swat/watch/impl/jdk/JDKPoller.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656

5757
import engineering.swat.watch.DaemonThreadPool;
5858
import engineering.swat.watch.impl.mac.MacWatchService;
59+
import engineering.swat.watch.impl.mac.NativeLibrary;
5960
import engineering.swat.watch.impl.util.SubscriptionKey;
6061

6162
/**
@@ -189,7 +190,7 @@ public Watchable newWatchable(Path path) {
189190
static final Platform CURRENT = current(); // Assumption: the platform doesn't change
190191

191192
private static Platform current() {
192-
if (com.sun.jna.Platform.isMac()) {
193+
if (NativeLibrary.isMac()) {
193194
var key = "engineering.swat.java-watch.mac";
194195
var val = System.getProperty(key);
195196
if (val != null) {

src/main/java/engineering/swat/watch/impl/mac/NativeEventStream.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,9 @@
3030
import java.io.IOException;
3131
import java.nio.file.Path;
3232

33-
// Note: This file is designed to be the only place in this package where JNA is
34-
// used and/or the native APIs are invoked. If the need to do so arises outside
35-
// this file, consider extending this file to offer the required services
36-
// without exposing JNA and/or the native APIs.
33+
// Note: This file is designed to be the only place in this package where native
34+
// APIs are invoked. If the need to do so arises outside this file, consider
35+
// extending this file to offer the required services without the native APIs.
3736

3837
/**
3938
* <p>

src/main/java/engineering/swat/watch/impl/mac/NativeLibrary.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class NativeLibrary {
4040
public static native long start(String path, NativeEventHandler handler);
4141
public static native void stop(long watchId);
4242

43-
private static boolean isMac() {
43+
public static boolean isMac() {
4444
var os = System.getProperty("os.name");
4545
return os != null && (os.toLowerCase().contains("mac") || os.toLowerCase().contains("darwin"));
4646
}

src/main/java/engineering/swat/watch/impl/mac/apis/DispatchObjects.java

Lines changed: 0 additions & 47 deletions
This file was deleted.

src/main/java/engineering/swat/watch/impl/mac/apis/DispatchQueue.java

Lines changed: 0 additions & 49 deletions
This file was deleted.

src/main/java/engineering/swat/watch/impl/mac/apis/FileSystemEvents.java

Lines changed: 0 additions & 193 deletions
This file was deleted.

0 commit comments

Comments
 (0)