aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Formats/StructuredFormatService.kt8
-rw-r--r--src/Java/JavaDocumentationBuilder.kt4
-rw-r--r--src/Kotlin/DocumentationBuilder.kt9
-rw-r--r--src/Kotlin/KotlinLanguageService.kt8
-rw-r--r--src/Model/DocumentationNode.kt4
-rw-r--r--test/data/classes/classWithDefaultObject.kt (renamed from test/data/classes/classWithClassObject.kt)0
-rw-r--r--test/data/format/classWithDefaultObject.html (renamed from test/data/format/classWithClassObject.html)4
-rw-r--r--test/data/format/classWithDefaultObject.kt (renamed from test/data/format/classWithClassObject.kt)0
-rw-r--r--test/data/format/classWithDefaultObject.md (renamed from test/data/format/classWithClassObject.md)4
-rw-r--r--test/src/format/HtmlFormatTest.kt4
-rw-r--r--test/src/format/MarkdownFormatTest.kt4
-rw-r--r--test/src/model/ClassTest.kt8
-rw-r--r--test/src/model/JavaTest.kt4
13 files changed, 31 insertions, 30 deletions
diff --git a/src/Formats/StructuredFormatService.kt b/src/Formats/StructuredFormatService.kt
index 8309d053..10650ab2 100644
--- a/src/Formats/StructuredFormatService.kt
+++ b/src/Formats/StructuredFormatService.kt
@@ -238,8 +238,8 @@ public abstract class StructuredFormatService(val locationService: LocationServi
appendSection(location, "Constructors", node.members(DocumentationNode.Kind.Constructor), node, to)
appendSection(location, "Properties", node.members(DocumentationNode.Kind.Property), node, to)
appendSection(location, "Functions", node.members(DocumentationNode.Kind.Function), node, to)
- appendSection(location, "Class Object Properties", node.members(DocumentationNode.Kind.ClassObjectProperty), node, to)
- appendSection(location, "Class Object Functions", node.members(DocumentationNode.Kind.ClassObjectFunction), node, to)
+ appendSection(location, "Default Object Properties", node.members(DocumentationNode.Kind.DefaultObjectProperty), node, to)
+ appendSection(location, "Default Object Functions", node.members(DocumentationNode.Kind.DefaultObjectFunction), node, to)
appendSection(location, "Accessors", node.members(DocumentationNode.Kind.PropertyAccessor), node, to)
appendSection(location, "Enum Values", node.members(DocumentationNode.Kind.EnumItem), node, to)
appendSection(location, "Other members", node.members.filter {
@@ -254,8 +254,8 @@ public abstract class StructuredFormatService(val locationService: LocationServi
DocumentationNode.Kind.Package,
DocumentationNode.Kind.Function,
DocumentationNode.Kind.PropertyAccessor,
- DocumentationNode.Kind.ClassObjectProperty,
- DocumentationNode.Kind.ClassObjectFunction,
+ DocumentationNode.Kind.DefaultObjectProperty,
+ DocumentationNode.Kind.DefaultObjectFunction,
DocumentationNode.Kind.ExternalClass,
DocumentationNode.Kind.EnumItem
)
diff --git a/src/Java/JavaDocumentationBuilder.kt b/src/Java/JavaDocumentationBuilder.kt
index d501d98a..5b4a6bfa 100644
--- a/src/Java/JavaDocumentationBuilder.kt
+++ b/src/Java/JavaDocumentationBuilder.kt
@@ -136,7 +136,7 @@ public class JavaDocumentationBuilder(private val options: DocumentationOptions)
private fun PsiField.nodeKind(): Kind = when {
this is PsiEnumConstant -> Kind.EnumItem
- hasModifierProperty(PsiModifier.STATIC) -> Kind.ClassObjectProperty
+ hasModifierProperty(PsiModifier.STATIC) -> Kind.DefaultObjectProperty
else -> Kind.Property
}
@@ -154,7 +154,7 @@ public class JavaDocumentationBuilder(private val options: DocumentationOptions)
private fun PsiMethod.nodeKind(): Kind = when {
isConstructor() -> Kind.Constructor
- hasModifierProperty(PsiModifier.STATIC) -> Kind.ClassObjectFunction
+ hasModifierProperty(PsiModifier.STATIC) -> Kind.DefaultObjectFunction
else -> Kind.Function
}
diff --git a/src/Kotlin/DocumentationBuilder.kt b/src/Kotlin/DocumentationBuilder.kt
index e77f97c9..0ad93801 100644
--- a/src/Kotlin/DocumentationBuilder.kt
+++ b/src/Kotlin/DocumentationBuilder.kt
@@ -270,8 +270,9 @@ class DocumentationBuilder(val session: ResolveSession, val options: Documentati
getConstructors()
node.appendChildren(constructorsToDocument, DocumentationReference.Kind.Member)
}
- node.appendChildren(getDefaultType().getMemberScope().getAllDescriptors(), DocumentationReference.Kind.Member)
- val classObjectDescriptor = getClassObjectDescriptor()
+ val members = getDefaultType().getMemberScope().getAllDescriptors().filter { it != getDefaultObjectDescriptor() }
+ node.appendChildren(members, DocumentationReference.Kind.Member)
+ val classObjectDescriptor = getDefaultObjectDescriptor()
if (classObjectDescriptor != null) {
node.appendChildren(classObjectDescriptor.getDefaultType().getMemberScope().getAllDescriptors(),
DocumentationReference.Kind.Member)
@@ -302,7 +303,7 @@ class DocumentationBuilder(val session: ResolveSession, val options: Documentati
}
fun FunctionDescriptor.build(): DocumentationNode {
- val node = DocumentationNode(this, if (inClassObject()) Kind.ClassObjectFunction else Kind.Function)
+ val node = DocumentationNode(this, if (inClassObject()) Kind.DefaultObjectFunction else Kind.Function)
node.appendChildren(getTypeParameters(), DocumentationReference.Kind.Detail)
getExtensionReceiverParameter()?.let { node.appendChild(it, DocumentationReference.Kind.Detail) }
@@ -328,7 +329,7 @@ class DocumentationBuilder(val session: ResolveSession, val options: Documentati
}
fun PropertyDescriptor.build(): DocumentationNode {
- val node = DocumentationNode(this, if (inClassObject()) Kind.ClassObjectProperty else Kind.Property)
+ val node = DocumentationNode(this, if (inClassObject()) Kind.DefaultObjectProperty else Kind.Property)
node.appendChildren(getTypeParameters(), DocumentationReference.Kind.Detail)
getExtensionReceiverParameter()?.let { node.appendChild(it, DocumentationReference.Kind.Detail) }
node.appendType(getReturnType())
diff --git a/src/Kotlin/KotlinLanguageService.kt b/src/Kotlin/KotlinLanguageService.kt
index 526582e6..56baad58 100644
--- a/src/Kotlin/KotlinLanguageService.kt
+++ b/src/Kotlin/KotlinLanguageService.kt
@@ -26,10 +26,10 @@ class KotlinLanguageService : LanguageService {
DocumentationNode.Kind.Modifier -> renderModifier(node)
DocumentationNode.Kind.Constructor,
DocumentationNode.Kind.Function,
- DocumentationNode.Kind.ClassObjectFunction,
+ DocumentationNode.Kind.DefaultObjectFunction,
DocumentationNode.Kind.PropertyAccessor -> renderFunction(node)
DocumentationNode.Kind.Property,
- DocumentationNode.Kind.ClassObjectProperty -> renderProperty(node)
+ DocumentationNode.Kind.DefaultObjectProperty -> renderProperty(node)
else -> identifier(node.name)
}
}
@@ -215,7 +215,7 @@ class KotlinLanguageService : LanguageService {
when (node.kind) {
DocumentationNode.Kind.Constructor -> identifier(node.owner!!.name)
DocumentationNode.Kind.Function,
- DocumentationNode.Kind.ClassObjectFunction -> keyword("fun ")
+ DocumentationNode.Kind.DefaultObjectFunction -> keyword("fun ")
DocumentationNode.Kind.PropertyAccessor -> {}
else -> throw IllegalArgumentException("Node $node is not a function-like object")
}
@@ -251,7 +251,7 @@ class KotlinLanguageService : LanguageService {
renderAnnotationsForNode(node)
when (node.kind) {
DocumentationNode.Kind.Property,
- DocumentationNode.Kind.ClassObjectProperty -> keyword("${node.getPropertyKeyword()} ")
+ DocumentationNode.Kind.DefaultObjectProperty -> keyword("${node.getPropertyKeyword()} ")
else -> throw IllegalArgumentException("Node $node is not a property")
}
renderTypeParametersForNode(node)
diff --git a/src/Model/DocumentationNode.kt b/src/Model/DocumentationNode.kt
index ee948a87..f0c3ddf5 100644
--- a/src/Model/DocumentationNode.kt
+++ b/src/Model/DocumentationNode.kt
@@ -69,8 +69,8 @@ public open class DocumentationNode(val name: String,
Property
PropertyAccessor
- ClassObjectProperty
- ClassObjectFunction
+ DefaultObjectProperty
+ DefaultObjectFunction
Parameter
Receiver
diff --git a/test/data/classes/classWithClassObject.kt b/test/data/classes/classWithDefaultObject.kt
index 459efad6..459efad6 100644
--- a/test/data/classes/classWithClassObject.kt
+++ b/test/data/classes/classWithDefaultObject.kt
diff --git a/test/data/format/classWithClassObject.html b/test/data/format/classWithDefaultObject.html
index c1b18041..1fd648ff 100644
--- a/test/data/format/classWithClassObject.html
+++ b/test/data/format/classWithDefaultObject.html
@@ -20,7 +20,7 @@
</tr>
</tbody>
</table>
-<h3>Class Object Properties</h3>
+<h3>Default Object Properties</h3>
<table>
<tbody>
<tr>
@@ -31,7 +31,7 @@
</tr>
</tbody>
</table>
-<h3>Class Object Functions</h3>
+<h3>Default Object Functions</h3>
<table>
<tbody>
<tr>
diff --git a/test/data/format/classWithClassObject.kt b/test/data/format/classWithDefaultObject.kt
index 459efad6..459efad6 100644
--- a/test/data/format/classWithClassObject.kt
+++ b/test/data/format/classWithDefaultObject.kt
diff --git a/test/data/format/classWithClassObject.md b/test/data/format/classWithDefaultObject.md
index b1191099..030d5a21 100644
--- a/test/data/format/classWithClassObject.md
+++ b/test/data/format/classWithDefaultObject.md
@@ -13,13 +13,13 @@
| [&lt;init&gt;](out.md) | `public Klass()` |
-### Class Object Properties
+### Default Object Properties
| [x](out.md) | `val x: Int` |
-### Class Object Functions
+### Default Object Functions
| [foo](out.md) | `fun foo(): Unit` |
diff --git a/test/src/format/HtmlFormatTest.kt b/test/src/format/HtmlFormatTest.kt
index 247cc057..6fd7696a 100644
--- a/test/src/format/HtmlFormatTest.kt
+++ b/test/src/format/HtmlFormatTest.kt
@@ -7,8 +7,8 @@ import org.jetbrains.dokka.HtmlFormatService
public class HtmlFormatTest {
private val htmlService = HtmlFormatService(InMemoryLocationService, KotlinLanguageService())
- Test fun classWithClassObject() {
- verifyOutput("test/data/format/classWithClassObject.kt", ".html") { model, output ->
+ Test fun classWithDefaultObject() {
+ verifyOutput("test/data/format/classWithDefaultObject.kt", ".html") { model, output ->
htmlService.appendNodes(tempLocation, output, model.members.single().members)
}
}
diff --git a/test/src/format/MarkdownFormatTest.kt b/test/src/format/MarkdownFormatTest.kt
index 57882c1a..cf894898 100644
--- a/test/src/format/MarkdownFormatTest.kt
+++ b/test/src/format/MarkdownFormatTest.kt
@@ -12,8 +12,8 @@ public class MarkdownFormatTest {
}
}
- Test fun classWithClassObject() {
- verifyOutput("test/data/format/classWithClassObject.kt", ".md") { model, output ->
+ Test fun classWithDefaultObject() {
+ verifyOutput("test/data/format/classWithDefaultObject.kt", ".md") { model, output ->
markdownService.appendNodes(tempLocation, output, model.members.single().members)
}
}
diff --git a/test/src/model/ClassTest.kt b/test/src/model/ClassTest.kt
index d607b593..d16b9491 100644
--- a/test/src/model/ClassTest.kt
+++ b/test/src/model/ClassTest.kt
@@ -124,8 +124,8 @@ public class ClassTest {
}
}
- Test fun classWithClassObject() {
- verifyModel("test/data/classes/classWithClassObject.kt") { model ->
+ Test fun classWithDefaultObject() {
+ verifyModel("test/data/classes/classWithDefaultObject.kt") { model ->
with(model.members.single().members.single()) {
assertEquals(DocumentationNode.Kind.Class, kind)
assertEquals("Klass", name)
@@ -140,13 +140,13 @@ public class ClassTest {
}
with(members.elementAt(1)) {
assertEquals("x", name)
- assertEquals(DocumentationNode.Kind.ClassObjectProperty, kind)
+ assertEquals(DocumentationNode.Kind.DefaultObjectProperty, kind)
assertTrue(members.none())
assertTrue(links.none())
}
with(members.elementAt(2)) {
assertEquals("foo", name)
- assertEquals(DocumentationNode.Kind.ClassObjectFunction, kind)
+ assertEquals(DocumentationNode.Kind.DefaultObjectFunction, kind)
assertTrue(members.none())
assertTrue(links.none())
}
diff --git a/test/src/model/JavaTest.kt b/test/src/model/JavaTest.kt
index 6b3d7820..26e5536f 100644
--- a/test/src/model/JavaTest.kt
+++ b/test/src/model/JavaTest.kt
@@ -131,7 +131,7 @@ public class JavaTest {
val i = cls.members(DocumentationNode.Kind.Property).single { it.name == "i" }
assertEquals("Int", i.detail(DocumentationNode.Kind.Type).name)
assertTrue("var" in i.details(DocumentationNode.Kind.Modifier).map { it.name })
- val s = cls.members(DocumentationNode.Kind.ClassObjectProperty).single { it.name == "s" }
+ val s = cls.members(DocumentationNode.Kind.DefaultObjectProperty).single { it.name == "s" }
assertEquals("String", s.detail(DocumentationNode.Kind.Type).name)
assertFalse("var" in s.details(DocumentationNode.Kind.Modifier).map { it.name })
}
@@ -139,7 +139,7 @@ public class JavaTest {
Test fun staticMethod() {
verifyPackageMember("test/data/java/staticMethod.java") { cls ->
- val m = cls.members(DocumentationNode.Kind.ClassObjectFunction).single { it.name == "foo" }
+ val m = cls.members(DocumentationNode.Kind.DefaultObjectFunction).single { it.name == "foo" }
assertFalse("static" in m.details(DocumentationNode.Kind.Modifier).map { it.name })
}
}