Modify ambiguous getId method in LinkSpan
- getId() in LinkSpan.java returns a String type which clashes with the same method in its superclass, this will make developer confused, and even make compile failed when OEM using gradle to compile SUW.
- For now we just annotate the old method with Deprecated and add a new method as a suggestion, hoping to avoid compile errors for applications that already depend on it. The old method should be removed sooner or later.
Bug: 256046112
Test: mannual and compile successfully.
Change-Id: I91060901a090bb53ce52654436ebf3445e53118d
diff --git a/main/src/com/google/android/setupdesign/span/LinkSpan.java b/main/src/com/google/android/setupdesign/span/LinkSpan.java
index 7d91012..7defbf9 100644
--- a/main/src/com/google/android/setupdesign/span/LinkSpan.java
+++ b/main/src/com/google/android/setupdesign/span/LinkSpan.java
@@ -73,10 +73,10 @@
/* non-static section */
- private final String id;
+ private final String link;
- public LinkSpan(String id) {
- this.id = id;
+ public LinkSpan(String link) {
+ this.link = link;
}
@Override
@@ -137,7 +137,16 @@
drawState.setUnderlineText(false);
}
+ public String getLink() {
+ return link;
+ }
+
+ /**
+ * @deprecated Method's return type clashes with its superclass. Use {@link #getLink()} instead.
+ * This will be removed in the future.
+ */
+ @Deprecated
public String getId() {
- return id;
+ return link;
}
}