diff options
author | Andrew Sapperstein <asapperstein@google.com> | 2020-04-29 13:12:25 -0700 |
---|---|---|
committer | Andrew Sapperstein <asapperstein@google.com> | 2020-05-01 18:24:51 +0000 |
commit | f125b82e97544a91df2c6ab4f24a16c4ee69036a (patch) | |
tree | 52661d7dc52f43e4eff7c1d5517a6a6e0356eca5 | |
parent | 98a17239d8992d06548c1d5442f16f0f3d0d68b4 (diff) |
Undo workaround for Javadoc inner-class ctor links.
Originally made in aosp/866842, the root cause has been fixed
in doclava now (it was an earlier workaround to support both
JDK 7 and JDK 8).
Bug: 6963924
Bug: 119190588
Test: make doc-comment-check-docs
Exempt-From-Owner-Approval: cherry-picked from master
Change-Id: I4c3b6ecad3940d37c0d3a779515f00d04f40b7f2
Merged-In: I4c3b6ecad3940d37c0d3a779515f00d04f40b7f2
-rw-r--r-- | src/main/java/com/android/tools/metalava/model/psi/Javadoc.kt | 11 | ||||
-rw-r--r-- | src/test/java/com/android/tools/metalava/model/psi/JavadocTest.kt | 13 |
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 |