Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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<JcAnnotation> = listOf()
) : JcTypeVariable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ internal fun JcClasspath.typeOf(jvmType: JvmType, parameters: List<JvmType>? = n
class JcTypeVariableDeclarationImpl(
override val symbol: String,
private val classpath: JcClasspath,
private val jvmBounds: List<JvmType>,
val jvmBounds: List<JvmType>,
override val owner: JcAccessible
) : JcTypeVariableDeclaration {
override val bounds: List<JcRefType> get() = jvmBounds.map { classpath.typeOf(it) as JcRefType }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<JvmType>? = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,18 @@ sealed class AbstractJvmType(

}

internal sealed class JvmRefType(isNullable: Boolean?, annotations: List<JcAnnotation>)
sealed class JvmRefType(isNullable: Boolean?, annotations: List<JcAnnotation>)
: AbstractJvmType(isNullable, annotations)

internal class JvmArrayType(val elementType: JvmType, isNullable: Boolean? = null, annotations: List<JcAnnotation>)
class JvmArrayType(val elementType: JvmType, isNullable: Boolean? = null, annotations: List<JcAnnotation>)
: JvmRefType(isNullable, annotations) {

override val displayName: String
get() = elementType.displayName + "[]"

}

internal class JvmParameterizedType(
class JvmParameterizedType(
val name: String,
val parameterTypes: List<JvmType>,
isNullable: Boolean? = null,
Expand All @@ -88,7 +88,7 @@ internal class JvmParameterizedType(

}

internal class JvmClassRefType(val name: String, isNullable: Boolean? = null, annotations: List<JcAnnotation>)
class JvmClassRefType(val name: String, isNullable: Boolean? = null, annotations: List<JcAnnotation>)
: JvmRefType(isNullable, annotations) {

override val displayName: String
Expand All @@ -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<JcAnnotation>)
class JvmTypeVariable(val symbol: String, isNullable: Boolean? = null, annotations: List<JcAnnotation>)
: JvmRefType(isNullable, annotations) {

constructor(declaration: JvmTypeParameterDeclaration, isNullable: Boolean? = null, annotations: List<JcAnnotation>) : this(
Expand Down Expand Up @@ -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<JcAnnotation> = listOf())
class JvmPrimitiveType(val ref: String, annotations: List<JcAnnotation> = listOf())
: JvmRefType(isNullable = false, annotations) {

companion object {
Expand All @@ -189,7 +189,7 @@ internal class JvmPrimitiveType(val ref: String, annotations: List<JcAnnotation>

}

internal interface JvmTypeVisitor<ContextType> {
interface JvmTypeVisitor<ContextType> {
fun visitType(type: JvmType, context: ContextType): JvmType {
return when (type) {
is JvmPrimitiveType -> type
Expand Down
Loading