From 381f38b026c3c7f08a393d66c11352006b4d37ac Mon Sep 17 00:00:00 2001 From: Andrew Petrukhin Date: Tue, 1 Apr 2025 17:54:02 +0300 Subject: [PATCH] remove internal modifiers from JvmType hierarchy --- .../org/jacodb/impl/types/JcGenericTypes.kt | 2 +- .../org/jacodb/impl/types/JcTypeBindings.kt | 2 +- .../signature/JvmTypeParameterDeclaration.kt | 2 +- .../jacodb/impl/types/signature/JvmTypes.kt | 24 +++++++++---------- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/jacodb-core/src/main/kotlin/org/jacodb/impl/types/JcGenericTypes.kt b/jacodb-core/src/main/kotlin/org/jacodb/impl/types/JcGenericTypes.kt index 8ab95398d..6b5b097af 100644 --- a/jacodb-core/src/main/kotlin/org/jacodb/impl/types/JcGenericTypes.kt +++ b/jacodb-core/src/main/kotlin/org/jacodb/impl/types/JcGenericTypes.kt @@ -81,7 +81,7 @@ class JcBoundedWildcardImpl( class JcTypeVariableImpl( override val classpath: JcClasspath, - private val declaration: JcTypeVariableDeclaration, + val declaration: JcTypeVariableDeclaration, override val nullable: Boolean?, override val annotations: List = listOf() ) : JcTypeVariable { diff --git a/jacodb-core/src/main/kotlin/org/jacodb/impl/types/JcTypeBindings.kt b/jacodb-core/src/main/kotlin/org/jacodb/impl/types/JcTypeBindings.kt index 7d9392df4..eef05af11 100644 --- a/jacodb-core/src/main/kotlin/org/jacodb/impl/types/JcTypeBindings.kt +++ b/jacodb-core/src/main/kotlin/org/jacodb/impl/types/JcTypeBindings.kt @@ -83,7 +83,7 @@ internal fun JcClasspath.typeOf(jvmType: JvmType, parameters: List? = n class JcTypeVariableDeclarationImpl( override val symbol: String, private val classpath: JcClasspath, - private val jvmBounds: List, + val jvmBounds: List, override val owner: JcAccessible ) : JcTypeVariableDeclaration { override val bounds: List get() = jvmBounds.map { classpath.typeOf(it) as JcRefType } diff --git a/jacodb-core/src/main/kotlin/org/jacodb/impl/types/signature/JvmTypeParameterDeclaration.kt b/jacodb-core/src/main/kotlin/org/jacodb/impl/types/signature/JvmTypeParameterDeclaration.kt index 61bfed5b7..f3d4375c1 100644 --- a/jacodb-core/src/main/kotlin/org/jacodb/impl/types/signature/JvmTypeParameterDeclaration.kt +++ b/jacodb-core/src/main/kotlin/org/jacodb/impl/types/signature/JvmTypeParameterDeclaration.kt @@ -20,7 +20,7 @@ import org.jacodb.api.jvm.JcAccessible import org.jacodb.api.jvm.JvmType import org.jacodb.api.jvm.JvmTypeParameterDeclaration -internal class JvmTypeParameterDeclarationImpl( +class JvmTypeParameterDeclarationImpl( override val symbol: String, override val owner: JcAccessible, override val bounds: List? = null diff --git a/jacodb-core/src/main/kotlin/org/jacodb/impl/types/signature/JvmTypes.kt b/jacodb-core/src/main/kotlin/org/jacodb/impl/types/signature/JvmTypes.kt index cc17c2570..a4b728c05 100644 --- a/jacodb-core/src/main/kotlin/org/jacodb/impl/types/signature/JvmTypes.kt +++ b/jacodb-core/src/main/kotlin/org/jacodb/impl/types/signature/JvmTypes.kt @@ -52,10 +52,10 @@ sealed class AbstractJvmType( } -internal sealed class JvmRefType(isNullable: Boolean?, annotations: List) +sealed class JvmRefType(isNullable: Boolean?, annotations: List) : AbstractJvmType(isNullable, annotations) -internal class JvmArrayType(val elementType: JvmType, isNullable: Boolean? = null, annotations: List) +class JvmArrayType(val elementType: JvmType, isNullable: Boolean? = null, annotations: List) : JvmRefType(isNullable, annotations) { override val displayName: String @@ -63,7 +63,7 @@ internal class JvmArrayType(val elementType: JvmType, isNullable: Boolean? = nul } -internal class JvmParameterizedType( +class JvmParameterizedType( val name: String, val parameterTypes: List, isNullable: Boolean? = null, @@ -88,7 +88,7 @@ internal class JvmParameterizedType( } -internal class JvmClassRefType(val name: String, isNullable: Boolean? = null, annotations: List) +class JvmClassRefType(val name: String, isNullable: Boolean? = null, annotations: List) : JvmRefType(isNullable, annotations) { override val displayName: String @@ -105,7 +105,7 @@ internal class JvmClassRefType(val name: String, isNullable: Boolean? = null, an * This is important to properly handle nullability during substitutions. Not that kt T and java @NotNull T still have * differences -- see comment for `JcSubstitutorImpl.relaxNullabilityAfterSubstitution` for more details */ -internal class JvmTypeVariable(val symbol: String, isNullable: Boolean? = null, annotations: List) +class JvmTypeVariable(val symbol: String, isNullable: Boolean? = null, annotations: List) : JvmRefType(isNullable, annotations) { constructor(declaration: JvmTypeParameterDeclaration, isNullable: Boolean? = null, annotations: List) : this( @@ -141,30 +141,30 @@ internal class JvmTypeVariable(val symbol: String, isNullable: Boolean? = null, } // Nullability has no sense in wildcards, so we suppose them to be always nullable for definiteness -internal sealed class JvmWildcard : AbstractJvmType(isNullable = true, listOf()) +sealed class JvmWildcard : AbstractJvmType(isNullable = true, listOf()) -internal sealed class JvmBoundWildcard(val bound: JvmType) : JvmWildcard() { +sealed class JvmBoundWildcard(val bound: JvmType) : JvmWildcard() { - internal class JvmUpperBoundWildcard(boundType: JvmType) : JvmBoundWildcard(boundType) { + class JvmUpperBoundWildcard(boundType: JvmType) : JvmBoundWildcard(boundType) { override val displayName: String get() = "? extends ${bound.displayName}" } - internal class JvmLowerBoundWildcard(boundType: JvmType) : JvmBoundWildcard(boundType) { + class JvmLowerBoundWildcard(boundType: JvmType) : JvmBoundWildcard(boundType) { override val displayName: String get() = "? super ${bound.displayName}" } } -internal object JvmUnboundWildcard : JvmWildcard() { +object JvmUnboundWildcard : JvmWildcard() { override val displayName: String get() = "*" } -internal class JvmPrimitiveType(val ref: String, annotations: List = listOf()) +class JvmPrimitiveType(val ref: String, annotations: List = listOf()) : JvmRefType(isNullable = false, annotations) { companion object { @@ -189,7 +189,7 @@ internal class JvmPrimitiveType(val ref: String, annotations: List } -internal interface JvmTypeVisitor { +interface JvmTypeVisitor { fun visitType(type: JvmType, context: ContextType): JvmType { return when (type) { is JvmPrimitiveType -> type