From 6813d65272284b3aaa37907f7c23b3c01ed6f526 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Fri, 30 Oct 2015 19:57:09 +0100 Subject: stop generating javadoc for package facade classes --- javadoc/src/main/kotlin/docbase.kt | 63 ++++---------------------------------- 1 file changed, 6 insertions(+), 57 deletions(-) (limited to 'javadoc/src/main/kotlin/docbase.kt') diff --git a/javadoc/src/main/kotlin/docbase.kt b/javadoc/src/main/kotlin/docbase.kt index 06bbaa58..a9a7f23b 100644 --- a/javadoc/src/main/kotlin/docbase.kt +++ b/javadoc/src/main/kotlin/docbase.kt @@ -81,20 +81,18 @@ val allClassKinds = setOf(DocumentationNode.Kind.Class, DocumentationNode.Kind.E class PackageAdapter(module: ModuleNodeAdapter, node: DocumentationNode) : DocumentationNodeAdapter(module, node), PackageDoc { private val allClasses = node.members.filter { it.kind in allClassKinds }.toMap { it.name } - private val packageFacade = PackageFacadeAdapter(module, node) override fun findClass(className: String?): ClassDoc? = allClasses.get(className)?.let { ClassDocumentationNodeAdapter(module, it) } - ?: if (packageFacade.name() == className) packageFacade else null override fun annotationTypes(): Array = emptyArray() override fun annotations(): Array = node.members(DocumentationNode.Kind.AnnotationClass).map { AnnotationDescAdapter(module, it) }.toTypedArray() override fun exceptions(): Array = node.members(DocumentationNode.Kind.Exception).map { ClassDocumentationNodeAdapter(module, it) }.toTypedArray() - override fun ordinaryClasses(): Array = (node.members(DocumentationNode.Kind.Class).map { ClassDocumentationNodeAdapter(module, it) } + packageFacade).toTypedArray() + override fun ordinaryClasses(): Array = node.members(DocumentationNode.Kind.Class).map { ClassDocumentationNodeAdapter(module, it) }.toTypedArray() override fun interfaces(): Array = node.members(DocumentationNode.Kind.Interface).map { ClassDocumentationNodeAdapter(module, it) }.toTypedArray() override fun errors(): Array = emptyArray() override fun enums(): Array = node.members(DocumentationNode.Kind.Enum).map { ClassDocumentationNodeAdapter(module, it) }.toTypedArray() - override fun allClasses(filter: Boolean): Array = (allClasses.values.map { ClassDocumentationNodeAdapter(module, it) } + packageFacade).toTypedArray() + override fun allClasses(filter: Boolean): Array = allClasses.values.map { ClassDocumentationNodeAdapter(module, it) }.toTypedArray() override fun allClasses(): Array = allClasses(true) override fun isIncluded(): Boolean = node.name in module.allPackages @@ -139,8 +137,9 @@ class ProgramElementAdapter(module: ModuleNodeAdapter, node: DocumentationNode) var owner = node.owner while (owner != null) { when (owner.kind) { - DocumentationNode.Kind.Class -> return ClassDocumentationNodeAdapter(module, owner) - DocumentationNode.Kind.Package -> return PackageFacadeAdapter(module, owner) + DocumentationNode.Kind.Class, + DocumentationNode.Kind.Interface, + DocumentationNode.Kind.Enum -> return ClassDocumentationNodeAdapter(module, owner) else -> owner = owner.owner } } @@ -430,53 +429,6 @@ open class ClassDocumentationNodeAdapter(module: ModuleNodeAdapter, val classNod override fun innerClasses(filter: Boolean): Array = innerClasses() } -class PackageFacadeAdapter(val module: ModuleNodeAdapter, val packageNode: DocumentationNode) : ProgramElementDoc by ProgramElementAdapter(module, packageNode), ClassDoc { - override fun simpleTypeName(): String = packageNode.name.substringAfterLast(".", packageNode.name).capitalize() + "Package" - override fun typeName(): String = simpleTypeName() - override fun qualifiedTypeName(): String = packageNode.name.split(".").let { parts -> parts.take(parts.size - 1) + parts.takeLast(1).map { it.capitalize() + "Package" } }.joinToString(".") - override fun qualifiedName(): String = qualifiedTypeName() - override fun name(): String = simpleTypeName() - - override fun isPrimitive(): Boolean = false - override fun dimension(): String = "" - override fun getElementType(): Type? = null - override fun asParameterizedType(): ParameterizedType? = null - override fun asClassDoc(): ClassDoc = this - override fun asAnnotationTypeDoc(): AnnotationTypeDoc? = null - override fun asAnnotatedType(): AnnotatedType? = null - override fun asWildcardType(): WildcardType? = null - override fun asTypeVariable(): TypeVariable? = null - override fun importedPackages(): Array = emptyArray() - override fun typeParameters(): Array = emptyArray() - override fun importedClasses(): Array = emptyArray() - override fun isExternalizable(): Boolean = false - override fun definesSerializableFields(): Boolean = false - override fun methods(): Array = members(DocumentationNode.Kind.Function).map { MethodAdapter(module, it) }.toTypedArray() - override fun fields(): Array = members(DocumentationNode.Kind.Property).map { FieldAdapter(module, it) }.toTypedArray() - override fun methods(filter: Boolean): Array = methods() - override fun fields(filter: Boolean): Array = fields() - override fun constructors(): Array = emptyArray() - override fun constructors(filter: Boolean): Array = constructors() - override fun enumConstants(): Array = emptyArray() - override fun isAbstract(): Boolean = false - override fun interfaceTypes(): Array = emptyArray() - override fun interfaces(): Array = emptyArray() - override fun typeParamTags(): Array = emptyArray() - override fun findClass(className: String?): ClassDoc? = null // TODO ??? - override fun serializableFields(): Array = emptyArray() - override fun superclassType(): Type? = null - override fun serializationMethods(): Array = emptyArray() - override fun superclass(): ClassDoc? = null - override fun isSerializable(): Boolean = false - override fun subclassOf(cd: ClassDoc?): Boolean = false - override fun innerClasses(): Array = emptyArray() - override fun innerClasses(filter: Boolean): Array = innerClasses() - override fun isOrdinaryClass(): Boolean = true - override fun isClass(): Boolean = true - - private fun members(kind: DocumentationNode.Kind) = packageNode.members(kind) + packageNode.members(DocumentationNode.Kind.ExternalClass).flatMap { it.members(kind) } -} - fun DocumentationNode.lookupSuperClasses(module: ModuleNodeAdapter) = details(DocumentationNode.Kind.Supertype) .map { it.links.firstOrNull() } @@ -488,13 +440,11 @@ class ModuleNodeAdapter(val module: DocumentationModule, val reporter: DocErrorR val allTypes = module.members(DocumentationNode.Kind.Package) .flatMap { it.members(DocumentationNode.Kind.Class) + it.members(DocumentationNode.Kind.Interface) + it.members(DocumentationNode.Kind.Enum) } .toMapBy { it.qualifiedName } - val packageFacades = module.members(DocumentationNode.Kind.Package).map { PackageFacadeAdapter(this, it) }.toMap { it.qualifiedName() } override fun packageNamed(name: String?): PackageDoc? = allPackages[name]?.let { PackageAdapter(this, it) } override fun classes(): Array = - (allTypes.values.map { ClassDocumentationNodeAdapter(this, it) } + packageFacades.values) - .toTypedArray() + allTypes.values.map { ClassDocumentationNodeAdapter(this, it) }.toTypedArray() override fun options(): Array> = arrayOf( arrayOf("-d", outputPath), @@ -507,7 +457,6 @@ class ModuleNodeAdapter(val module: DocumentationModule, val reporter: DocErrorR override fun classNamed(qualifiedName: String?): ClassDoc? = allTypes[qualifiedName]?.let { ClassDocumentationNodeAdapter(this, it) } - ?: packageFacades[qualifiedName] override fun specifiedClasses(): Array = classes() } -- cgit