{"record":{"id":"fda66276e547f6e4","repo":"airbnb/epoxy","slug":"unsupported-type-this-class-simplename","errorCode":null,"errorMessage":"Unsupported type: ${this::class.simpleName}","messagePattern":"Unsupported type: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"epoxy-processor/src/main/java/com/airbnb/epoxy/processor/PoetExtensions.kt","lineNumber":192,"sourceCode":"\nfun JavaTypeName.toKPoet(nullable: Boolean = false): KotlinTypeName {\n    val type = when (this) {\n        JavaTypeName.BOOLEAN -> BOOLEAN\n        JavaTypeName.BYTE -> BYTE\n        JavaTypeName.SHORT -> SHORT\n        JavaTypeName.CHAR -> CHAR\n        JavaTypeName.INT -> INT\n        JavaTypeName.LONG -> LONG\n        JavaTypeName.FLOAT -> FLOAT\n        JavaTypeName.DOUBLE -> DOUBLE\n        JavaTypeName.OBJECT -> ANY\n        JavaTypeName.VOID -> UNIT\n        is JavaClassName -> toKPoet()\n        is JavaParametrizedTypeName -> toKPoet()\n        is JavaArrayTypeName -> toKPoet()\n        is JavaTypeVariableName -> toKPoet()\n        is JavaWildcardTypeName -> toKPoet()\n        else -> throw IllegalArgumentException(\"Unsupported type: ${this::class.simpleName}\")\n    }\n\n    if (nullable) {\n        return type.copy(nullable = true)\n    }\n\n    return type\n}\n\nfun <T : JavaTypeName> Iterable<T>.toKPoet() = map { it.toKPoet() }\n\nfun JavaParameterSpec.toKPoet(): KotlinParameterSpec {\n\n    // A param name in java might be reserved in kotlin\n    val paramName = if (name in KOTLIN_KEYWORDS) name + \"Param\" else name\n\n    val nullable = annotations.any { (it.type as? JavaClassName)?.simpleName() == \"Nullable\" }\n","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/airbnb/epoxy/blob/e45bd3a61fe3a1f130e184f5b8dcf172ab99025a/epoxy-processor/src/main/java/com/airbnb/epoxy/processor/PoetExtensions.kt#L174-L210","documentation":"This KotlinPoet conversion helper maps JavaPoet type names (JavaTypeName variants) to KotlinPoet types via exhaustive when branches. If a JavaTypeName subtype is encountered that has no mapping branch, toKPoet throws this IllegalArgumentException, indicating an unmapped/unknown type-name kind reached the converter.","triggerScenarios":"Converting a generated-attribute type whose JavaTypeName is none of VOID, ClassName, ParametrizedTypeName, ArrayTypeName, TypeVariableName, or WildcardTypeName — e.g. a primitive-special or new JavaPoet subtype introduced by an upstream library version.","commonSituations":"Model attributes with unusual types (newer JavaPoet types, exotic generics) fed into Epoxy's Kotlin code generation; upgrading JavaPoet/annotation-tool versions introducing a new TypeName subtype; custom processor code constructing an unmapped TypeName subclass.","solutions":["Change the model attribute to a standard supported type (class, parameterized, array, type variable, or wildcard).","Add a mapping branch for the missing JavaTypeName subtype in PoetExtensions.kt's toKPoet when block.","Pin/align JavaPoet versions so no unexpected new TypeName subtype reaches the converter.","Log the full type in a reproducer and file an issue upstream with the concrete type name."],"exampleFix":"// before\nval attr: SomeExoticType = ... // JavaTypeName subtype with no mapping\n\n// after\nval attr: SomeSupportedType = ... // e.g. a ClassName/ParametrizedTypeName-backed type","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"fun isSupportedJavaTypeName(t: JavaTypeName) = t is JavaClassName ||\n  t is JavaParametrizedTypeName || t is JavaArrayTypeName ||\n  t is JavaTypeVariableName || t is JavaWildcardTypeName || t == JavaTypeName.VOID","tryCatchPattern":"try {\n  val kotlinType = typeName.toKPoet(nullable = false)\n} catch (e: IllegalArgumentException) {\n  if (e.message?.startsWith(\"Unsupported type:\") == true) {\n    throw IllegalStateException(\"Unmapped JavaTypeName in codegen: ${typeName}\", e)\n  } else throw e\n}","preventionTips":["Restrict model attribute types to standard class/parameterized/array types.","When upgrading JavaPoet, review toKPoet's when for newly introduced subtypes.","Add a processor test covering every TypeName kind your models use."],"tags":["android","epoxy","annotation-processor","kotlinpoet","javapoet","type-conversion"],"backgroundTag":"unsupported-enum-value","analyzedSha":"e45bd3a61fe3a1f130e184f5b8dcf172ab99025a","analyzedAt":"2026-09-13T03:24:16.052Z","contentChangedAt":"2026-09-13T03:24:16.052Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}