aboutsummaryrefslogtreecommitdiff
path: root/plugins/base
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/base')
-rw-r--r--plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt7
-rw-r--r--plugins/base/src/test/kotlin/model/JavaTest.kt21
2 files changed, 27 insertions, 1 deletions
diff --git a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt
index 878d5973..e7028ef0 100644
--- a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt
+++ b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt
@@ -56,6 +56,7 @@ import org.jetbrains.kotlin.psi.psiUtil.getChildOfType
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.utils.KotlinExceptionWithAttachments
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstance
+import org.jetbrains.kotlin.utils.addToStdlib.ifNotEmpty
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
import java.io.File
@@ -403,12 +404,16 @@ class DefaultPsiToDocumentableTranslator(
(psi.annotations.toList()
.toListOfAnnotations() + it.toListOfAnnotations()).toSourceSetDependent()
.toAnnotations(),
- ObviousMember.takeIf { inheritedFrom != null && inheritedFrom.isObvious }
+ ObviousMember.takeIf { inheritedFrom != null && inheritedFrom.isObvious },
+ psi.throwsList.toDriList().takeIf { it.isNotEmpty() }
+ ?.let { CheckedExceptions(it.toSourceSetDependent()) }
)
}
)
}
+ private fun PsiReferenceList.toDriList() = referenceElements.mapNotNull { it?.resolve()?.let { DRI.from(it) } }
+
private fun PsiModifierListOwner.additionalExtras() = listOfNotNull(
ExtraModifiers.JavaOnlyModifiers.Static.takeIf { hasModifier(JvmModifier.STATIC) },
ExtraModifiers.JavaOnlyModifiers.Native.takeIf { hasModifier(JvmModifier.NATIVE) },
diff --git a/plugins/base/src/test/kotlin/model/JavaTest.kt b/plugins/base/src/test/kotlin/model/JavaTest.kt
index 991b48ef..e473b352 100644
--- a/plugins/base/src/test/kotlin/model/JavaTest.kt
+++ b/plugins/base/src/test/kotlin/model/JavaTest.kt
@@ -251,6 +251,27 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") {
}
@Test
+ fun throwsList() {
+ inlineModelTest(
+ """
+ |class C {
+ | public void foo() throws java.io.IOException, ArithmeticException {}
+ |}
+ """, configuration = configuration
+ ) {
+ with((this / "java" / "C" / "foo").cast<DFunction>()) {
+ with(extra[CheckedExceptions]?.exceptions?.entries?.single()?.value.assertNotNull("CheckedExceptions")) {
+ this counts 2
+ first().packageName equals "java.io"
+ first().classNames equals "IOException"
+ get(1).packageName equals "java.lang"
+ get(1).classNames equals "ArithmeticException"
+ }
+ }
+ }
+ }
+
+ @Test
fun annotatedAnnotation() {
inlineModelTest(
"""