aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Java/JavaDocumentationBuilder.kt5
-rw-r--r--test/data/java/javaLangObject.java5
-rw-r--r--test/src/model/JavaTest.kt7
3 files changed, 16 insertions, 1 deletions
diff --git a/src/Java/JavaDocumentationBuilder.kt b/src/Java/JavaDocumentationBuilder.kt
index f1a9c520..f3cc38f7 100644
--- a/src/Java/JavaDocumentationBuilder.kt
+++ b/src/Java/JavaDocumentationBuilder.kt
@@ -186,7 +186,10 @@ public class JavaDocumentationBuilder(private val options: DocumentationOptions)
private fun mapTypeName(psiType: PsiType): String = when (psiType) {
PsiType.VOID -> "Unit"
is PsiPrimitiveType -> psiType.getCanonicalText().capitalize()
- is PsiClassType -> psiType.getClassName()
+ is PsiClassType -> {
+ val psiClass = psiType.resolve()
+ if (psiClass?.getQualifiedName() == "java.lang.Object") "Any" else psiType.getClassName()
+ }
is PsiEllipsisType -> mapTypeName(psiType.getComponentType())
is PsiArrayType -> "Array"
else -> psiType.getCanonicalText()
diff --git a/test/data/java/javaLangObject.java b/test/data/java/javaLangObject.java
new file mode 100644
index 00000000..8f16629c
--- /dev/null
+++ b/test/data/java/javaLangObject.java
@@ -0,0 +1,5 @@
+package test;
+
+class Test {
+ public Object fn() { return null; }
+}
diff --git a/test/src/model/JavaTest.kt b/test/src/model/JavaTest.kt
index ff04c90c..cdb0ba44 100644
--- a/test/src/model/JavaTest.kt
+++ b/test/src/model/JavaTest.kt
@@ -160,4 +160,11 @@ public class JavaTest {
}
}
}
+
+ Test fun javaLangObject() {
+ verifyPackageMember("test/data/java/javaLangObject.java") { cls ->
+ val fn = cls.members(DocumentationNode.Kind.Function).single()
+ assertEquals("Any", fn.detail(DocumentationNode.Kind.Type).name)
+ }
+ }
}