{"record":{"id":"6035d99d7fd75216","repo":"airbnb/epoxy","slug":"room-couldn-t-find-the-constructor-it-is-looking-for-in","errorCode":null,"errorMessage":"Room couldn't find the constructor it is looking for in JavaPoet.\nPlease file a bug.","messagePattern":"Room couldn't find the constructor it is looking for in JavaPoet\\.\nPlease file a bug\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"critical","filePath":"epoxy-processor/src/main/java/com/airbnb/epoxy/processor/TypeNameWorkaround.kt","lineNumber":346,"sourceCode":"        }\n    }\n}\n\n/**\n * The private constructor of [TypeVariableName] which receives a list.\n * We use this in [createModifiableTypeVariableName] to create a [TypeVariableName] whose bounds\n * can be modified afterwards.\n */\nprivate val typeVarNameConstructor by lazy {\n    try {\n        TypeVariableName::class.java.getDeclaredConstructor(\n            String::class.java,\n            List::class.java\n        ).also {\n            it.isAccessible = true\n        }\n    } catch (ex: NoSuchMethodException) {\n        throw IllegalStateException(\n            \"\"\"\n            Room couldn't find the constructor it is looking for in JavaPoet.\n            Please file a bug.\n            \"\"\".trimIndent(),\n            ex\n        )\n    }\n}\n\n/**\n * Creates a TypeVariableName where we can change the bounds after constructor.\n * This is used to workaround a case for self referencing type declarations.\n * see b/187572913 for more details\n */\nprivate fun createModifiableTypeVariableName(\n    name: String,\n    bounds: List<TypeName>\n): TypeVariableName = typeVarNameConstructor.newInstance(","sourceCodeStart":328,"sourceCodeEnd":364,"githubUrl":"https://github.com/airbnb/epoxy/blob/e45bd3a61fe3a1f130e184f5b8dcf172ab99025a/epoxy-processor/src/main/java/com/airbnb/epoxy/processor/TypeNameWorkaround.kt#L328-L364","documentation":"TypeNameWorkaround works around JavaPoet/Room type-name interop by reflectively accessing a JavaPoet constructor (matched against String/List class signatures). The reflective lookup happens in a static initializer; if the expected constructor does not exist in the bundled JavaPoet version, NoSuchMethodException is wrapped and rethrown as this IllegalStateException, meaning the workaround is broken for this JavaPoet version.","triggerScenarios":"Any annotation-processing run where epoxy-processor is paired with an incompatible JavaPoet version whose internal constructor signatures changed — the class init fails immediately at processor startup.","commonSituations":"Upgrading JavaPoet (or a dependency pulling a newer JavaPoet) without upgrading epoxy-processor; dependency-resolution choosing a different JavaPoet than the one Epoxy was built against; using a forked JavaPoet.","solutions":["Align the JavaPoet version with the one epoxy-processor expects (check Epoxy's build deps and force that version in your build).","Upgrade epoxy-processor to a release compatible with your JavaPoet version.","Inspect the wrapped cause (ex) to see which constructor signature was expected vs available.","As a stopgap, exclude transitive JavaPoet upgrades with a resolutionStrategy force on the known-good version."],"exampleFix":"// before (build.gradle.kts)\nimplementation(\"com.squareup:javapoet:1.14.0\") // newer, incompatible\n\n// after\nimplementation(\"com.squareup:javapoet:1.13.0\") // version epoxy-processor expects","handlingStrategy":"try-catch","validationCode":"// build-time guard: fail fast on JavaPoet drift\ntry {\n  Class.forName(\"com.airbnb.epoxy.processor.TypeNameWorkaround\")\n    .declaredMethods // triggers init\n} catch (e: ExceptionInInitializerError) {\n  throw IllegalStateException(\"JavaPoet version incompatible with epoxy-processor\", e)\n}","typeGuard":null,"tryCatchPattern":"try {\n  runAnnotationProcessing()\n} catch (e: IllegalStateException) {\n  if (e.message?.contains(\"Room couldn't find the constructor\") == true) {\n    error(\"Fix JavaPoet version: ${e.cause?.cause}\")\n  } else throw e\n}","preventionTips":["Pin the exact JavaPoet version epoxy-processor was built against.","Upgrade epoxy-processor in lockstep with JavaPoet.","Add a resolutionStrategy force on JavaPoet to block transitive upgrades.","Read the wrapped NoSuchMethodException cause to identify the changed constructor."],"tags":["android","epoxy","annotation-processor","javapoet","reflection","version-incompatibility"],"backgroundTag":"module-init-failed","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"}