summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Sapperstein <asapperstein@google.com>2020-05-02 00:29:33 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-05-02 00:29:33 +0000
commitd82370a4a1fc821a26aa3528b283c5e4d0587ac2 (patch)
tree52661d7dc52f43e4eff7c1d5517a6a6e0356eca5
parent8e2e7a4ee6fa6f3080e63803826517fe8fe5b1a4 (diff)
parentf125b82e97544a91df2c6ab4f24a16c4ee69036a (diff)
Undo workaround for Javadoc inner-class ctor links. am: f125b82e97
Change-Id: Ie92e389beefed7687b50ba5b9f28a44fa05e077d
-rw-r--r--src/main/java/com/android/tools/metalava/model/psi/Javadoc.kt11
-rw-r--r--src/test/java/com/android/tools/metalava/model/psi/JavadocTest.kt13
2 files changed, 2 insertions, 22 deletions
diff --git a/src/main/java/com/android/tools/metalava/model/psi/Javadoc.kt b/src/main/java/com/android/tools/metalava/model/psi/Javadoc.kt
index 18b7b94..1b6bfda 100644
--- a/src/main/java/com/android/tools/metalava/model/psi/Javadoc.kt
+++ b/src/main/java/com/android/tools/metalava/model/psi/Javadoc.kt
@@ -761,7 +761,6 @@ fun handleTag(
val referencedElement = referenceElement!!.resolve()
if (referencedElement is PsiClass) {
var className = PsiClassItem.computeFullClassName(referencedElement)
- val fullName = className
if (className.indexOf('.') != -1 && !referenceText.startsWith(className)) {
val simpleName = referencedElement.name
if (simpleName != null && referenceText.startsWith(simpleName)) {
@@ -773,15 +772,7 @@ fun handleTag(
sb.append(element.name)
sb.append(' ')
sb.append(referencedElement.qualifiedName)
- var suffix = referenceText.substring(className.length)
- if (suffix.startsWith("#") && suffix.startsWith(className, 1) &&
- (suffix.length == className.length + 1 || suffix[className.length + 1] == '(')
- ) {
- // It's a constructor reference. Unfortunately, javadoc doesn't
- // handle this, so we'll need to work around by placing the full
- // name as the method name
- suffix = "#" + fullName + suffix.substring(className.length + 1)
- }
+ val suffix = referenceText.substring(className.length)
if (suffix.contains("(") && suffix.contains(")")) {
expandArgumentList(element, suffix, sb)
} else {
diff --git a/src/test/java/com/android/tools/metalava/model/psi/JavadocTest.kt b/src/test/java/com/android/tools/metalava/model/psi/JavadocTest.kt
index 81ba297..feb742c 100644
--- a/src/test/java/com/android/tools/metalava/model/psi/JavadocTest.kt
+++ b/src/test/java/com/android/tools/metalava/model/psi/JavadocTest.kt
@@ -901,9 +901,6 @@ class JavadocTest : DriverTest() {
@Test
fun `Javadoc link to innerclass constructor`() {
- // Regression test for
- // 119190588: Javadoc link tag to constructor of static inner class not working
- // See also https://bugs.openjdk.java.net/browse/JDK-8031625
check(
sourceFiles = arrayOf(
java(
@@ -946,14 +943,6 @@ class JavadocTest : DriverTest() {
)
),
docStubs = true,
- // You would *think* the right link to the constructor inner class would be
- // {@link android.view.WindowInsets.Builder#Builder(android.view.WindowInsets)
- // but that does not work; per https://bugs.openjdk.java.net/browse/JDK-8031625
- // we instead have to use
- // {@link android.view.WindowInsets.Builder#android.view.WindowInsets.Builder(android.view.WindowInsets)
- // to get javadoc to turn it into a valid link. (In the platform builds there's
- // also doclava's LinkReference class which does some validation; it's unclear
- // whether it works.)
stubs = arrayOf(
"""
package android.view;
@@ -969,7 +958,7 @@ class JavadocTest : DriverTest() {
* @param right New right inset in pixels
* @param bottom New bottom inset in pixels
* @return A modified copy of this WindowInsets
- * @deprecated use {@link android.view.WindowInsets.Builder#WindowInsets.Builder(android.view.WindowInsets) Builder#Builder(WindowInsets)} with
+ * @deprecated use {@link android.view.WindowInsets.Builder#Builder(android.view.WindowInsets) Builder#Builder(WindowInsets)} with
* {@link android.view.WindowInsets.Builder#setSystemWindowInsets(Insets) Builder#setSystemWindowInsets(Insets)} instead.
*/
@Deprecated