Tiem Song | e1dd512 | 2019-07-03 14:16:39 -0700 | [diff] [blame^] | 1 | package org.jetbrains.dokka.javadoc |
| 2 | |
| 3 | import com.sun.javadoc.SourcePosition |
| 4 | import org.jetbrains.dokka.DocumentationNode |
| 5 | import org.jetbrains.dokka.NodeKind |
| 6 | import java.io.File |
| 7 | |
| 8 | class SourcePositionAdapter(val docNode: DocumentationNode) : SourcePosition { |
| 9 | |
| 10 | private val sourcePositionParts: List<String> by lazy { |
| 11 | docNode.details(NodeKind.SourcePosition).firstOrNull()?.name?.split(":") ?: emptyList() |
| 12 | } |
| 13 | |
| 14 | override fun file(): File? = if (sourcePositionParts.isEmpty()) null else File(sourcePositionParts[0]) |
| 15 | |
| 16 | override fun line(): Int = sourcePositionParts.getOrNull(1)?.toInt() ?: -1 |
| 17 | |
| 18 | override fun column(): Int = sourcePositionParts.getOrNull(2)?.toInt() ?: -1 |
| 19 | } |