Compose Material3: TypographyKt.Typography(...) builder missing from binding (TextStyle inline-class mangling, related to java-interop#1440)
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 52/100
Research direction
Start with the generated AndroidX.Compose.Material3.TypographyKt binding and material3-android/Transforms/Metadata.xml, then compare the mangling behavior with dotnet/java-interop#1440 and the Text/Button metadata precedents. Done means the Typography factory is exposed under a stable managed name and the shown C# construction compiles.
Written by the indexing model from the issue text.
Description
Background
In Xamarin.AndroidX.Compose.Material3Android (verified against
1.4.0.3), the TypographyKt companion class only exposes the
LocalTypography CompositionLocal accessor — the public
Typography(displayLarge, displayMedium, …, labelSmall) builder
function is missing entirely:
// AndroidX.Compose.Material3.TypographyKt (full method list)
get_class_ref() -> IntPtr
get_JniPeerMembers() -> JniPeerMembers
get_ThresholdClass() -> IntPtr
get_ThresholdType() -> Type
get_LocalTypography() -> ProvidableCompositionLocal
.ctor(IntPtr, JniHandleOwnership) -> Void
.cctor() -> Void
// ^ no Typography(...) builder
Upstream Kotlin (androidx.compose.material3.TypographyKt):
fun Typography(
displayLarge: TextStyle = TypographyTokens.DisplayLarge,
displayMedium: TextStyle = TypographyTokens.DisplayMedium,
displaySmall: TextStyle = TypographyTokens.DisplaySmall,
headlineLarge: TextStyle = TypographyTokens.HeadlineLarge,
...
labelSmall: TextStyle = TypographyTokens.LabelSmall,
): Typography
Every parameter is androidx.compose.ui.text.TextStyle, which is
itself a regular class but has constructors and copy(...) overloads
saturated with @JvmInline value class fields (Color, TextUnit,
FontWeight, FontStyle, BaselineShift, TextGeometricTransform,
…). That triggers the same JVM-mangling story documented in
dotnet/java-interop#1440 — the public Typography factory
in the bytecode is something like Typography-…, and the current
metadata pipeline strips it.
The same package does expose:
MaterialThemeKt.MaterialTheme(ColorScheme, Shapes, Typography, …)MaterialTheme.GetTypography(IComposer, Int32)companion accessornew Typography()parameterless ctor
— so the type Typography is fully bound and consumable; only the
factory function that lets you build a customized Typography
with the standard defaults is missing. This blocks
jonathanpeppers/compose-net#61 (parameterizing
MaterialTheme).
Ask
Two paths, listed in order of preference:
-
Long-term: once dotnet/java-interop#1440 lands and
@JvmInline value classmangling is unwound at bind time, the
Typography(...)builder should reappear automatically. Track
this issue against that PR. -
Short-term workaround (if waiting on #1440 is not viable):
add an explicitmanagedNamerename in
material3-android/Transforms/Metadata.xmlthat aliases the
bytecode-mangledTypography-…static method back to a stable
managed name (TypographyKt.Typography), the same pattern used
forText--4IGK_g→Text/Button-bWB7cM8→Buttonin
downstream metadata fixes.
Verification
After the fix, this should compile (in either form):
using AndroidX.Compose.Material3;
using AndroidX.Compose.UI.Text;
Typography typography = TypographyKt.Typography(
displayLarge: new TextStyle(fontSize: /* Sp */, fontWeight: /* … */),
/* … */);
Related
- #1438 —
un-stripui-graphics-android(precedent for the recipe) - #1439 —
un-stripui-text-android/ui-unit-android(precedent) - dotnet/java-interop#1440 — root cause of inline-class
method-name mangling
- Dominant language
- C#
- Stars
- 318
- Forks
- 73
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 10
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from dotnet/android-libraries
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
dotnet/android-libraries#1503 ·
-
dotnet/android-libraries#1470 · 1 reaction · 2 assignees ·
-
dotnet/android-libraries#1467 · 1 reaction · 2 assignees ·
-
Difficulty 5/5 Over a week Newbie friendliness 45/100
dotnet/android-libraries#1456 · 2 comments · 1 reaction ·
-
dotnet/android-libraries#1444 · 1 reaction · 2 assignees ·
All issues in dotnet/android-libraries
Similar issues
-
type/automation type/tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
t/bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
ci-failure-cause test-failure
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
area:auth FE mvp P3
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
klasolsson81/jobbliggaren#1788 ·