[JAVA-2705] Move MongoDriverInformation class from com.mongodb.client to com.mongodb Created: 14/Dec/17  Updated: 28/Oct/23  Resolved: 10/Jan/18

Status: Closed
Project: Java Driver
Component/s: API
Affects Version/s: None
Fix Version/s: 3.7.0

Type: Improvement Priority: Major - P3
Reporter: Jeffrey Yemin Assignee: Jeffrey Yemin
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by JAVA-2521 Repackage the driver so that packages... Closed
Epic Link: Java9
Backwards Compatibility: Minor Change

 Description   

The MongoDriverInformation class is part of driver-core and is in the com.mongodb.client package. This is unfortunate as it's the same package that is used for the standard driver CRUD API, e.g. com.mongodb.client.MongoCollection. And it can't just be moved into the driver module because it's also used by driver-async.

This hasn't been a problem because prior to Java 9 it it perfectly legal to split the same package between multiple jar files. But in order to deploy the driver on the module path, even as a set of automatic modules, package splits are forbidden and will result in an error like:

java.lang.module.ResolutionException: Module org.mongodb.driver.client contains package com.mongodb.client, module org.mongodb.driver.core exports package com.mongodb.client to org.mongodb.driver.client

To rectify this situation, MongoDriverInformation must be moved to a different package, and com.mongodb seems suitable.

While this is a breaking change, it is unlikely to affect end-user applications because this class was added only to support wrapping drivers like Reactive Streams and the Scala Driver, and those drivers can easily be updated to refer to the new location of this class. For that reason, we should consider doing this outside of a major release of the driver.



 Comments   
Comment by Githook User [ 09/Jan/18 ]

Author:

{'email': 'jeff.yemin@10gen.com', 'name': 'Jeff Yemin', 'username': 'jyemin'}

Message: JAVA-2705: Move MongoDriverInformation from com.mongodb.client package to com.mongodb package.

This breaks binary compatibility, but without this change it's impossible to modularize the core driver,
as the com.mongodb.client package would be split between two modules, which is not allowed.

A mitigating factor is that this class is only intended for use by wrapping drivers like our own Scala
and Reactive Streams drivers, and so is unlikely to be referenced directly by downstream users besides
MongoDB itself.
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/121130a4251ba536f0faef9279618a64bdf426fc

Generated at Thu Feb 08 08:57:52 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.