Fix all EqualsGetClass errorprone warnings.
Also turn EqualsGetClass into error and fix up API ignore files.
Bug: 142565423
Test: ./gradlew runErrorProne
Change-Id: I738c9d770bf4eb883c00f5ea659f283b0aac77c4
diff --git a/buildSrc/src/main/kotlin/androidx/build/ErrorProneConfiguration.kt b/buildSrc/src/main/kotlin/androidx/build/ErrorProneConfiguration.kt
index 377b33b..a5e09ef 100644
--- a/buildSrc/src/main/kotlin/androidx/build/ErrorProneConfiguration.kt
+++ b/buildSrc/src/main/kotlin/androidx/build/ErrorProneConfiguration.kt
@@ -95,6 +95,7 @@
"-Xep:ReferenceEquality:ERROR",
"-Xep:AssertionFailureIgnored:ERROR",
"-Xep:UnnecessaryParentheses:ERROR",
+ "-Xep:EqualsGetClass:ERROR",
// Nullaway
"-XepIgnoreUnknownCheckNames", // https://github.com/uber/NullAway/issues/25
diff --git a/core/core/src/main/java/androidx/core/view/WindowInsetsCompat.java b/core/core/src/main/java/androidx/core/view/WindowInsetsCompat.java
index 85f0ff0..b5838c7 100644
--- a/core/core/src/main/java/androidx/core/view/WindowInsetsCompat.java
+++ b/core/core/src/main/java/androidx/core/view/WindowInsetsCompat.java
@@ -507,7 +507,7 @@
if (this == o) {
return true;
}
- if (o == null || getClass() != o.getClass()) {
+ if (!(o instanceof WindowInsetsCompat)) {
return false;
}
WindowInsetsCompat other = (WindowInsetsCompat) o;
diff --git a/core/core/src/main/java/androidx/core/view/accessibility/AccessibilityManagerCompat.java b/core/core/src/main/java/androidx/core/view/accessibility/AccessibilityManagerCompat.java
index 96eefdc..432e67c 100644
--- a/core/core/src/main/java/androidx/core/view/accessibility/AccessibilityManagerCompat.java
+++ b/core/core/src/main/java/androidx/core/view/accessibility/AccessibilityManagerCompat.java
@@ -89,7 +89,7 @@
if (this == o) {
return true;
}
- if (o == null || getClass() != o.getClass()) {
+ if (!(o instanceof AccessibilityStateChangeListenerWrapper)) {
return false;
}
AccessibilityStateChangeListenerWrapper other =
@@ -193,7 +193,7 @@
}
@RequiresApi(19)
- private static class TouchExplorationStateChangeListenerWrapper
+ private static final class TouchExplorationStateChangeListenerWrapper
implements AccessibilityManager.TouchExplorationStateChangeListener {
final TouchExplorationStateChangeListener mListener;
@@ -212,7 +212,7 @@
if (this == o) {
return true;
}
- if (o == null || getClass() != o.getClass()) {
+ if (!(o instanceof TouchExplorationStateChangeListenerWrapper)) {
return false;
}
TouchExplorationStateChangeListenerWrapper other =
diff --git a/core/core/src/main/java/androidx/core/view/accessibility/AccessibilityNodeInfoCompat.java b/core/core/src/main/java/androidx/core/view/accessibility/AccessibilityNodeInfoCompat.java
index ed9be27..1d3090f 100644
--- a/core/core/src/main/java/androidx/core/view/accessibility/AccessibilityNodeInfoCompat.java
+++ b/core/core/src/main/java/androidx/core/view/accessibility/AccessibilityNodeInfoCompat.java
@@ -675,7 +675,7 @@
if (obj == null) {
return false;
}
- if (getClass() != obj.getClass()) {
+ if (!(obj instanceof AccessibilityNodeInfoCompat.AccessibilityActionCompat)) {
return false;
}
AccessibilityNodeInfoCompat.AccessibilityActionCompat other =
@@ -3997,7 +3997,7 @@
if (obj == null) {
return false;
}
- if (getClass() != obj.getClass()) {
+ if (!(obj instanceof AccessibilityNodeInfoCompat)) {
return false;
}
AccessibilityNodeInfoCompat other = (AccessibilityNodeInfoCompat) obj;
diff --git a/core/core/src/main/java/androidx/core/view/accessibility/AccessibilityRecordCompat.java b/core/core/src/main/java/androidx/core/view/accessibility/AccessibilityRecordCompat.java
index d56d404..2e8ced2 100644
--- a/core/core/src/main/java/androidx/core/view/accessibility/AccessibilityRecordCompat.java
+++ b/core/core/src/main/java/androidx/core/view/accessibility/AccessibilityRecordCompat.java
@@ -761,10 +761,7 @@
if (this == obj) {
return true;
}
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
+ if (!(obj instanceof AccessibilityRecordCompat)) {
return false;
}
AccessibilityRecordCompat other = (AccessibilityRecordCompat) obj;
diff --git a/core/core/src/main/java/androidx/core/view/accessibility/AccessibilityWindowInfoCompat.java b/core/core/src/main/java/androidx/core/view/accessibility/AccessibilityWindowInfoCompat.java
index beb8189..ed51356 100644
--- a/core/core/src/main/java/androidx/core/view/accessibility/AccessibilityWindowInfoCompat.java
+++ b/core/core/src/main/java/androidx/core/view/accessibility/AccessibilityWindowInfoCompat.java
@@ -324,7 +324,7 @@
if (obj == null) {
return false;
}
- if (getClass() != obj.getClass()) {
+ if (!(obj instanceof AccessibilityWindowInfoCompat)) {
return false;
}
AccessibilityWindowInfoCompat other = (AccessibilityWindowInfoCompat) obj;
diff --git a/gridlayout/src/main/java/androidx/gridlayout/widget/GridLayout.java b/gridlayout/src/main/java/androidx/gridlayout/widget/GridLayout.java
index f8a920d..17c49e4 100644
--- a/gridlayout/src/main/java/androidx/gridlayout/widget/GridLayout.java
+++ b/gridlayout/src/main/java/androidx/gridlayout/widget/GridLayout.java
@@ -2095,7 +2095,7 @@
@Override
public boolean equals(Object o) {
if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (!(o instanceof LayoutParams)) return false;
LayoutParams that = (LayoutParams) o;
@@ -2485,7 +2485,7 @@
if (this == that) {
return true;
}
- if (that == null || getClass() != that.getClass()) {
+ if (!(that instanceof Spec)) {
return false;
}
diff --git a/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/ClassesInfoCache.java b/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/ClassesInfoCache.java
index 262c966..4e0f3cc 100644
--- a/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/ClassesInfoCache.java
+++ b/lifecycle/lifecycle-common/src/main/java/androidx/lifecycle/ClassesInfoCache.java
@@ -30,7 +30,7 @@
* for {@link ReflectiveGenericLifecycleObserver}, so it can call them,
* and for {@link Lifecycling} to determine which observer adapter to use.
*/
-class ClassesInfoCache {
+final class ClassesInfoCache {
static ClassesInfoCache sInstance = new ClassesInfoCache();
@@ -234,7 +234,7 @@
if (this == o) {
return true;
}
- if (o == null || getClass() != o.getClass()) {
+ if (!(o instanceof MethodReference)) {
return false;
}
diff --git a/media/src/main/java/androidx/media/AudioFocusRequestCompat.java b/media/src/main/java/androidx/media/AudioFocusRequestCompat.java
index 2c85f79f..e26ad78 100644
--- a/media/src/main/java/androidx/media/AudioFocusRequestCompat.java
+++ b/media/src/main/java/androidx/media/AudioFocusRequestCompat.java
@@ -150,7 +150,7 @@
@Override
public boolean equals(Object o) {
if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (!(o instanceof AudioFocusRequestCompat)) return false;
AudioFocusRequestCompat that = (AudioFocusRequestCompat) o;
return mFocusGain == that.mFocusGain
&& mPauseOnDuck == that.mPauseOnDuck
diff --git a/media2/player/api/1.1.0-alpha01.ignore b/media2/player/api/1.1.0-alpha01.ignore
index dcc8e11..620d549 100644
--- a/media2/player/api/1.1.0-alpha01.ignore
+++ b/media2/player/api/1.1.0-alpha01.ignore
@@ -11,6 +11,8 @@
Removed field androidx.media2.player.MediaPlayer.TrackInfo.MEDIA_TRACK_TYPE_VIDEO
+RemovedMethod: androidx.media2.player.MediaPlayer#close():
+ Removed method androidx.media2.player.MediaPlayer.close()
RemovedMethod: androidx.media2.player.MediaPlayer#setSurface(android.view.Surface):
Removed method androidx.media2.player.MediaPlayer.setSurface(android.view.Surface)
RemovedMethod: androidx.media2.player.MediaPlayer.TrackInfo#getFormat():
@@ -23,6 +25,3 @@
Removed method androidx.media2.player.VideoSize.getHeight()
RemovedMethod: androidx.media2.player.VideoSize#getWidth():
Removed method androidx.media2.player.VideoSize.getWidth()
-
-RemovedMethod: androidx.media2.player.MediaPlayer#close():
- RemovedMethod: androidx.media2.player.MediaPlayer#close()
\ No newline at end of file
diff --git a/media2/session/src/main/java/androidx/media2/session/MediaLibraryServiceLegacyStub.java b/media2/session/src/main/java/androidx/media2/session/MediaLibraryServiceLegacyStub.java
index d896a4d..0358df1 100644
--- a/media2/session/src/main/java/androidx/media2/session/MediaLibraryServiceLegacyStub.java
+++ b/media2/session/src/main/java/androidx/media2/session/MediaLibraryServiceLegacyStub.java
@@ -523,7 +523,7 @@
}
}
- private class BrowserLegacyCb extends BaseBrowserLegacyCb {
+ private final class BrowserLegacyCb extends BaseBrowserLegacyCb {
private final Object mLock = new Object();
private final RemoteUserInfo mRemoteUserInfo;
@@ -629,7 +629,7 @@
if (this == obj) {
return true;
}
- if (obj == null || obj.getClass() != BrowserLegacyCb.class) {
+ if (!(obj instanceof BrowserLegacyCb)) {
return false;
}
BrowserLegacyCb other = (BrowserLegacyCb) obj;
diff --git a/paging/integration-tests/testapp/src/main/java/androidx/paging/integration/testapp/custom/Item.java b/paging/integration-tests/testapp/src/main/java/androidx/paging/integration/testapp/custom/Item.java
index e936616..ef19106 100644
--- a/paging/integration-tests/testapp/src/main/java/androidx/paging/integration/testapp/custom/Item.java
+++ b/paging/integration-tests/testapp/src/main/java/androidx/paging/integration/testapp/custom/Item.java
@@ -37,7 +37,7 @@
@Override
public boolean equals(Object o) {
if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (!(o instanceof Item)) return false;
Item item = (Item) o;
return this.id == item.id
diff --git a/paging/integration-tests/testapp/src/main/java/androidx/paging/integration/testapp/room/Customer.java b/paging/integration-tests/testapp/src/main/java/androidx/paging/integration/testapp/room/Customer.java
index 7e0c93b..fe19a23 100644
--- a/paging/integration-tests/testapp/src/main/java/androidx/paging/integration/testapp/room/Customer.java
+++ b/paging/integration-tests/testapp/src/main/java/androidx/paging/integration/testapp/room/Customer.java
@@ -63,7 +63,7 @@
if (this == o) {
return true;
}
- if (o == null || getClass() != o.getClass()) {
+ if (!(o instanceof Customer)) {
return false;
}
diff --git a/recyclerview/recyclerview/src/main/java/androidx/recyclerview/widget/AdapterHelper.java b/recyclerview/recyclerview/src/main/java/androidx/recyclerview/widget/AdapterHelper.java
index f909f67..004f744 100644
--- a/recyclerview/recyclerview/src/main/java/androidx/recyclerview/widget/AdapterHelper.java
+++ b/recyclerview/recyclerview/src/main/java/androidx/recyclerview/widget/AdapterHelper.java
@@ -42,7 +42,7 @@
* Although operations may be forwarded to LayoutManager in different orders, resulting data set
* is guaranteed to be the consistent.
*/
-class AdapterHelper implements OpReorderer.Callback {
+final class AdapterHelper implements OpReorderer.Callback {
static final int POSITION_TYPE_INVISIBLE = 0;
@@ -627,7 +627,7 @@
/**
* Queued operation to happen when child views are updated.
*/
- static class UpdateOp {
+ static final class UpdateOp {
static final int ADD = 1;
@@ -681,7 +681,7 @@
if (this == o) {
return true;
}
- if (o == null || getClass() != o.getClass()) {
+ if (!(o instanceof UpdateOp)) {
return false;
}
diff --git a/room/integration-tests/noappcompattestapp/src/main/java/androidx/room/integration/noappcompat/BareDatabase.java b/room/integration-tests/noappcompattestapp/src/main/java/androidx/room/integration/noappcompat/BareDatabase.java
index d437854..e5f1c2e 100644
--- a/room/integration-tests/noappcompattestapp/src/main/java/androidx/room/integration/noappcompat/BareDatabase.java
+++ b/room/integration-tests/noappcompattestapp/src/main/java/androidx/room/integration/noappcompat/BareDatabase.java
@@ -57,7 +57,7 @@
@Override
public boolean equals(Object o) {
if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (!(o instanceof BareEntity)) return false;
BareEntity that = (BareEntity) o;
return id == that.id && name.equals(that.name);
}
diff --git a/room/integration-tests/testapp/src/main/java/androidx/room/integration/testapp/database/Customer.java b/room/integration-tests/testapp/src/main/java/androidx/room/integration/testapp/database/Customer.java
index 1541114..2f38c79 100644
--- a/room/integration-tests/testapp/src/main/java/androidx/room/integration/testapp/database/Customer.java
+++ b/room/integration-tests/testapp/src/main/java/androidx/room/integration/testapp/database/Customer.java
@@ -63,7 +63,7 @@
if (this == o) {
return true;
}
- if (o == null || getClass() != o.getClass()) {
+ if (!(o instanceof Customer)) {
return false;
}
diff --git a/room/integration-tests/testapp/src/main/java/androidx/room/integration/testapp/database/Product.java b/room/integration-tests/testapp/src/main/java/androidx/room/integration/testapp/database/Product.java
index 9c68d8f..b75df0d 100644
--- a/room/integration-tests/testapp/src/main/java/androidx/room/integration/testapp/database/Product.java
+++ b/room/integration-tests/testapp/src/main/java/androidx/room/integration/testapp/database/Product.java
@@ -55,7 +55,7 @@
@Override
public boolean equals(Object o) {
if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (!(o instanceof Product)) return false;
Product product = (Product) o;
return mId == product.mId && ObjectsCompat.equals(mName, product.mName);
}
diff --git a/room/runtime/api/restricted_2.3.0-alpha01.ignore b/room/runtime/api/restricted_2.3.0-alpha01.ignore
new file mode 100644
index 0000000..ef3f17f5
--- /dev/null
+++ b/room/runtime/api/restricted_2.3.0-alpha01.ignore
@@ -0,0 +1,33 @@
+// Baseline format: 1.0
+AddedFinal: androidx.room.util.FtsTableInfo:
+ Class androidx.room.util.FtsTableInfo added 'final' qualifier
+AddedFinal: androidx.room.util.FtsTableInfo#FtsTableInfo(String, java.util.Set<java.lang.String>, String):
+ Constructor androidx.room.util.FtsTableInfo has added 'final' qualifier
+AddedFinal: androidx.room.util.FtsTableInfo#FtsTableInfo(String, java.util.Set<java.lang.String>, java.util.Set<java.lang.String>):
+ Constructor androidx.room.util.FtsTableInfo has added 'final' qualifier
+AddedFinal: androidx.room.util.TableInfo:
+ Class androidx.room.util.TableInfo added 'final' qualifier
+AddedFinal: androidx.room.util.TableInfo#TableInfo(String, java.util.Map<java.lang.String,androidx.room.util.TableInfo.Column>, java.util.Set<androidx.room.util.TableInfo.ForeignKey>):
+ Constructor androidx.room.util.TableInfo has added 'final' qualifier
+AddedFinal: androidx.room.util.TableInfo#TableInfo(String, java.util.Map<java.lang.String,androidx.room.util.TableInfo.Column>, java.util.Set<androidx.room.util.TableInfo.ForeignKey>, java.util.Set<androidx.room.util.TableInfo.Index>):
+ Constructor androidx.room.util.TableInfo has added 'final' qualifier
+AddedFinal: androidx.room.util.TableInfo.Column:
+ Class androidx.room.util.TableInfo.Column added 'final' qualifier
+AddedFinal: androidx.room.util.TableInfo.Column#Column(String, String, boolean, int):
+ Constructor androidx.room.util.TableInfo.Column has added 'final' qualifier
+AddedFinal: androidx.room.util.TableInfo.Column#Column(String, String, boolean, int, String, int):
+ Constructor androidx.room.util.TableInfo.Column has added 'final' qualifier
+AddedFinal: androidx.room.util.TableInfo.Column#isPrimaryKey():
+ Method androidx.room.util.TableInfo.Column.isPrimaryKey has added 'final' qualifier
+AddedFinal: androidx.room.util.TableInfo.ForeignKey:
+ Class androidx.room.util.TableInfo.ForeignKey added 'final' qualifier
+AddedFinal: androidx.room.util.TableInfo.ForeignKey#ForeignKey(String, String, String, java.util.List<java.lang.String>, java.util.List<java.lang.String>):
+ Constructor androidx.room.util.TableInfo.ForeignKey has added 'final' qualifier
+AddedFinal: androidx.room.util.TableInfo.Index:
+ Class androidx.room.util.TableInfo.Index added 'final' qualifier
+AddedFinal: androidx.room.util.TableInfo.Index#Index(String, boolean, java.util.List<java.lang.String>):
+ Constructor androidx.room.util.TableInfo.Index has added 'final' qualifier
+AddedFinal: androidx.room.util.ViewInfo:
+ Class androidx.room.util.ViewInfo added 'final' qualifier
+AddedFinal: androidx.room.util.ViewInfo#ViewInfo(String, String):
+ Constructor androidx.room.util.ViewInfo has added 'final' qualifier
diff --git a/room/runtime/api/restricted_2.3.0-alpha01.txt b/room/runtime/api/restricted_2.3.0-alpha01.txt
index 6bc1371..abcf64d 100644
--- a/room/runtime/api/restricted_2.3.0-alpha01.txt
+++ b/room/runtime/api/restricted_2.3.0-alpha01.txt
@@ -244,7 +244,7 @@
method public static void copy(java.nio.channels.ReadableByteChannel, java.nio.channels.FileChannel) throws java.io.IOException;
}
- @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public class FtsTableInfo {
+ @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public final class FtsTableInfo {
ctor public FtsTableInfo(String!, java.util.Set<java.lang.String!>!, java.util.Set<java.lang.String!>!);
ctor public FtsTableInfo(String!, java.util.Set<java.lang.String!>!, String!);
method public static androidx.room.util.FtsTableInfo! read(androidx.sqlite.db.SupportSQLiteDatabase!, String!);
@@ -265,7 +265,7 @@
field public static final String![]! EMPTY_STRING_ARRAY;
}
- @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public class TableInfo {
+ @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public final class TableInfo {
ctor public TableInfo(String!, java.util.Map<java.lang.String!,androidx.room.util.TableInfo.Column!>!, java.util.Set<androidx.room.util.TableInfo.ForeignKey!>!, java.util.Set<androidx.room.util.TableInfo.Index!>!);
ctor public TableInfo(String!, java.util.Map<java.lang.String!,androidx.room.util.TableInfo.Column!>!, java.util.Set<androidx.room.util.TableInfo.ForeignKey!>!);
method public static androidx.room.util.TableInfo! read(androidx.sqlite.db.SupportSQLiteDatabase!, String!);
@@ -278,7 +278,7 @@
field public final String! name;
}
- public static class TableInfo.Column {
+ public static final class TableInfo.Column {
ctor @Deprecated public TableInfo.Column(String!, String!, boolean, int);
ctor public TableInfo.Column(String!, String!, boolean, int, String!, int);
method public boolean isPrimaryKey();
@@ -290,7 +290,7 @@
field public final String! type;
}
- @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public static class TableInfo.ForeignKey {
+ @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public static final class TableInfo.ForeignKey {
ctor public TableInfo.ForeignKey(String, String, String, java.util.List<java.lang.String!>, java.util.List<java.lang.String!>);
field public final java.util.List<java.lang.String!> columnNames;
field public final String onDelete;
@@ -299,7 +299,7 @@
field public final String referenceTable;
}
- @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public static class TableInfo.Index {
+ @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public static final class TableInfo.Index {
ctor public TableInfo.Index(String!, boolean, java.util.List<java.lang.String!>!);
field public static final String DEFAULT_PREFIX = "index_";
field public final java.util.List<java.lang.String!>! columns;
@@ -307,7 +307,7 @@
field public final boolean unique;
}
- @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public class ViewInfo {
+ @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public final class ViewInfo {
ctor public ViewInfo(String!, String!);
method public static androidx.room.util.ViewInfo! read(androidx.sqlite.db.SupportSQLiteDatabase!, String!);
field public final String! name;
diff --git a/room/runtime/api/restricted_current.txt b/room/runtime/api/restricted_current.txt
index 6bc1371..abcf64d 100644
--- a/room/runtime/api/restricted_current.txt
+++ b/room/runtime/api/restricted_current.txt
@@ -244,7 +244,7 @@
method public static void copy(java.nio.channels.ReadableByteChannel, java.nio.channels.FileChannel) throws java.io.IOException;
}
- @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public class FtsTableInfo {
+ @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public final class FtsTableInfo {
ctor public FtsTableInfo(String!, java.util.Set<java.lang.String!>!, java.util.Set<java.lang.String!>!);
ctor public FtsTableInfo(String!, java.util.Set<java.lang.String!>!, String!);
method public static androidx.room.util.FtsTableInfo! read(androidx.sqlite.db.SupportSQLiteDatabase!, String!);
@@ -265,7 +265,7 @@
field public static final String![]! EMPTY_STRING_ARRAY;
}
- @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public class TableInfo {
+ @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public final class TableInfo {
ctor public TableInfo(String!, java.util.Map<java.lang.String!,androidx.room.util.TableInfo.Column!>!, java.util.Set<androidx.room.util.TableInfo.ForeignKey!>!, java.util.Set<androidx.room.util.TableInfo.Index!>!);
ctor public TableInfo(String!, java.util.Map<java.lang.String!,androidx.room.util.TableInfo.Column!>!, java.util.Set<androidx.room.util.TableInfo.ForeignKey!>!);
method public static androidx.room.util.TableInfo! read(androidx.sqlite.db.SupportSQLiteDatabase!, String!);
@@ -278,7 +278,7 @@
field public final String! name;
}
- public static class TableInfo.Column {
+ public static final class TableInfo.Column {
ctor @Deprecated public TableInfo.Column(String!, String!, boolean, int);
ctor public TableInfo.Column(String!, String!, boolean, int, String!, int);
method public boolean isPrimaryKey();
@@ -290,7 +290,7 @@
field public final String! type;
}
- @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public static class TableInfo.ForeignKey {
+ @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public static final class TableInfo.ForeignKey {
ctor public TableInfo.ForeignKey(String, String, String, java.util.List<java.lang.String!>, java.util.List<java.lang.String!>);
field public final java.util.List<java.lang.String!> columnNames;
field public final String onDelete;
@@ -299,7 +299,7 @@
field public final String referenceTable;
}
- @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public static class TableInfo.Index {
+ @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public static final class TableInfo.Index {
ctor public TableInfo.Index(String!, boolean, java.util.List<java.lang.String!>!);
field public static final String DEFAULT_PREFIX = "index_";
field public final java.util.List<java.lang.String!>! columns;
@@ -307,7 +307,7 @@
field public final boolean unique;
}
- @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public class ViewInfo {
+ @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public final class ViewInfo {
ctor public ViewInfo(String!, String!);
method public static androidx.room.util.ViewInfo! read(androidx.sqlite.db.SupportSQLiteDatabase!, String!);
field public final String! name;
diff --git a/room/runtime/src/main/java/androidx/room/util/FtsTableInfo.java b/room/runtime/src/main/java/androidx/room/util/FtsTableInfo.java
index c076a02..aa7305f 100644
--- a/room/runtime/src/main/java/androidx/room/util/FtsTableInfo.java
+++ b/room/runtime/src/main/java/androidx/room/util/FtsTableInfo.java
@@ -34,7 +34,7 @@
* @hide
*/
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP_PREFIX)
-public class FtsTableInfo {
+public final class FtsTableInfo {
// A set of valid FTS Options
private static final String[] FTS_OPTIONS = new String[] {
@@ -192,7 +192,7 @@
@Override
public boolean equals(Object o) {
if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (!(o instanceof FtsTableInfo)) return false;
FtsTableInfo that = (FtsTableInfo) o;
diff --git a/room/runtime/src/main/java/androidx/room/util/TableInfo.java b/room/runtime/src/main/java/androidx/room/util/TableInfo.java
index a28aea49..f884f3f 100644
--- a/room/runtime/src/main/java/androidx/room/util/TableInfo.java
+++ b/room/runtime/src/main/java/androidx/room/util/TableInfo.java
@@ -52,8 +52,8 @@
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP_PREFIX)
@SuppressWarnings({"WeakerAccess", "unused", "TryFinallyCanBeTryWithResources",
"SimplifiableIfStatement"})
-// if you change this class, you must change TableInfoWriter.kt
-public class TableInfo {
+// if you change this class, you must change TableInfoValidationWriter.kt
+public final class TableInfo {
/**
* Identifies from where the info object was created.
@@ -118,7 +118,7 @@
@Override
public boolean equals(Object o) {
if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (!(o instanceof TableInfo)) return false;
TableInfo tableInfo = (TableInfo) o;
@@ -340,7 +340,7 @@
* Holds the information about a database column.
*/
@SuppressWarnings("WeakerAccess")
- public static class Column {
+ public static final class Column {
/**
* The column name.
*/
@@ -439,7 +439,7 @@
@Override
public boolean equals(Object o) {
if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (!(o instanceof Column)) return false;
Column column = (Column) o;
if (Build.VERSION.SDK_INT >= 20) {
@@ -512,7 +512,7 @@
* @hide
*/
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP_PREFIX)
- public static class ForeignKey {
+ public static final class ForeignKey {
@NonNull
public final String referenceTable;
@NonNull
@@ -537,7 +537,7 @@
@Override
public boolean equals(Object o) {
if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (!(o instanceof ForeignKey)) return false;
ForeignKey that = (ForeignKey) o;
@@ -608,7 +608,7 @@
* @hide
*/
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP_PREFIX)
- public static class Index {
+ public static final class Index {
// should match the value in Index.kt
public static final String DEFAULT_PREFIX = "index_";
public final String name;
@@ -624,7 +624,7 @@
@Override
public boolean equals(Object o) {
if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (!(o instanceof Index)) return false;
Index index = (Index) o;
if (unique != index.unique) {
diff --git a/room/runtime/src/main/java/androidx/room/util/ViewInfo.java b/room/runtime/src/main/java/androidx/room/util/ViewInfo.java
index 5e4b9b2..81e6aa9 100644
--- a/room/runtime/src/main/java/androidx/room/util/ViewInfo.java
+++ b/room/runtime/src/main/java/androidx/room/util/ViewInfo.java
@@ -31,7 +31,7 @@
* @hide
*/
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP_PREFIX)
-public class ViewInfo {
+public final class ViewInfo {
/**
* The view name
@@ -51,7 +51,7 @@
@Override
public boolean equals(Object o) {
if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (!(o instanceof ViewInfo)) return false;
ViewInfo viewInfo = (ViewInfo) o;
return (name != null ? name.equals(viewInfo.name) : viewInfo.name == null)
&& (sql != null ? sql.equals(viewInfo.sql) : viewInfo.sql == null);
diff --git a/samples/SupportLeanbackDemos/src/main/java/com/example/android/leanback/PhotoItem.java b/samples/SupportLeanbackDemos/src/main/java/com/example/android/leanback/PhotoItem.java
index 406a429..8d23898 100644
--- a/samples/SupportLeanbackDemos/src/main/java/com/example/android/leanback/PhotoItem.java
+++ b/samples/SupportLeanbackDemos/src/main/java/com/example/android/leanback/PhotoItem.java
@@ -21,7 +21,7 @@
* PhotoItem.
*/
@SuppressLint("BanParcelableUsage")
-public class PhotoItem implements Parcelable {
+public final class PhotoItem implements Parcelable {
private int mId;
private String mTitle;
private String mContent;
@@ -102,7 +102,7 @@
@Override
public boolean equals(Object o) {
if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (!(o instanceof PhotoItem)) return false;
PhotoItem photoItem = (PhotoItem) o;
if (mId != photoItem.mId) return false;
if (mImageResourceId != photoItem.mImageResourceId) return false;
diff --git a/versionedparcelable/api/restricted_1.2.0-alpha01.ignore b/versionedparcelable/api/restricted_1.2.0-alpha01.ignore
index 922409f..331211f 100644
--- a/versionedparcelable/api/restricted_1.2.0-alpha01.ignore
+++ b/versionedparcelable/api/restricted_1.2.0-alpha01.ignore
@@ -2,13 +2,14 @@
ChangedType: androidx.versionedparcelable.VersionedParcelize#factory():
Method androidx.versionedparcelable.VersionedParcelize.factory has changed return type from Class to Class<?>
+
RemovedField: androidx.versionedparcelable.VersionedParcel#mParcelizerCache:
Removed field androidx.versionedparcelable.VersionedParcel.mParcelizerCache
RemovedField: androidx.versionedparcelable.VersionedParcel#mReadCache:
- Removed field androidx.versionedparcelable.VersionedParcel.mReadCac
- he
+ Removed field androidx.versionedparcelable.VersionedParcel.mReadCache
RemovedField: androidx.versionedparcelable.VersionedParcel#mWriteCache:
Removed field androidx.versionedparcelable.VersionedParcel.mWriteCache
+
RemovedMethod: androidx.versionedparcelable.VersionedParcel#VersionedParcel(androidx.collection.ArrayMap<java.lang.String,java.lang.reflect.Method>, androidx.collection.ArrayMap<java.lang.String,java.lang.reflect.Method>, androidx.collection.ArrayMap<java.lang.String,java.lang.Class>):
Removed constructor androidx.versionedparcelable.VersionedParcel(androidx.collection.ArrayMap<java.lang.String,java.lang.reflect.Method>,androidx.collection.ArrayMap<java.lang.String,java.lang.reflect.Method>,androidx.collection.ArrayMap<java.lang.String,java.lang.Class>)
diff --git a/work/workmanager/src/main/java/androidx/work/impl/constraints/NetworkState.java b/work/workmanager/src/main/java/androidx/work/impl/constraints/NetworkState.java
index 1157f5c..c7aa8e9 100644
--- a/work/workmanager/src/main/java/androidx/work/impl/constraints/NetworkState.java
+++ b/work/workmanager/src/main/java/androidx/work/impl/constraints/NetworkState.java
@@ -21,7 +21,6 @@
/**
* Stores information about network state.
*/
-
public class NetworkState {
private boolean mIsConnected;
@@ -78,7 +77,7 @@
if (this == o) {
return true;
}
- if (o == null || getClass() != o.getClass()) {
+ if (!(o instanceof NetworkState)) {
return false;
}
NetworkState other = (NetworkState) o;
diff --git a/work/workmanager/src/main/java/androidx/work/impl/model/Preference.java b/work/workmanager/src/main/java/androidx/work/impl/model/Preference.java
index 5e0b47f..6e4a119 100644
--- a/work/workmanager/src/main/java/androidx/work/impl/model/Preference.java
+++ b/work/workmanager/src/main/java/androidx/work/impl/model/Preference.java
@@ -50,7 +50,7 @@
@Override
public boolean equals(Object o) {
if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (!(o instanceof Preference)) return false;
Preference that = (Preference) o;
diff --git a/work/workmanager/src/main/java/androidx/work/impl/model/SystemIdInfo.java b/work/workmanager/src/main/java/androidx/work/impl/model/SystemIdInfo.java
index 99136e3..71222fa 100644
--- a/work/workmanager/src/main/java/androidx/work/impl/model/SystemIdInfo.java
+++ b/work/workmanager/src/main/java/androidx/work/impl/model/SystemIdInfo.java
@@ -53,7 +53,7 @@
@Override
public boolean equals(Object o) {
if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (!(o instanceof SystemIdInfo)) return false;
SystemIdInfo that = (SystemIdInfo) o;
diff --git a/work/workmanager/src/main/java/androidx/work/impl/model/WorkSpec.java b/work/workmanager/src/main/java/androidx/work/impl/model/WorkSpec.java
index caf62da..86bfa80 100644
--- a/work/workmanager/src/main/java/androidx/work/impl/model/WorkSpec.java
+++ b/work/workmanager/src/main/java/androidx/work/impl/model/WorkSpec.java
@@ -55,7 +55,7 @@
@Index(value = {"period_start_time"})
}
)
-public class WorkSpec {
+public final class WorkSpec {
private static final String TAG = Logger.tagWithPrefix("WorkSpec");
public static final long SCHEDULE_NOT_REQUESTED_YET = -1;
@@ -301,7 +301,7 @@
@Override
public boolean equals(Object o) {
if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (!(o instanceof WorkSpec)) return false;
WorkSpec workSpec = (WorkSpec) o;
@@ -370,7 +370,7 @@
@Override
public boolean equals(Object o) {
if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (!(o instanceof IdAndState)) return false;
IdAndState that = (IdAndState) o;
@@ -442,7 +442,7 @@
@Override
public boolean equals(Object o) {
if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (!(o instanceof WorkInfoPojo)) return false;
WorkInfoPojo that = (WorkInfoPojo) o;