Snap for 10906387 from 7b150bbe96dcadbd05de199f8bbaaa96db6b4247 to androidx-work-release

Change-Id: I629f69dfa659246b361964c63ebdb09aba39fee5
diff --git a/Android.bp b/Android.bp
index ba7933b..dbfdb50 100644
--- a/Android.bp
+++ b/Android.bp
@@ -50,7 +50,6 @@
     // (it references packages under com.sun.tools.doclets which are not
     // exported from the jdk.javadoc module) (see b/140097603):
     java_version: "1.8",
-    kotlincflags: ["-language-version 1.3 -api-version 1.3 -jvm-target 1.8"],
     use_tools_jar: true,
     java_resource_dirs: ["core/src/main/resources"],
 }
diff --git a/core/src/main/kotlin/Formats/JavaLayoutHtml/JavaLayoutHtmlFormatOutputBuilder.kt b/core/src/main/kotlin/Formats/JavaLayoutHtml/JavaLayoutHtmlFormatOutputBuilder.kt
index 2711a2d..59d898a 100644
--- a/core/src/main/kotlin/Formats/JavaLayoutHtml/JavaLayoutHtmlFormatOutputBuilder.kt
+++ b/core/src/main/kotlin/Formats/JavaLayoutHtml/JavaLayoutHtmlFormatOutputBuilder.kt
@@ -857,19 +857,31 @@
 
     protected open fun FlowContent.apiAndDeprecatedVersions(node: DocumentationNode) {
         val apiLevelExists = node.apiLevel.name.isNotEmpty()
+        val sdkExtSinceExists = node.sdkExtSince.name.isNotEmpty()
         val deprecatedLevelExists = node.deprecatedLevel.name.isNotEmpty()
-        if (apiLevelExists || deprecatedLevelExists) {
+        if (apiLevelExists || sdkExtSinceExists || deprecatedLevelExists) {
             div(classes = "api-level") {
                 if (apiLevelExists) {
                     +"Added in "
                     a(href = "https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels") {
                         +"API level ${node.apiLevel.name}"
                     }
-                    if (deprecatedLevelExists) {
+                }
+                if (sdkExtSinceExists) {
+                    if (apiLevelExists) {
                         br
+                        +"Also in "
+                    } else {
+                        +"Added in "
+                    }
+                    a(href = "https://developer.android.com/sdkExtensions") {
+                        +"${node.sdkExtSince.name}"
                     }
                 }
                 if (deprecatedLevelExists) {
+                    if (apiLevelExists || sdkExtSinceExists) {
+                        br
+                    }
                     +"Deprecated in "
                     a(href = "https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels") {
                         +"API level ${node.deprecatedLevel.name}"
@@ -1056,7 +1068,7 @@
 
             val inheritedFieldsByReceiver =
                 allInheritedMembers.filter {
-                    it == NodeKind.Field && it.constantValue() != null
+                    it.kind == NodeKind.Field && it.constantValue() != null
                 }.groupBy { it.owner!! }
 
             val originalExtensions = if (!isCompanion) node.extensions else node.owner!!.extensions
@@ -1156,4 +1168,4 @@
 private val visibilityNames = setOf("public", "protected", "internal", "package-local", "private")
 
 fun DocumentationNode.visibility(): String =
-        details(NodeKind.Modifier).firstOrNull { it.name in visibilityNames }?.name ?: ""
\ No newline at end of file
+        details(NodeKind.Modifier).firstOrNull { it.name in visibilityNames }?.name ?: ""
diff --git a/core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt b/core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt
index a7df4e4..94bb045 100644
--- a/core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt
+++ b/core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt
@@ -112,7 +112,7 @@
     fun nodeForElement(element: PsiNamedElement,
                        kind: NodeKind,
                        name: String = element.name ?: "<anonymous>"): DocumentationNode {
-        val (docComment, deprecatedContent, attrs, apiLevel, deprecatedLevel, artifactId, attribute) = docParser.parseDocumentation(element)
+        val (docComment, deprecatedContent, attrs, apiLevel, sdkExtSince, deprecatedLevel, artifactId, attribute) = docParser.parseDocumentation(element)
         val node = DocumentationNode(name, docComment, kind)
         if (element is PsiModifierListOwner) {
             node.appendModifiers(element)
@@ -140,6 +140,9 @@
         apiLevel?.let {
             node.append(it, RefKind.Detail)
         }
+        sdkExtSince?.let {
+            node.append(it, RefKind.Detail)
+        }
         deprecatedLevel?.let {
             node.append(it, RefKind.Detail)
         }
diff --git a/core/src/main/kotlin/Java/JavadocParser.kt b/core/src/main/kotlin/Java/JavadocParser.kt
index 21cc2bb..0c73e76 100644
--- a/core/src/main/kotlin/Java/JavadocParser.kt
+++ b/core/src/main/kotlin/Java/JavadocParser.kt
@@ -25,6 +25,7 @@
     val deprecatedContent: Content?,
     val attributeRefs: List<String>,
     val apiLevel: DocumentationNode? = null,
+    val sdkExtSince: DocumentationNode? = null,
     val deprecatedLevel: DocumentationNode? = null,
     val artifactId: DocumentationNode? = null,
     val attribute: DocumentationNode? = null
@@ -35,6 +36,7 @@
             emptyList(),
             null,
             null,
+            null,
             null
         )
     }
@@ -109,6 +111,7 @@
 
         val attrRefSignatures = mutableListOf<String>()
         var since: DocumentationNode? = null
+        var sdkextsince: DocumentationNode? = null
         var deprecated: DocumentationNode? = null
         var artifactId: DocumentationNode? = null
         var attrName: String? = null
@@ -135,6 +138,9 @@
                 "since", "apisince" -> {
                     since = DocumentationNode(tag.getApiLevel() ?: "", Content.Empty, NodeKind.ApiLevel)
                 }
+                "sdkextsince" -> {
+                    sdkextsince = DocumentationNode(tag.getSdkExtSince() ?: "", Content.Empty, NodeKind.SdkExtSince)
+                }
                 "deprecatedsince" -> {
                     deprecated = DocumentationNode(tag.getApiLevel() ?: "", Content.Empty, NodeKind.DeprecatedLevel)
                 }
@@ -153,7 +159,7 @@
         attrName?.let { name ->
             attr = DocumentationNode(name, attrDesc ?: Content.Empty, NodeKind.AttributeRef)
         }
-        return JavadocParseResult(result, deprecatedContent, attrRefSignatures, since, deprecated, artifactId, attr)
+        return JavadocParseResult(result, deprecatedContent, attrRefSignatures, since, sdkextsince, deprecated, artifactId, attr)
     }
 
     private val tagsToInherit = setOf("param", "return", "throws")
@@ -182,6 +188,13 @@
         return null
     }
 
+    fun PsiDocTag.getSdkExtSince(): String? {
+        if (dataElements.isNotEmpty()) {
+            return join(dataElements.map { it.text }, " ")
+        }
+        return null
+    }
+
     private fun PsiDocTag.getAttrRef(element: PsiNamedElement): String? {
         if (dataElements.size > 1) {
             val elementText = dataElements[1].text
diff --git a/core/src/main/kotlin/Kotlin/DescriptorDocumentationParser.kt b/core/src/main/kotlin/Kotlin/DescriptorDocumentationParser.kt
index 6841503..098a17f 100644
--- a/core/src/main/kotlin/Kotlin/DescriptorDocumentationParser.kt
+++ b/core/src/main/kotlin/Kotlin/DescriptorDocumentationParser.kt
@@ -142,6 +142,9 @@
             } else if (name?.toLowerCase() == "since" || name?.toLowerCase() == "apisince") {
                 val apiLevel = DocumentationNode(it.getContent(), Content.Empty, NodeKind.ApiLevel)
                 append(apiLevel, RefKind.Detail)
+            } else if (name?.toLowerCase() == "sdkextsince") {
+                val sdkExtSince = DocumentationNode(it.getContent(), Content.Empty, NodeKind.SdkExtSince)
+                append(sdkExtSince, RefKind.Detail)
             } else if (name?.toLowerCase() == "deprecatedsince") {
                 val deprecatedLevel = DocumentationNode(it.getContent(), Content.Empty, NodeKind.DeprecatedLevel)
                 append(deprecatedLevel, RefKind.Detail)
@@ -223,6 +226,9 @@
                 parseResult.apiLevel?.let {
                     node.append(it, RefKind.Detail)
                 }
+                parseResult.sdkExtSince?.let {
+                    node.append(it, RefKind.Detail)
+                }
                 parseResult.deprecatedLevel?.let {
                     node.append(it, RefKind.Detail)
                 }
diff --git a/core/src/main/kotlin/Model/DocumentationNode.kt b/core/src/main/kotlin/Model/DocumentationNode.kt
index c84d416..7ac6d8f 100644
--- a/core/src/main/kotlin/Model/DocumentationNode.kt
+++ b/core/src/main/kotlin/Model/DocumentationNode.kt
@@ -64,6 +64,7 @@
     AttributeRef,
 
     ApiLevel,
+    SdkExtSince,
 
     DeprecatedLevel,
 
@@ -120,6 +121,8 @@
         get() = references(RefKind.ExternalType).map { it.to }.firstOrNull()
     val apiLevel: DocumentationNode
         get() = detailOrNull(NodeKind.ApiLevel) ?: DocumentationNode("", Content.Empty, NodeKind.ApiLevel)
+    val sdkExtSince: DocumentationNode
+        get() = detailOrNull(NodeKind.SdkExtSince) ?: DocumentationNode("", Content.Empty, NodeKind.SdkExtSince)
     val deprecatedLevel: DocumentationNode
         get() = detailOrNull(NodeKind.DeprecatedLevel) ?: DocumentationNode("", Content.Empty, NodeKind.DeprecatedLevel)
     val artifactId: DocumentationNode