@@ -11,6 +11,41 @@ title = "What's New"
11
11
12
12
Key new features of the 3.7 Java driver release:
13
13
14
+ ### Java 9 support
15
+
16
+ #### Modules
17
+
18
+ The Java driver now provides a set of JAR files that are compliant with the Java 9
19
+ [ module specification] ( http://cr.openjdk.java.net/~mr/jigsaw/spec/ ) , and ` Automatic-Module-Name ` declarations have been added
20
+ to the manifests of those JAR files. See the [ Installation Guide] ({{<ref "driver/getting-started/installation.md">}})
21
+ for information on which JAR files are now Java 9-compliant modules as well as what each of their module names is.
22
+
23
+ Note that it was not possible to modularize all the existing JAR files due to the fact that, for some of them, packages are split amongst
24
+ multiple JAR files, and this violates a core rule of the Java 9 module system which states that at most one module contains classes for any
25
+ given package. For instance, the ` mongodb-driver ` and ` mongodb-driver-core ` JAR files both contain classes in the ` com.mongodb ` package,
26
+ and thus it's not possible to make both ` mongodb-driver ` and ` mongodb-driver-core ` Java 9 modules. Also so-called
27
+ "uber jars" like ` mongo-java-driver ` are not appropriate for Java 9 modularization, as they can conflict with their non-uber brethren, and
28
+ thus have not been given module names.
29
+
30
+ Note that none of the modular JAR files contain ` module-info ` class files yet. Addition of these classes will be considered in a future
31
+ release.
32
+
33
+ #### New Entry Point
34
+
35
+ So that the driver can offer a modular option, a new entry point has been added to the ` com.mongodb.client ` package.
36
+ Static methods in this entry point, ` com.mongodb.client.MongoClients ` , returns instances of a new ` com.mongodb.client.MongoClient `
37
+ interface. This interface, while similar to the existing ` com.mongodb.MongoClient ` class in that it is a factory for
38
+ ` com.mongodb.client.MongoDatabase ` instances, does not support the legacy ` com.mongodb.DBCollection ` -based API, and thus does not suffer
39
+ from the aforementioned package-splitting issue that prevents Java 9 modularization. This new entry point is encapsulated in the new
40
+ ` mongodb-driver-sync ` JAR file, which is also a Java 9-compliant module.
41
+
42
+ The new entry point also moves the driver further in the direction of effective deprecation of the legacy API, which is now only available
43
+ only via the ` mongo-java-driver ` and ` mongodb-driver ` uber-jars, which are not Java 9 modules. At this point there are no plans to offer
44
+ the legacy API as a Java 9 module.
45
+
46
+ See [ Connect To MongoDB] ({{<ref "driver/tutorials/connect-to-mongodb.md">}}) for details on the new ` com.mongodb.client.MongoClients `
47
+ and how it compares to the existing ` com.mongodb.MongoClient ` class.
48
+
14
49
### Unix domain socket support
15
50
16
51
The 3.7 driver adds support for Unix domain sockets via the [ ` jnr.unixsocket ` ] ( http://https://github.com/jnr/jnr-unixsocket ) library.
0 commit comments