diff options
author | Louis Pullen-Freilich <lpf@google.com> | 2020-06-23 19:26:24 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2020-06-23 19:26:24 +0000 |
commit | 1b78ae40b0f226969683314d81280a4e7a0912b3 (patch) | |
tree | 96577b8499251556843c9534f79b6dd67d96dde8 | |
parent | e8b439b7a220e8fb5fabf3182781558696c7a47f (diff) | |
parent | 66257797513d8f2c5a4980e7992ec733771f2159 (diff) | |
download | dokka-1b78ae40b0f226969683314d81280a4e7a0912b3.tar.gz |
Merge "Updates Kotlin compiler version to 1.3.61"
-rw-r--r-- | Android.bp | 2 | ||||
-rw-r--r-- | build.gradle | 14 | ||||
-rw-r--r-- | buildSrc/src/main/groovy/org/jetbrains/CorrectShadowPublishing.groovy | 8 | ||||
-rw-r--r-- | core/build.gradle | 5 | ||||
-rw-r--r-- | core/src/main/kotlin/Analysis/AnalysisEnvironment.kt | 83 | ||||
-rw-r--r-- | core/src/main/kotlin/Analysis/CoreKotlinCacheService.kt | 18 | ||||
-rw-r--r-- | core/src/main/kotlin/Analysis/CoreProjectFileIndex.kt | 28 | ||||
-rw-r--r-- | core/src/main/kotlin/Analysis/JavaResolveExtension.kt | 7 | ||||
-rw-r--r-- | core/src/main/kotlin/Java/JavadocParser.kt | 14 | ||||
-rw-r--r-- | core/src/main/kotlin/Kotlin/DocumentationBuilder.kt | 2 | ||||
-rw-r--r-- | core/src/main/kotlin/Kotlin/ExternalDocumentationLinkResolver.kt | 6 | ||||
-rw-r--r-- | core/src/test/kotlin/model/FunctionTest.kt | 14 | ||||
-rw-r--r-- | core/testdata/functions/functionWithAnnotatedLambdaParam.kt | 7 | ||||
-rw-r--r-- | gradle.properties | 8 | ||||
-rw-r--r-- | gradle/wrapper/gradle-wrapper.properties | 2 |
15 files changed, 139 insertions, 79 deletions
diff --git a/Android.bp b/Android.bp index f67ea232a..e613720d8 100644 --- a/Android.bp +++ b/Android.bp @@ -27,7 +27,7 @@ java_binary_host { // (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.2 -api-version 1.2 -jvm-target 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/build.gradle b/build.gradle index d282aeb08..08951ee9a 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,3 @@ -import org.jetbrains.DependenciesVersionGetter - allprojects { group 'org.jetbrains.dokka' version dokka_version @@ -29,6 +27,8 @@ allprojects { repositories { mavenCentral() mavenLocal() + maven { url 'https://kotlin.bintray.com/kotlin-plugin' } + maven { url 'https://www.jetbrains.com/intellij-repository/releases' } maven { url "https://dl.bintray.com/jetbrains/markdown" } maven { url "http://dl.bintray.com/kotlin/kotlin-eap" } maven { url "https://dl.bintray.com/kotlin/kotlin-dev" } @@ -70,24 +70,20 @@ task wrapper(type: Wrapper) { distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip" } -def versions = DependenciesVersionGetter.getVersions(project, bundled_kotlin_compiler_version) - -ext.ideaVersion = versions["idea.build.id"] -ext.markdownVersion = versions["markdown.build.id"].replace("%20", " ") - configurations { ideaIC intellijCore } repositories { + maven { url 'https://kotlin.bintray.com/kotlin-plugin' } maven { url 'https://www.jetbrains.com/intellij-repository/snapshots' } maven { url 'https://www.jetbrains.com/intellij-repository/releases' } } dependencies { - intellijCore "com.jetbrains.intellij.idea:intellij-core:$ideaVersion" - ideaIC "com.jetbrains.intellij.idea:ideaIC:$ideaVersion" + intellijCore "com.jetbrains.intellij.idea:intellij-core:$idea_version" + ideaIC "com.jetbrains.intellij.idea:ideaIC:$idea_version" } def intellijCoreAnalysis() { diff --git a/buildSrc/src/main/groovy/org/jetbrains/CorrectShadowPublishing.groovy b/buildSrc/src/main/groovy/org/jetbrains/CorrectShadowPublishing.groovy index 58cfdcf7a..aacede449 100644 --- a/buildSrc/src/main/groovy/org/jetbrains/CorrectShadowPublishing.groovy +++ b/buildSrc/src/main/groovy/org/jetbrains/CorrectShadowPublishing.groovy @@ -4,10 +4,11 @@ import org.gradle.api.Project import org.gradle.api.artifacts.ModuleVersionIdentifier import org.gradle.api.artifacts.ProjectDependency import org.gradle.api.artifacts.SelfResolvingDependency -import org.gradle.api.publish.internal.ProjectDependencyPublicationResolver +import org.gradle.api.internal.artifacts.ivyservice.projectmodule.ProjectDependencyPublicationResolver import org.gradle.api.publish.maven.MavenPom import org.gradle.api.publish.maven.MavenPublication +//https://github.com/johnrengelman/shadow/issues/334 static void configure(MavenPublication publication, Project project) { publication.artifact(project.tasks.shadowJar) @@ -16,10 +17,9 @@ static void configure(MavenPublication publication, Project project) { def dependenciesNode = xml.asNode().appendNode('dependencies') project.configurations.shadow.allDependencies.each { - //if (! (it instanceof SelfResolvingDependency)) { if (it instanceof ProjectDependency) { - def projectDependencyResolver = project.gradle.services.get(ProjectDependencyPublicationResolver) - ModuleVersionIdentifier identifier = projectDependencyResolver.resolve(it) + final ProjectDependencyPublicationResolver projectDependencyResolver = project.gradle.services.get(ProjectDependencyPublicationResolver) + final ModuleVersionIdentifier identifier = projectDependencyResolver.resolve(ModuleVersionIdentifier, it) addDependency(dependenciesNode, identifier) } else if (!(it instanceof SelfResolvingDependency)) { addDependency(dependenciesNode, it) diff --git a/core/build.gradle b/core/build.gradle index 5c80fc84e..4a8928de1 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -30,13 +30,14 @@ dependencies { compile "org.jetbrains.kotlin:kotlin-compiler:$bundled_kotlin_compiler_version" compile "org.jetbrains.kotlin:kotlin-script-runtime:$bundled_kotlin_compiler_version" - compile "teamcity:kotlin-ide-common:$bundled_kotlin_compiler_version" - compile "org.jetbrains:markdown:$markdownVersion" + compile "org.jetbrains:markdown:0.1.41" implementation "com.squareup.okhttp3:okhttp:4.0.0-RC1" compile intellijCoreAnalysis() + compile "org.jetbrains.kotlin:kotlin-plugin-ij193:$kotlin_plugin_version" //TODO: parametrize ij version after 1.3.70 + // Google version of the library in the libs folder. Fixing 129528660 // compile 'org.jetbrains.kotlinx:kotlinx-html-jvm:0.6.8' diff --git a/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt b/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt index b47f8bdb1..7003024c8 100644 --- a/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt +++ b/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt @@ -18,6 +18,7 @@ import com.intellij.psi.PsiElement import com.intellij.psi.search.GlobalSearchScope import com.intellij.util.io.URLUtil import org.jetbrains.kotlin.analyzer.* +import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.builtins.jvm.JvmBuiltIns import org.jetbrains.kotlin.caches.resolve.KotlinCacheService import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys @@ -35,19 +36,25 @@ import org.jetbrains.kotlin.config.* import org.jetbrains.kotlin.container.getService import org.jetbrains.kotlin.container.tryGetService import org.jetbrains.kotlin.context.ProjectContext +import org.jetbrains.kotlin.context.withModule import org.jetbrains.kotlin.descriptors.DeclarationDescriptor import org.jetbrains.kotlin.descriptors.ModuleDescriptor +import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl import org.jetbrains.kotlin.idea.resolve.ResolutionFacade import org.jetbrains.kotlin.load.java.structure.impl.JavaClassImpl import org.jetbrains.kotlin.name.Name +import org.jetbrains.kotlin.platform.TargetPlatform +import org.jetbrains.kotlin.platform.jvm.JvmPlatforms +import org.jetbrains.kotlin.platform.konan.KonanPlatforms import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.resolve.BindingTrace import org.jetbrains.kotlin.resolve.CompilerEnvironment +import org.jetbrains.kotlin.resolve.PlatformDependentAnalyzerServices import org.jetbrains.kotlin.resolve.diagnostics.Diagnostics -import org.jetbrains.kotlin.resolve.jvm.JvmAnalyzerFacade import org.jetbrains.kotlin.resolve.jvm.JvmPlatformParameters -import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatform +import org.jetbrains.kotlin.resolve.jvm.JvmResolverForModuleFactory +import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatformAnalyzerServices import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode import org.jetbrains.kotlin.resolve.lazy.ResolveSession import org.jetbrains.kotlin.types.KotlinType @@ -104,29 +111,40 @@ class AnalysisEnvironment(val messageCollector: MessageCollector) : Disposable { fun createResolutionFacade(environment: KotlinCoreEnvironment): Pair<DokkaResolutionFacade, DokkaResolutionFacade> { - val projectContext = ProjectContext(environment.project) + val projectContext = ProjectContext(environment.project, "Dokka") val sourceFiles = environment.getSourceFiles() val library = object : ModuleInfo { override val name: Name = Name.special("<library>") + override val platform: TargetPlatform + get() = JvmPlatforms.defaultJvmPlatform + override val analyzerServices: PlatformDependentAnalyzerServices = + JvmPlatformAnalyzerServices override fun dependencies(): List<ModuleInfo> = listOf(this) } val module = object : ModuleInfo { override val name: Name = Name.special("<module>") + override val platform: TargetPlatform + get() = JvmPlatforms.defaultJvmPlatform + override val analyzerServices: PlatformDependentAnalyzerServices = + JvmPlatformAnalyzerServices override fun dependencies(): List<ModuleInfo> = listOf(this, library) } val sourcesScope = createSourceModuleSearchScope(environment.project, sourceFiles) - val builtIns = JvmBuiltIns(projectContext.storageManager) + val builtIns = JvmBuiltIns( + projectContext.storageManager, + JvmBuiltIns.Kind.FROM_CLASS_LOADER + ) val javaRoots = classpath .mapNotNull { val rootFile = when { it.extension == "jar" -> - StandardFileSystems.jar().findFileByPath("${it.absolutePath}${URLUtil.JAR_SEPARATOR}") + StandardFileSystems.jar().findFileByPath("${it.absolutePath}${"!/"}") else -> StandardFileSystems.local().findFileByPath(it.absolutePath) } @@ -134,38 +152,51 @@ class AnalysisEnvironment(val messageCollector: MessageCollector) : Disposable { rootFile?.let { JavaRoot(it, JavaRoot.RootType.BINARY) } } - val resolverForProject = ResolverForProjectImpl( + val resolverForProject = object : AbstractResolverForProject<ModuleInfo>( "Dokka", projectContext, - listOf(library, module), - { - when (it) { - library -> ModuleContent(it, emptyList(), GlobalSearchScope.notScope(sourcesScope)) - module -> ModuleContent(it, emptyList(), sourcesScope) + modules = listOf(module, library) + ) { + override fun modulesContent(module: ModuleInfo): ModuleContent<ModuleInfo> = + when (module) { + library -> ModuleContent(module, emptyList(), GlobalSearchScope.notScope(sourcesScope)) + module -> ModuleContent(module, emptyList(), sourcesScope) else -> throw IllegalArgumentException("Unexpected module info") } - }, - { - JvmPlatform.multiTargetPlatform - }, - LanguageSettingsProvider.Default /* TODO: Fix this */, - { JvmAnalyzerFacade }, - { + + override fun builtInsForModule(module: ModuleInfo): KotlinBuiltIns = builtIns + + override fun createResolverForModule( + descriptor: ModuleDescriptor, + moduleInfo: ModuleInfo + ): ResolverForModule = JvmResolverForModuleFactory( JvmPlatformParameters({ content -> - JvmPackagePartProvider(configuration.languageVersionSettings, content.moduleContentScope).apply { - addRoots(javaRoots, messageCollector) - } + JvmPackagePartProvider( + configuration.languageVersionSettings, + content.moduleContentScope + ) + .apply { + addRoots(javaRoots, messageCollector) + } }, { val file = (it as JavaClassImpl).psi.containingFile.virtualFile if (file in sourcesScope) module else library - }) - }, - CompilerEnvironment, - builtIns = builtIns - ) + }), + CompilerEnvironment, + KonanPlatforms.defaultKonanPlatform + ).createResolverForModule( + descriptor as ModuleDescriptorImpl, + projectContext.withModule(descriptor), + modulesContent(moduleInfo), + this, + LanguageVersionSettingsImpl.DEFAULT + ) + + override fun sdkDependency(module: ModuleInfo): ModuleInfo? = null + } val resolverForLibrary = resolverForProject.resolverForModule(library) // Required before module to initialize library properly val resolverForModule = resolverForProject.resolverForModule(module) diff --git a/core/src/main/kotlin/Analysis/CoreKotlinCacheService.kt b/core/src/main/kotlin/Analysis/CoreKotlinCacheService.kt index 31b8ffc76..d9093760c 100644 --- a/core/src/main/kotlin/Analysis/CoreKotlinCacheService.kt +++ b/core/src/main/kotlin/Analysis/CoreKotlinCacheService.kt @@ -5,7 +5,6 @@ import org.jetbrains.kotlin.analyzer.ModuleInfo import org.jetbrains.kotlin.caches.resolve.KotlinCacheService import org.jetbrains.kotlin.idea.resolve.ResolutionFacade import org.jetbrains.kotlin.psi.KtElement -import org.jetbrains.kotlin.resolve.TargetPlatform import org.jetbrains.kotlin.resolve.diagnostics.KotlinSuppressCache @@ -14,11 +13,24 @@ class CoreKotlinCacheService(private val resolutionFacade: DokkaResolutionFacade return resolutionFacade } - override fun getResolutionFacadeByFile(file: PsiFile, platform: TargetPlatform): ResolutionFacade { + override fun getResolutionFacade( + elements: List<KtElement>, + platform: org.jetbrains.kotlin.platform.TargetPlatform + ): ResolutionFacade { return resolutionFacade } - override fun getResolutionFacadeByModuleInfo(moduleInfo: ModuleInfo, platform: TargetPlatform): ResolutionFacade? { + override fun getResolutionFacadeByFile( + file: PsiFile, + platform: org.jetbrains.kotlin.platform.TargetPlatform + ): ResolutionFacade? { + return resolutionFacade + } + + override fun getResolutionFacadeByModuleInfo( + moduleInfo: ModuleInfo, + platform: org.jetbrains.kotlin.platform.TargetPlatform + ): ResolutionFacade? { return resolutionFacade } diff --git a/core/src/main/kotlin/Analysis/CoreProjectFileIndex.kt b/core/src/main/kotlin/Analysis/CoreProjectFileIndex.kt index 319d85b14..4ece8d300 100644 --- a/core/src/main/kotlin/Analysis/CoreProjectFileIndex.kt +++ b/core/src/main/kotlin/Analysis/CoreProjectFileIndex.kt @@ -15,6 +15,7 @@ import com.intellij.openapi.util.Condition import com.intellij.openapi.util.Key import com.intellij.openapi.util.UserDataHolderBase import com.intellij.openapi.vfs.StandardFileSystems +import com.intellij.openapi.vfs.VfsUtilCore.getVirtualFileForJar import com.intellij.openapi.vfs.VirtualFile import com.intellij.openapi.vfs.VirtualFileFilter import com.intellij.psi.search.GlobalSearchScope @@ -166,9 +167,8 @@ class CoreProjectFileIndex(private val project: Project, contentRoots: List<Cont private val sdk: Sdk = object : Sdk, RootProvider { override fun getFiles(rootType: OrderRootType): Array<out VirtualFile> = classpathRoots - .map { StandardFileSystems.local().findFileByPath(it.file.path) } - .filterNotNull() - .toTypedArray() + .mapNotNull { StandardFileSystems.local().findFileByPath(it.file.path) } + .toTypedArray() override fun addRootSetChangedListener(p0: RootProvider.RootSetChangedListener) { throw UnsupportedOperationException() @@ -329,7 +329,7 @@ class CoreProjectFileIndex(private val project: Project, contentRoots: List<Cont throw UnsupportedOperationException() } - override fun <R : Any?> processOrder(p0: RootPolicy<R>?, p1: R): R { + override fun <R : Any?> processOrder(p0: RootPolicy<R>, p1: R): R { throw UnsupportedOperationException() } @@ -354,11 +354,11 @@ class CoreProjectFileIndex(private val project: Project, contentRoots: List<Cont } override fun orderEntries(): OrderEnumerator = - ProjectOrderEnumerator(project, null).using(object : RootModelProvider { - override fun getModules(): Array<out Module> = arrayOf(module) + ProjectOrderEnumerator(project, null).using(object : RootModelProvider { + override fun getModules(): Array<out Module> = arrayOf(module) - override fun getRootModel(p0: Module): ModuleRootModel = this@MyModuleRootManager - }) + override fun getRootModel(p0: Module): ModuleRootModel = this@MyModuleRootManager + }) override fun <T : Any?> getModuleExtension(p0: Class<T>): T { throw UnsupportedOperationException() @@ -404,7 +404,7 @@ class CoreProjectFileIndex(private val project: Project, contentRoots: List<Cont throw UnsupportedOperationException() } - override fun isDependsOn(p0: Module?): Boolean { + override fun isDependsOn(p0: Module): Boolean { throw UnsupportedOperationException() } @@ -462,7 +462,7 @@ class CoreProjectFileIndex(private val project: Project, contentRoots: List<Cont } override fun getModuleForFile(file: VirtualFile): Module? = - if (sourceRoots.contains(file)) module else null + if (sourceRoots.contains(file)) module else null private fun List<ContentRoot>.contains(file: VirtualFile): Boolean = any { it.contains(file) } @@ -516,7 +516,7 @@ class CoreProjectRootManager(val projectFileIndex: CoreProjectFileIndex) : Proje throw UnsupportedOperationException() } - override fun getContentRootsFromAllModules(): Array<out VirtualFile>? { + override fun getContentRootsFromAllModules(): Array<out VirtualFile> { throw UnsupportedOperationException() } @@ -524,7 +524,7 @@ class CoreProjectRootManager(val projectFileIndex: CoreProjectFileIndex) : Proje throw UnsupportedOperationException() } - override fun setProjectSdkName(p0: String?) { + override fun setProjectSdkName(p0: String) { throw UnsupportedOperationException() } @@ -559,11 +559,11 @@ class CoreProjectRootManager(val projectFileIndex: CoreProjectFileIndex) : Proje fun ContentRoot.contains(file: VirtualFile) = when (this) { is JvmContentRoot -> { val path = if (file.fileSystem.protocol == StandardFileSystems.JAR_PROTOCOL) - StandardFileSystems.getVirtualFileForJar(file)?.path ?: file.path + getVirtualFileForJar(file)?.path ?: file.path else file.path File(path).startsWith(this.file.absoluteFile) } is KotlinSourceRoot -> File(file.path).startsWith(File(this.path).absoluteFile) else -> false -} +}
\ No newline at end of file diff --git a/core/src/main/kotlin/Analysis/JavaResolveExtension.kt b/core/src/main/kotlin/Analysis/JavaResolveExtension.kt index 4dc6b3662..4a4c78e56 100644 --- a/core/src/main/kotlin/Analysis/JavaResolveExtension.kt +++ b/core/src/main/kotlin/Analysis/JavaResolveExtension.kt @@ -19,7 +19,6 @@ package org.jetbrains.dokka import com.intellij.psi.* -import org.jetbrains.kotlin.asJava.classes.KtLightClass import org.jetbrains.kotlin.asJava.unwrapped import org.jetbrains.kotlin.caches.resolve.KotlinCacheService import org.jetbrains.kotlin.descriptors.* @@ -29,11 +28,9 @@ import org.jetbrains.kotlin.load.java.sources.JavaSourceElement import org.jetbrains.kotlin.load.java.structure.* import org.jetbrains.kotlin.load.java.structure.impl.* import org.jetbrains.kotlin.name.Name -import org.jetbrains.kotlin.psi.KtClassOrObject +import org.jetbrains.kotlin.platform.jvm.JvmPlatforms import org.jetbrains.kotlin.psi.KtDeclaration -import org.jetbrains.kotlin.psi.psiUtil.parameterIndex import org.jetbrains.kotlin.resolve.jvm.JavaDescriptorResolver -import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatform import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter import org.jetbrains.kotlin.resolve.scopes.MemberScope @@ -128,4 +125,4 @@ private fun <T : DeclarationDescriptorWithSource> Collection<T>.findByJavaElemen } fun PsiElement.javaResolutionFacade() = - KotlinCacheService.getInstance(project).getResolutionFacadeByFile(this.originalElement.containingFile, JvmPlatform)!! + KotlinCacheService.getInstance(project).getResolutionFacadeByFile(this.originalElement.containingFile, JvmPlatforms.defaultJvmPlatform)!! diff --git a/core/src/main/kotlin/Java/JavadocParser.kt b/core/src/main/kotlin/Java/JavadocParser.kt index 04de29087..27cca9177 100644 --- a/core/src/main/kotlin/Java/JavadocParser.kt +++ b/core/src/main/kotlin/Java/JavadocParser.kt @@ -1,12 +1,11 @@ package org.jetbrains.dokka import com.intellij.psi.* -import com.intellij.psi.impl.source.javadoc.CorePsiDocTagValueImpl +import com.intellij.psi.impl.source.javadoc.PsiDocTagValueImpl import com.intellij.psi.impl.source.tree.JavaDocElementType import com.intellij.psi.javadoc.* import com.intellij.psi.util.PsiTreeUtil import com.intellij.util.IncorrectOperationException -import com.intellij.util.containers.isNullOrEmpty import org.jetbrains.dokka.Model.CodeNode import org.jetbrains.kotlin.utils.join import org.jetbrains.kotlin.utils.keysToMap @@ -172,7 +171,7 @@ class JavadocParser( fun PsiDocTag.getApiLevel(): String? { if (dataElements.isNotEmpty()) { val data = dataElements - if (data[0] is CorePsiDocTagValueImpl) { + if (data[0] is PsiDocTagValueImpl) { val docTagValue = data[0] if (docTagValue.firstChild != null) { val apiLevel = docTagValue.firstChild @@ -420,11 +419,12 @@ class JavadocParser( linkNode } linkSignature != null -> { + @Suppress("USELESS_CAST") + val signature: String = linkSignature as String val linkNode = ContentNodeLazyLink( - (tag.valueElement ?: linkElement).text, - { -> refGraph.lookupOrWarn(linkSignature, logger) } - ) + (tag.valueElement ?: linkElement).text + ) { refGraph.lookupOrWarn(signature, logger) } linkNode.append(text) linkNode } @@ -560,7 +560,7 @@ class JavadocParser( val superMethods = current.findSuperMethods() for (method in superMethods) { val docs = method.docComment?.descriptionElements?.dropWhile { it.text.trim().isEmpty() } - if (!docs.isNullOrEmpty()) { + if (docs?.isNotEmpty() == true) { return method } } diff --git a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt index 0b5e74339..f46505636 100644 --- a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt +++ b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt @@ -739,7 +739,7 @@ class DocumentationBuilder } fun FunctionDescriptor.build(external: Boolean = false): DocumentationNode { - if (ErrorUtils.containsErrorType(this)) { + if (ErrorUtils.containsErrorTypeInParameters(this) || ErrorUtils.containsErrorType(this.returnType)) { logger.warn("Found an unresolved type in ${signatureWithSourceLocation()}") } diff --git a/core/src/main/kotlin/Kotlin/ExternalDocumentationLinkResolver.kt b/core/src/main/kotlin/Kotlin/ExternalDocumentationLinkResolver.kt index 4e394c466..d09bc1c9f 100644 --- a/core/src/main/kotlin/Kotlin/ExternalDocumentationLinkResolver.kt +++ b/core/src/main/kotlin/Kotlin/ExternalDocumentationLinkResolver.kt @@ -42,7 +42,7 @@ class ExternalDocumentationLinkResolver @Inject constructor( override fun toString(): String = rootUrl.toString() } - val cacheDir: Path? = options.cacheRoot?.resolve("packageListCache")?.apply { createDirectories() } + val cacheDir: Path? = options.cacheRoot?.resolve("packageListCache")?.apply { toFile().mkdirs() } val cachedProtocols = setOf("http", "https", "ftp") @@ -86,13 +86,13 @@ class ExternalDocumentationLinkResolver @Inject constructor( val digest = MessageDigest.getInstance("SHA-256") val hash = digest.digest(packageListLink.toByteArray(Charsets.UTF_8)).toHexString() - val cacheEntry = cacheDir.resolve(hash) + val cacheEntry = cacheDir.resolve(hash).toFile() if (cacheEntry.exists()) { try { val connection = packageListUrl.doOpenConnectionToReadContent() val originModifiedDate = connection.date - val cacheDate = cacheEntry.lastModified().toMillis() + val cacheDate = cacheEntry.lastModified() if (originModifiedDate > cacheDate || originModifiedDate == 0L) { if (originModifiedDate == 0L) logger.warn("No date header for $packageListUrl, downloading anyway") diff --git a/core/src/test/kotlin/model/FunctionTest.kt b/core/src/test/kotlin/model/FunctionTest.kt index 329106829..c94d7e990 100644 --- a/core/src/test/kotlin/model/FunctionTest.kt +++ b/core/src/test/kotlin/model/FunctionTest.kt @@ -234,4 +234,18 @@ Documentation""", content.description.toTestString()) } } } + + // Test for b/159470920, to ensure that we correctly parse annotated function types without resolving 'ERROR CLASS' + // types. Note that the actual annotation is not included in the type information, this is tracked in b/145517104. + @Test fun functionWithAnnotatedLambdaParam() { + verifyModel("testdata/functions/functionWithAnnotatedLambdaParam.kt") { model -> + with(model.members.single().members.single { it.name == "function" }) { + with(details(NodeKind.Parameter).first()) { + with(details(NodeKind.Type).first()) { + assertEquals("Function0", name) + } + } + } + } + } } diff --git a/core/testdata/functions/functionWithAnnotatedLambdaParam.kt b/core/testdata/functions/functionWithAnnotatedLambdaParam.kt new file mode 100644 index 000000000..4136e03b3 --- /dev/null +++ b/core/testdata/functions/functionWithAnnotatedLambdaParam.kt @@ -0,0 +1,7 @@ +@Target(AnnotationTarget.TYPE) +@Retention(AnnotationRetention.SOURCE) +@MustBeDocumented +public annotation class Fancy + +fun function(notInlined: @Fancy () -> Unit) { +} diff --git a/gradle.properties b/gradle.properties index a9e47b0bc..81c04c65b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,9 +2,11 @@ dokka_version=0.9.17-g011 dokka_publication_channel=dokka #Kotlin compiler and plugin -bundled_kotlin_compiler_version=1.3.20-dev-564 -kotlin_version=1.2.21 -kotlin_for_gradle_runtime_version=1.1.60 +bundled_kotlin_compiler_version=1.3.61 +kotlin_version=1.3.61 +kotlin_plugin_version=1.3.61-release-180 +idea_version=192.5728.98 +kotlin_for_gradle_runtime_version=1.3.61 ant_version=1.9.6 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 610ad4c51..bd24854fe 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.5-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip |