diff --git a/src/main/java/it/tdlight/common/Log.java b/src/main/java/it/tdlight/common/Log.java
index 4532624..8415dcd 100644
--- a/src/main/java/it/tdlight/common/Log.java
+++ b/src/main/java/it/tdlight/common/Log.java
@@ -1,6 +1,6 @@
package it.tdlight.common;
-import it.tdlight.jni.NativeLog;
+import it.tdlight.tdnative.NativeLog;
import it.tdlight.jni.TdApi;
import java.util.function.Consumer;
diff --git a/src/main/java/it/tdlight/common/CommonClientManager.java b/src/main/java/it/tdlight/common/internal/CommonClientManager.java
similarity index 87%
rename from src/main/java/it/tdlight/common/CommonClientManager.java
rename to src/main/java/it/tdlight/common/internal/CommonClientManager.java
index 2a1cd19..4b933ea 100644
--- a/src/main/java/it/tdlight/common/CommonClientManager.java
+++ b/src/main/java/it/tdlight/common/internal/CommonClientManager.java
@@ -1,4 +1,7 @@
-package it.tdlight.common;
+package it.tdlight.common.internal;
+
+import it.tdlight.common.ReactiveTelegramClient;
+import it.tdlight.common.TelegramClient;
public abstract class CommonClientManager {
diff --git a/src/main/java/it/tdlight/common/Handler.java b/src/main/java/it/tdlight/common/internal/Handler.java
similarity index 78%
rename from src/main/java/it/tdlight/common/Handler.java
rename to src/main/java/it/tdlight/common/internal/Handler.java
index e270056..0b55667 100644
--- a/src/main/java/it/tdlight/common/Handler.java
+++ b/src/main/java/it/tdlight/common/internal/Handler.java
@@ -1,4 +1,7 @@
-package it.tdlight.common;
+package it.tdlight.common.internal;
+
+import it.tdlight.common.ExceptionHandler;
+import it.tdlight.common.ResultHandler;
public class Handler {
private final ResultHandler resultHandler;
diff --git a/src/main/java/it/tdlight/common/InternalClient.java b/src/main/java/it/tdlight/common/internal/InternalClient.java
similarity index 95%
rename from src/main/java/it/tdlight/common/InternalClient.java
rename to src/main/java/it/tdlight/common/internal/InternalClient.java
index 0aee7c7..77a91ac 100644
--- a/src/main/java/it/tdlight/common/InternalClient.java
+++ b/src/main/java/it/tdlight/common/internal/InternalClient.java
@@ -1,5 +1,10 @@
-package it.tdlight.common;
+package it.tdlight.common.internal;
+import it.tdlight.common.ClientEventsHandler;
+import it.tdlight.common.ExceptionHandler;
+import it.tdlight.common.ResultHandler;
+import it.tdlight.common.TelegramClient;
+import it.tdlight.common.UpdatesHandler;
import it.tdlight.jni.TdApi;
import it.tdlight.jni.TdApi.Error;
import it.tdlight.jni.TdApi.Function;
diff --git a/src/main/java/it/tdlight/common/InternalClientManager.java b/src/main/java/it/tdlight/common/internal/InternalClientManager.java
similarity index 97%
rename from src/main/java/it/tdlight/common/InternalClientManager.java
rename to src/main/java/it/tdlight/common/internal/InternalClientManager.java
index 6b6d409..4f36eea 100644
--- a/src/main/java/it/tdlight/common/InternalClientManager.java
+++ b/src/main/java/it/tdlight/common/internal/InternalClientManager.java
@@ -1,5 +1,7 @@
-package it.tdlight.common;
+package it.tdlight.common.internal;
+import it.tdlight.common.ClientEventsHandler;
+import it.tdlight.common.Init;
import it.tdlight.jni.TdApi;
import it.tdlight.jni.TdApi.Object;
import java.util.ArrayList;
diff --git a/src/main/java/it/tdlight/common/InternalReactiveClient.java b/src/main/java/it/tdlight/common/internal/InternalReactiveClient.java
similarity index 97%
rename from src/main/java/it/tdlight/common/InternalReactiveClient.java
rename to src/main/java/it/tdlight/common/internal/InternalReactiveClient.java
index ac008f3..84bd1a4 100644
--- a/src/main/java/it/tdlight/common/InternalReactiveClient.java
+++ b/src/main/java/it/tdlight/common/internal/InternalReactiveClient.java
@@ -1,5 +1,9 @@
-package it.tdlight.common;
+package it.tdlight.common.internal;
+import it.tdlight.common.ClientEventsHandler;
+import it.tdlight.common.ExceptionHandler;
+import it.tdlight.common.ReactiveItem;
+import it.tdlight.common.ReactiveTelegramClient;
import it.tdlight.jni.TdApi;
import it.tdlight.jni.TdApi.Error;
import it.tdlight.jni.TdApi.Function;
diff --git a/src/main/java/it/tdlight/common/MultiHandler.java b/src/main/java/it/tdlight/common/internal/MultiHandler.java
similarity index 79%
rename from src/main/java/it/tdlight/common/MultiHandler.java
rename to src/main/java/it/tdlight/common/internal/MultiHandler.java
index f5016f1..a550135 100644
--- a/src/main/java/it/tdlight/common/MultiHandler.java
+++ b/src/main/java/it/tdlight/common/internal/MultiHandler.java
@@ -1,4 +1,7 @@
-package it.tdlight.common;
+package it.tdlight.common.internal;
+
+import it.tdlight.common.ExceptionHandler;
+import it.tdlight.common.UpdatesHandler;
public class MultiHandler {
private final UpdatesHandler updatesHandler;
diff --git a/src/main/java/it/tdlight/common/NativeClientAccess.java b/src/main/java/it/tdlight/common/internal/NativeClientAccess.java
similarity index 89%
rename from src/main/java/it/tdlight/common/NativeClientAccess.java
rename to src/main/java/it/tdlight/common/internal/NativeClientAccess.java
index b960d3c..99b6549 100644
--- a/src/main/java/it/tdlight/common/NativeClientAccess.java
+++ b/src/main/java/it/tdlight/common/internal/NativeClientAccess.java
@@ -1,6 +1,6 @@
-package it.tdlight.common;
+package it.tdlight.common.internal;
-import it.tdlight.jni.NativeClient;
+import it.tdlight.tdnative.NativeClient;
import it.tdlight.jni.TdApi;
import it.tdlight.jni.TdApi.Function;
diff --git a/src/main/java/it/tdlight/common/ResponseReceiver.java b/src/main/java/it/tdlight/common/internal/ResponseReceiver.java
similarity index 98%
rename from src/main/java/it/tdlight/common/ResponseReceiver.java
rename to src/main/java/it/tdlight/common/internal/ResponseReceiver.java
index 095cd9e..b306fe2 100644
--- a/src/main/java/it/tdlight/common/ResponseReceiver.java
+++ b/src/main/java/it/tdlight/common/internal/ResponseReceiver.java
@@ -1,5 +1,6 @@
-package it.tdlight.common;
+package it.tdlight.common.internal;
+import it.tdlight.common.EventsHandler;
import it.tdlight.common.utils.IntSwapper;
import it.tdlight.jni.TdApi;
import it.tdlight.jni.TdApi.Object;
diff --git a/src/main/java/it/tdlight/common/utils/LoadLibrary.java b/src/main/java/it/tdlight/common/utils/LoadLibrary.java
index 2132218..a3e764f 100644
--- a/src/main/java/it/tdlight/common/utils/LoadLibrary.java
+++ b/src/main/java/it/tdlight/common/utils/LoadLibrary.java
@@ -25,7 +25,7 @@ import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.concurrent.ConcurrentHashMap;
import java.lang.reflect.InvocationTargetException;
-import it.tdlight.jni.ObjectsUtils;
+import it.tdlight.tdnative.ObjectsUtils;
/**
* The class to load the libraries needed to run Tdlib
diff --git a/src/main/java/it/tdlight/jni/NativeClient.java b/src/main/java/it/tdlight/jni/NativeClient.java
deleted file mode 100644
index 9c6d3ab..0000000
--- a/src/main/java/it/tdlight/jni/NativeClient.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package it.tdlight.jni;
-
-public class NativeClient {
-
- protected static native int createNativeClient();
-
- protected static native void nativeClientSend(int nativeClientId, long eventId, TdApi.Function function);
-
- protected static native int nativeClientReceive(int[] clientIds, long[] eventIds, TdApi.Object[] events, double timeout);
-
- protected static native TdApi.Object nativeClientExecute(TdApi.Function function);
-}
diff --git a/src/main/java/it/tdlight/tdlib/ClientManager.java b/src/main/java/it/tdlight/tdlib/ClientManager.java
index 6aa989a..4a843c5 100644
--- a/src/main/java/it/tdlight/tdlib/ClientManager.java
+++ b/src/main/java/it/tdlight/tdlib/ClientManager.java
@@ -1,6 +1,6 @@
package it.tdlight.tdlib;
-import it.tdlight.common.CommonClientManager;
+import it.tdlight.common.internal.CommonClientManager;
import it.tdlight.common.ReactiveTelegramClient;
import it.tdlight.common.TelegramClient;
diff --git a/src/main/java/it/tdlight/tdlib/DummyClass.java b/src/main/java/it/tdlight/tdlib/DummyClass.java
new file mode 100644
index 0000000..141cdf6
--- /dev/null
+++ b/src/main/java/it/tdlight/tdlib/DummyClass.java
@@ -0,0 +1,7 @@
+package it.tdlight.tdlib;
+
+/**
+ * This class is used to avoid jigsaw errors about empty exports
+ */
+@Deprecated
+public class DummyClass {}
diff --git a/src/main/java/it/tdlight/tdlight/ClientManager.java b/src/main/java/it/tdlight/tdlight/ClientManager.java
index 170b883..ba2d46f 100644
--- a/src/main/java/it/tdlight/tdlight/ClientManager.java
+++ b/src/main/java/it/tdlight/tdlight/ClientManager.java
@@ -1,6 +1,6 @@
package it.tdlight.tdlight;
-import it.tdlight.common.CommonClientManager;
+import it.tdlight.common.internal.CommonClientManager;
import it.tdlight.common.ReactiveTelegramClient;
import it.tdlight.common.TelegramClient;
diff --git a/src/main/java/it/tdlight/tdlight/DummyClass.java b/src/main/java/it/tdlight/tdlight/DummyClass.java
new file mode 100644
index 0000000..22eff52
--- /dev/null
+++ b/src/main/java/it/tdlight/tdlight/DummyClass.java
@@ -0,0 +1,7 @@
+package it.tdlight.tdlight;
+
+/**
+ * This class is used to avoid jigsaw errors about empty exports
+ */
+@Deprecated
+public class DummyClass {}
diff --git a/src/main/java/it/tdlight/tdnative/NativeClient.java b/src/main/java/it/tdlight/tdnative/NativeClient.java
new file mode 100644
index 0000000..8345e97
--- /dev/null
+++ b/src/main/java/it/tdlight/tdnative/NativeClient.java
@@ -0,0 +1,15 @@
+package it.tdlight.tdnative;
+
+import it.tdlight.jni.TdApi.Function;
+import it.tdlight.jni.TdApi.Object;
+
+public class NativeClient {
+
+ protected static native int createNativeClient();
+
+ protected static native void nativeClientSend(int nativeClientId, long eventId, Function function);
+
+ protected static native int nativeClientReceive(int[] clientIds, long[] eventIds, Object[] events, double timeout);
+
+ protected static native Object nativeClientExecute(Function function);
+}
diff --git a/src/main/java/it/tdlight/jni/NativeLog.java b/src/main/java/it/tdlight/tdnative/NativeLog.java
similarity index 87%
rename from src/main/java/it/tdlight/jni/NativeLog.java
rename to src/main/java/it/tdlight/tdnative/NativeLog.java
index eac5854..ed92851 100644
--- a/src/main/java/it/tdlight/jni/NativeLog.java
+++ b/src/main/java/it/tdlight/tdnative/NativeLog.java
@@ -1,5 +1,7 @@
-package it.tdlight.jni;
+package it.tdlight.tdnative;
+import it.tdlight.jni.TdApi.SetLogStream;
+import it.tdlight.jni.TdApi.SetLogVerbosityLevel;
import java.util.function.Consumer;
/**
@@ -15,7 +17,7 @@ public class NativeLog {
* Sets file path for writing TDLib internal log. By default TDLib writes logs to the System.err.
* Use this method to write the log to a file instead.
*
- * @deprecated As of TDLib 1.4.0 in favor of {@link TdApi.SetLogStream}, to be removed in the future.
+ * @deprecated As of TDLib 1.4.0 in favor of {@link SetLogStream}, to be removed in the future.
* @param filePath Path to a file for writing TDLib internal log. Use an empty path to
* switch back to logging to the System.err.
* @return whether opening the log file succeeded.
@@ -26,7 +28,7 @@ public class NativeLog {
/**
* Changes the maximum size of TDLib log file.
*
- * @deprecated As of TDLib 1.4.0 in favor of {@link TdApi.SetLogStream}, to be removed in the future.
+ * @deprecated As of TDLib 1.4.0 in favor of {@link SetLogStream}, to be removed in the future.
* @param maxFileSize The maximum size of the file to where the internal TDLib log is written
* before the file will be auto-rotated. Must be positive. Defaults to 10 MB.
*/
@@ -36,7 +38,7 @@ public class NativeLog {
/**
* Changes TDLib log verbosity.
*
- * @deprecated As of TDLib 1.4.0 in favor of {@link TdApi.SetLogVerbosityLevel}, to be removed in the future.
+ * @deprecated As of TDLib 1.4.0 in favor of {@link SetLogVerbosityLevel}, to be removed in the future.
* @param verbosityLevel New value of log verbosity level. Must be non-negative.
* Value 0 corresponds to fatal errors,
* value 1 corresponds to java.util.logging.Level.SEVERE,
diff --git a/src/main/java/it/tdlight/jni/ObjectsUtils.java b/src/main/java/it/tdlight/tdnative/ObjectsUtils.java
similarity index 98%
rename from src/main/java/it/tdlight/jni/ObjectsUtils.java
rename to src/main/java/it/tdlight/tdnative/ObjectsUtils.java
index ea5a7f8..06484b8 100644
--- a/src/main/java/it/tdlight/jni/ObjectsUtils.java
+++ b/src/main/java/it/tdlight/tdnative/ObjectsUtils.java
@@ -1,4 +1,4 @@
-package it.tdlight.jni;
+package it.tdlight.tdnative;
public class ObjectsUtils {
/**
diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java
new file mode 100644
index 0000000..0006cf4
--- /dev/null
+++ b/src/main/java/module-info.java
@@ -0,0 +1,11 @@
+module tdlight.java {
+ requires tdlight.api;
+ requires org.reactivestreams;
+ requires it.unimi.dsi.fastutil;
+ requires org.slf4j;
+ exports it.tdlight.tdlight;
+ exports it.tdlight.tdlib;
+ exports it.tdlight.common;
+ exports it.tdlight.common.utils;
+ exports it.tdlight.common.internal;
+}
\ No newline at end of file
diff --git a/tdlib/pom.xml b/tdlib/pom.xml
index a988e10..8a0695d 100644
--- a/tdlib/pom.xml
+++ b/tdlib/pom.xml
@@ -169,7 +169,7 @@
11
false
- it/tdlight/tdlight/**
+ it/tdlight/tdlight/ClientManager.java
diff --git a/tdlight/pom.xml b/tdlight/pom.xml
index 6782b4f..8451b27 100644
--- a/tdlight/pom.xml
+++ b/tdlight/pom.xml
@@ -169,7 +169,7 @@
11
false
- it/tdlight/tdlib/**
+ it/tdlight/tdlib/ClientManager.java