-
Notifications
You must be signed in to change notification settings - Fork 578
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
Use abstract class instead of sealed classes for StringFormat #6334
Conversation
`sealed` classes have nice properties but they don't play well with API backward compatibility. Adding a new class to a `sealed` class set is a breaking change since they require exhaustive switching.
Javadoc Changes:--- /home/runner/diff/original/firebase-kotlindoc/android/com/google/firebase/vertexai/type/StringFormat.Custom.html 2024-10-01 20:59:21.495756180 +0000
+++ /home/runner/diff/modified/firebase-kotlindoc/android/com/google/firebase/vertexai/type/StringFormat.Custom.html 2024-10-01 20:57:12.258729977 +0000
@@ -44,48 +44,17 @@
<tbody class="list">
<tr>
<td>
- <div><code><a href="/docs/reference/android/com/google/firebase/vertexai/type/StringFormat.Custom.html#Custom(kotlin.String)">Custom</a>(@<a href="https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/kotlin/java/lang/String.html">String</a> format)</code></div>
+ <div><code><a href="/docs/reference/android/com/google/firebase/vertexai/type/StringFormat.Custom.html#Custom(kotlin.String)">Custom</a>(@<a href="https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/kotlin/java/lang/String.html">String</a> value)</code></div>
</td>
</tr>
</tbody>
</table>
</div>
- <div class="devsite-table-wrapper">
- <table class="responsive" id="inhmethods">
- <thead>
- <tr>
- <th colspan="100%"><h3>Inherited fields</h3></th>
- </tr>
- </thead>
- <tbody class="list">
- <tr>
- <td><devsite-expandable><span class="expand-control">From <a href="/docs/reference/android/com/google/firebase/vertexai/type/StringFormat.html">com.google.firebase.vertexai.type.StringFormat</a></span>
- <div class="devsite-table-wrapper">
- <table class="responsive">
- <colgroup>
- <col width="40%">
- <col>
- </colgroup>
- <tbody class="list">
- <tr>
- <td><code>final @<a href="https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/kotlin/java/lang/String.html">String</a></code></td>
- <td>
- <div><code><a href="/docs/reference/android/com/google/firebase/vertexai/type/StringFormat.html#value()">value</a></code></div>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
-</devsite-expandable> </td>
- </tr>
- </tbody>
- </table>
- </div>
<div class="list">
<h2>Public constructors</h2>
<div class="api-item"><a name="Custom-kotlin.String-"></a><a name="custom"></a>
<h3 class="api-name" id="Custom(kotlin.String)">Custom</h3>
- <pre class="api-signature no-pretty-print">public <a href="/docs/reference/android/com/google/firebase/vertexai/type/StringFormat.Custom.html#Custom(kotlin.String)">Custom</a>(@<a href="https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/kotlin/java/lang/String.html">String</a> format)</pre>
+ <pre class="api-signature no-pretty-print">public <a href="/docs/reference/android/com/google/firebase/vertexai/type/StringFormat.Custom.html#Custom(kotlin.String)">Custom</a>(@<a href="https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/kotlin/java/lang/String.html">String</a> value)</pre>
</div>
</div>
</body> --- /home/runner/diff/original/firebase-kotlindoc/android/com/google/firebase/vertexai/type/StringFormat.html 2024-10-01 20:59:21.492756203 +0000
+++ /home/runner/diff/modified/firebase-kotlindoc/android/com/google/firebase/vertexai/type/StringFormat.html 2024-10-01 20:57:12.254730008 +0000
@@ -8,7 +8,7 @@
<div id="metadata-info-block"></div>
<h1>StringFormat</h1>
<p>
- <pre>public class <a href="/docs/reference/android/com/google/firebase/vertexai/type/StringFormat.html">StringFormat</a></pre>
+ <pre>public abstract class <a href="/docs/reference/android/com/google/firebase/vertexai/type/StringFormat.html">StringFormat</a></pre>
</p>
<div class="devsite-table-wrapper"><devsite-expandable><span class="expand-control jd-sumtable-subclasses">Known direct subclasses
<div class="showalways" id="subclasses-direct"><a href="/docs/reference/android/com/google/firebase/vertexai/type/StringFormat.Custom.html">StringFormat.Custom</a></div>
@@ -52,61 +52,6 @@
</tbody>
</table>
</div>
- <div class="devsite-table-wrapper">
- <table class="responsive">
- <colgroup>
- <col width="40%">
- <col>
- </colgroup>
- <thead>
- <tr>
- <th colspan="100%"><h3>Public fields</h3></th>
- </tr>
- </thead>
- <tbody class="list">
- <tr>
- <td><code>final @<a href="https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/kotlin/java/lang/String.html">String</a></code></td>
- <td>
- <div><code><a href="/docs/reference/android/com/google/firebase/vertexai/type/StringFormat.html#value()">value</a></code></div>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <div class="devsite-table-wrapper">
- <table class="responsive">
- <colgroup>
- <col width="40%">
- <col>
- </colgroup>
- <thead>
- <tr>
- <th colspan="100%"><h3>Protected constructors</h3></th>
- </tr>
- </thead>
- <tbody class="list">
- <tr>
- <td>
- <div><code><a href="/docs/reference/android/com/google/firebase/vertexai/type/StringFormat.html#StringFormat(kotlin.String)">StringFormat</a>(@<a href="https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/kotlin/java/lang/String.html">String</a> value)</code></div>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <div class="list">
- <h2>Public fields</h2>
- <div class="api-item"><a name="getValue()"></a><a name="setValue()"></a><a name="getValue--"></a><a name="setValue--"></a>
- <h3 class="api-name" id="value()">value</h3>
- <pre class="api-signature no-pretty-print">public final @<a href="https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/kotlin/java/lang/String.html">String</a> <a href="/docs/reference/android/com/google/firebase/vertexai/type/StringFormat.html#value()">value</a></pre>
- </div>
- </div>
- <div class="list">
- <h2>Protected constructors</h2>
- <div class="api-item"><a name="StringFormat-kotlin.String-"></a><a name="stringformat"></a>
- <h3 class="api-name" id="StringFormat(kotlin.String)">StringFormat</h3>
- <pre class="api-signature no-pretty-print">protected <a href="/docs/reference/android/com/google/firebase/vertexai/type/StringFormat.html#StringFormat(kotlin.String)">StringFormat</a>(@<a href="https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/kotlin/java/lang/String.html">String</a> value)</pre>
- </div>
- </div>
</body>
</html>
--- /home/runner/diff/original/firebase-kotlindoc/kotlin/com/google/firebase/vertexai/type/StringFormat.Custom.html 2024-10-01 20:59:21.489756226 +0000
+++ /home/runner/diff/modified/firebase-kotlindoc/kotlin/com/google/firebase/vertexai/type/StringFormat.Custom.html 2024-10-01 20:57:12.251730030 +0000
@@ -44,48 +44,17 @@
<tbody class="list">
<tr>
<td>
- <div><code><a href="/docs/reference/kotlin/com/google/firebase/vertexai/type/StringFormat.Custom.html#Custom(kotlin.String)">Custom</a>(format: <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html">String</a>)</code></div>
+ <div><code><a href="/docs/reference/kotlin/com/google/firebase/vertexai/type/StringFormat.Custom.html#Custom(kotlin.String)">Custom</a>(value: <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html">String</a>)</code></div>
</td>
</tr>
</tbody>
</table>
</div>
- <div class="devsite-table-wrapper">
- <table class="responsive" id="inhmethods">
- <thead>
- <tr>
- <th colspan="100%"><h3>Inherited properties</h3></th>
- </tr>
- </thead>
- <tbody class="list">
- <tr>
- <td><devsite-expandable><span class="expand-control">From <a href="/docs/reference/kotlin/com/google/firebase/vertexai/type/StringFormat.html">com.google.firebase.vertexai.type.StringFormat</a></span>
- <div class="devsite-table-wrapper">
- <table class="responsive">
- <colgroup>
- <col width="40%">
- <col>
- </colgroup>
- <tbody class="list">
- <tr>
- <td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html">String</a></code></td>
- <td>
- <div><code><a href="/docs/reference/kotlin/com/google/firebase/vertexai/type/StringFormat.html#value()">value</a></code></div>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
-</devsite-expandable> </td>
- </tr>
- </tbody>
- </table>
- </div>
<div class="list">
<h2>Public constructors</h2>
<div class="api-item"><a name="Custom-kotlin.String-"></a><a name="custom"></a>
<h3 class="api-name" id="Custom(kotlin.String)">Custom</h3>
- <pre class="api-signature no-pretty-print"><a href="/docs/reference/kotlin/com/google/firebase/vertexai/type/StringFormat.Custom.html#Custom(kotlin.String)">Custom</a>(format: <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html">String</a>)</pre>
+ <pre class="api-signature no-pretty-print"><a href="/docs/reference/kotlin/com/google/firebase/vertexai/type/StringFormat.Custom.html#Custom(kotlin.String)">Custom</a>(value: <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html">String</a>)</pre>
</div>
</div>
</body> --- /home/runner/diff/original/firebase-kotlindoc/kotlin/com/google/firebase/vertexai/type/StringFormat.html 2024-10-01 20:59:21.486756249 +0000
+++ /home/runner/diff/modified/firebase-kotlindoc/kotlin/com/google/firebase/vertexai/type/StringFormat.html 2024-10-01 20:57:12.248730053 +0000
@@ -8,7 +8,7 @@
<div id="metadata-info-block"></div>
<h1>StringFormat</h1>
<p>
- <pre>sealed class <a href="/docs/reference/kotlin/com/google/firebase/vertexai/type/StringFormat.html">StringFormat</a></pre>
+ <pre>abstract class <a href="/docs/reference/kotlin/com/google/firebase/vertexai/type/StringFormat.html">StringFormat</a></pre>
</p>
<div class="devsite-table-wrapper"><devsite-expandable><span class="expand-control jd-sumtable-subclasses">Known direct subclasses
<div class="showalways" id="subclasses-direct"><a href="/docs/reference/kotlin/com/google/firebase/vertexai/type/StringFormat.Custom.html">StringFormat.Custom</a></div>
@@ -52,61 +52,6 @@
</tbody>
</table>
</div>
- <div class="devsite-table-wrapper">
- <table class="responsive">
- <colgroup>
- <col width="40%">
- <col>
- </colgroup>
- <thead>
- <tr>
- <th colspan="100%"><h3>Protected constructors</h3></th>
- </tr>
- </thead>
- <tbody class="list">
- <tr>
- <td>
- <div><code><a href="/docs/reference/kotlin/com/google/firebase/vertexai/type/StringFormat.html#StringFormat(kotlin.String)">StringFormat</a>(value: <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html">String</a>)</code></div>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <div class="devsite-table-wrapper">
- <table class="responsive">
- <colgroup>
- <col width="40%">
- <col>
- </colgroup>
- <thead>
- <tr>
- <th colspan="100%"><h3>Public properties</h3></th>
- </tr>
- </thead>
- <tbody class="list">
- <tr>
- <td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html">String</a></code></td>
- <td>
- <div><code><a href="/docs/reference/kotlin/com/google/firebase/vertexai/type/StringFormat.html#value()">value</a></code></div>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <div class="list">
- <h2>Protected constructors</h2>
- <div class="api-item"><a name="StringFormat-kotlin.String-"></a><a name="stringformat"></a>
- <h3 class="api-name" id="StringFormat(kotlin.String)">StringFormat</h3>
- <pre class="api-signature no-pretty-print">protected <a href="/docs/reference/kotlin/com/google/firebase/vertexai/type/StringFormat.html#StringFormat(kotlin.String)">StringFormat</a>(value: <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html">String</a>)</pre>
- </div>
- </div>
- <div class="list">
- <h2>Public properties</h2>
- <div class="api-item"><a name="getValue()"></a><a name="setValue()"></a><a name="getValue--"></a><a name="setValue--"></a>
- <h3 class="api-name" id="value()">value</h3>
- <pre class="api-signature no-pretty-print">val <a href="/docs/reference/kotlin/com/google/firebase/vertexai/type/StringFormat.html#value()">value</a>: <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html">String</a></pre>
- </div>
- </div>
</body>
</html>
|
Generated by 🚫 Danger |
Unit Test Results 16 files - 32 16 suites - 32 13s ⏱️ - 1m 10s Results for commit 96668a9. ± Comparison against base commit bb5a4d4. This pull request removes 484 and adds 107 tests. Note that renamed tests count towards both.
|
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.
This is a good example of something that doesn't need to be a sealed class, LGTM
sealed
classes have nice properties but they don't play well with API backward compatibility. Adding a new class to asealed
class set is a breaking change since they require exhaustive switching.