-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Replace @Evolving
with @Sealed
where appropriate
#1141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,9 @@ | |
|
||
package com.mongodb.annotations; | ||
|
||
import com.mongodb.connection.StreamFactoryFactory; | ||
import org.bson.conversions.Bson; | ||
|
||
import java.lang.annotation.Documented; | ||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
|
@@ -30,6 +33,41 @@ | |
* of doing extra work during upgrades. | ||
* Using such program elements is no different from using ordinary unannotated program elements. | ||
* Note that the presence of this annotation implies nothing about the quality or performance of the API in question. | ||
* <p> | ||
* Unless we currently want to allow users to extend/implement API program elements, we must annotate them with | ||
* {@code @}{@link Sealed} rather than {@code @}{@link Evolving}. Replacing {@code @}{@link Sealed} with {@code @}{@link Evolving} | ||
* is a backward-compatible change, while the opposite is not.</p> | ||
* | ||
* <table> | ||
* <caption>Reasons we may allow users to extend/implement an API program element</caption> | ||
* <tr> | ||
* <th>Reason</th> | ||
* <th>Example</th> | ||
* <th>Applicability of {@code @}{@link Evolving}</th> | ||
* </tr> | ||
* <tr> | ||
* <td>Doing so allows/simplifies integrating user code with the API.</td> | ||
* <td>{@link Bson}</td> | ||
* <td>Not applicable.</td> | ||
* </tr> | ||
* <tr> | ||
* <td>Doing so allows customizing API behavior.</td> | ||
* <td>{@link StreamFactoryFactory}</td> | ||
* <td>Not applicable.</td> | ||
* </tr> | ||
* <tr> | ||
* <td>Doing so facilitates writing application unit tests by creating a fake implementation.</td> | ||
* <td>{@code com.mongodb.client.MongoClient}</td> | ||
* <td>Applicable.</td> | ||
* </tr> | ||
* <tr> | ||
* <td>The program element was introduced before {@code @}{@link Evolving}.</td> | ||
* <td>{@code com.mongodb.client.MongoClient}</td> | ||
* <td>Applicable.</td> | ||
* </tr> | ||
* </table> | ||
* | ||
* @see Sealed | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note the documentation change. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor and optional: the example is the same for the last two items. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's because both apply there. |
||
*/ | ||
@Retention(RetentionPolicy.CLASS) | ||
@Target(ElementType.TYPE) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Evolving
should have been annotated with@Sealed
rather than@Evolving
, but the idea of@Sealed
did not come at that time, and now it will be a breaking change, even though one may be quite sure that no one extendedEvolving
.