{"record":{"id":"75fdbdf6af28444e","repo":"apple/pkl","slug":"standard-library-typealias-typealias-qualifiedn","errorCode":null,"errorMessage":"Standard library typealias `${typeAlias.qualifiedName}` is not supported by Java code generator. If you think this is an omission, please let us know.","messagePattern":"Standard library typealias `(.+?)` is not supported by Java code generator\\. If you think this is an omission, please let us know\\.","errorType":"exception","errorClass":"JavaCodeGeneratorException","httpStatus":null,"severity":"error","filePath":"pkl-codegen-java/src/main/kotlin/org/pkl/codegen/java/JavaCodeGenerator.kt","lineNumber":872,"sourceCode":"      is PType.Nullable -> baseType.toJavaPoetName(nullable = true, boxed = true)\n      is PType.Constrained -> baseType.toJavaPoetName(nullable = nullable, boxed = boxed)\n      is PType.Alias ->\n        when (typeAlias.qualifiedName) {\n          \"pkl.base#NonNull\" -> OBJECT.nullableIf(nullable)\n          \"pkl.base#Int8\" -> TypeName.BYTE.boxIf(boxed).nullableIf(nullable)\n          \"pkl.base#Int16\",\n          \"pkl.base#UInt8\" -> TypeName.SHORT.boxIf(boxed).nullableIf(nullable)\n          \"pkl.base#Int32\",\n          \"pkl.base#UInt16\" -> TypeName.INT.boxIf(boxed).nullableIf(nullable)\n          \"pkl.base#UInt\",\n          \"pkl.base#UInt32\" -> TypeName.LONG.boxIf(boxed).nullableIf(nullable)\n          \"pkl.base#DurationUnit\" -> DURATION_UNIT.nullableIf(nullable)\n          \"pkl.base#DataSizeUnit\" -> DATASIZE_UNIT.nullableIf(nullable)\n          \"pkl.base#Uri\" -> URI.nullableIf(nullable)\n          else -> {\n            if (CodeGeneratorUtils.isRepresentableAsEnum(aliasedType, null)) {\n              if (typeAlias.isStandardLibraryMember) {\n                throw JavaCodeGeneratorException(\n                  \"Standard library typealias `${typeAlias.qualifiedName}` is not supported by Java code generator. \" +\n                    \"If you think this is an omission, please let us know.\"\n                )\n              } else {\n                // reference generated enum class\n                typeAlias.toJavaPoetName().nullableIf(nullable)\n              }\n            } else {\n              // inline type alias\n              aliasedType.toJavaPoetName(nullable)\n            }\n          }\n        }\n      is PType.Function ->\n        throw JavaCodeGeneratorException(\n          \"Pkl function types are not supported by the Java code generator.\"\n        )\n      is PType.Union ->","sourceCodeStart":854,"sourceCodeEnd":890,"githubUrl":"https://github.com/apple/pkl/blob/f3efcbfc9b60d30053b0536d664948d7aa1b8673/pkl-codegen-java/src/main/kotlin/org/pkl/codegen/java/JavaCodeGenerator.kt#L854-L890","documentation":"A standard-library type alias whose aliased type would otherwise be represented as a generated enum has no pre-mapped Java type, so generation throws. Well-known aliases (DurationUnit, DataSizeUnit, Uri) are mapped; others are unsupported, and the message asks users to report omissions.","triggerScenarios":"A schema references a stdlib typealias (typeAlias.isStandardLibraryMember) that is enum-representable but not in the mapping (not DurationUnit/DataSizeUnit/Uri and the other handled cases).","commonSituations":"Referencing obscure pkl.base typealiases from your module, or using a newly added stdlib alias before the generator maps it.","solutions":["Use the concrete aliased type instead of the stdlib alias in your Pkl module.","Upgrade pkl-codegen-java so the alias gets mapped.","Define your own type alias in your module with the same string-literal union — it will generate an enum.","File an upstream issue requesting mapping for that alias."],"exampleFix":"// before (Pkl)\nunit: SomeStdlibAlias\n// after\ntype MyUnit = \"a\" | \"b\"\nunit: MyUnit","handlingStrategy":"validation","validationCode":"fun isMappedStdlibAlias(a: TypeAlias) = a.qualifiedName in setOf(\"pkl.base#DurationUnit\",\"pkl.base#DataSizeUnit\",\"pkl.base#Uri\")","typeGuard":null,"tryCatchPattern":"try { generate() } catch (e: JavaCodeGeneratorException) { if (\"Standard library typealias\" in e.message!!) inlineOwnAlias() else throw e }","preventionTips":["Declare your own aliases instead of relying on unmapped stdlib aliases","Keep a list of mapped stdlib aliases (DurationUnit, DataSizeUnit, Uri)","Upgrade the generator when new stdlib aliases are released"],"tags":["codegen","stdlib","typealias"],"backgroundTag":"unsupported-operation","analyzedSha":"f3efcbfc9b60d30053b0536d664948d7aa1b8673","analyzedAt":"2026-09-08T13:10:45.570Z","contentChangedAt":"2026-09-08T13:10:45.570Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}