diff options
author | Kamil Doległo <kamilok1965@interia.pl> | 2020-03-04 17:04:50 +0100 |
---|---|---|
committer | Kamil Doległo <kamilok1965@users.noreply.github.com> | 2020-03-04 18:00:19 +0100 |
commit | fc875fe5f8bc52ac75053db097b3349465705732 (patch) | |
tree | a2e3291170b88336c906210c5570081a217326b4 /plugins/kotlin-as-java/src/main/kotlin/converters/KotlinToJavaConverter.kt | |
parent | ea0945efe8c7b5dd9aabc4f049afaac612b70422 (diff) | |
download | dokka-fc875fe5f8bc52ac75053db097b3349465705732.tar.gz dokka-fc875fe5f8bc52ac75053db097b3349465705732.tar.bz2 dokka-fc875fe5f8bc52ac75053db097b3349465705732.zip |
Refactor Modifiers
Diffstat (limited to 'plugins/kotlin-as-java/src/main/kotlin/converters/KotlinToJavaConverter.kt')
-rw-r--r-- | plugins/kotlin-as-java/src/main/kotlin/converters/KotlinToJavaConverter.kt | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/plugins/kotlin-as-java/src/main/kotlin/converters/KotlinToJavaConverter.kt b/plugins/kotlin-as-java/src/main/kotlin/converters/KotlinToJavaConverter.kt index a8b45db0..7c66e91f 100644 --- a/plugins/kotlin-as-java/src/main/kotlin/converters/KotlinToJavaConverter.kt +++ b/plugins/kotlin-as-java/src/main/kotlin/converters/KotlinToJavaConverter.kt @@ -42,7 +42,7 @@ internal fun Package.asJava(): Package { generics = emptyList(), supertypes = PlatformDependent.empty(), documentation = PlatformDependent.empty(), - modifier = WithAbstraction.Modifier.Final, + modifier = JavaModifier.Final, platformData = platformData, extra = PropertyContainer.empty() ) @@ -64,9 +64,9 @@ internal fun Property.asJava(isTopLevel: Boolean = false, relocateToClass: Strin dri.withClass(relocateToClass) }, modifier = if (setter == null) { - WithAbstraction.Modifier.Final + JavaModifier.Final } else { - WithAbstraction.Modifier.Empty + JavaModifier.Empty }, visibility = visibility.copy( map = visibility.mapValues { JavaVisibility.Private } @@ -87,9 +87,9 @@ internal fun Property.javaAccessors(isTopLevel: Boolean = false, relocateToClass }, name = "get" + name.capitalize(), modifier = if (setter == null) { - WithAbstraction.Modifier.Final + JavaModifier.Final } else { - WithAbstraction.Modifier.Empty + JavaModifier.Empty }, visibility = visibility.copy( map = visibility.mapValues { JavaVisibility.Public } @@ -105,9 +105,9 @@ internal fun Property.javaAccessors(isTopLevel: Boolean = false, relocateToClass }, name = "set" + name.capitalize(), modifier = if (setter == null) { - WithAbstraction.Modifier.Final + JavaModifier.Final } else { - WithAbstraction.Modifier.Empty + JavaModifier.Empty }, visibility = visibility.copy( map = visibility.mapValues { JavaVisibility.Public } @@ -189,7 +189,7 @@ internal fun Object.asJava(): Object = copy( properties = properties.map { it.asJava() } + Property( name = "INSTANCE", - modifier = WithAbstraction.Modifier.Final, + modifier = JavaModifier.Final, dri = dri.copy(callable = Callable("INSTANCE", null, emptyList())), documentation = PlatformDependent.empty(), sources = PlatformDependent.empty(), @@ -281,16 +281,4 @@ private fun AdditionalModifiers.squash(second: AdditionalModifiers) = AdditionalModifiers((content + second.content).distinct()) internal fun ClassId.classNames(): String = - shortClassName.identifier + (outerClassId?.classNames()?.let { ".$it" } ?: "") - -//fun TypeConstructor.asJava(): TypeReference = -// fullyQualifiedName.mapToJava() -// ?.let { tc.copy(fullyQualifiedName = it.asString(), params = tc.params.map { it.asJava() }) } ?: tc - -//fun TypeParam.asJava(): TypeReference = copy(bounds = bounds.map { it.asJava() }) - -//fun TypeReference.asJava(): TypeReference = when (this) { -// is TypeConstructor -> asJava() -// is TypeParam -> asJava() -// else -> this -//}
\ No newline at end of file + shortClassName.identifier + (outerClassId?.classNames()?.let { ".$it" } ?: "")
\ No newline at end of file |