3 ms·
So records in Java aren't syntactic sugar over an immutable class? They appear in Bytecode?
by WirelessGigabit 3y ago
So records in Java aren't syntactic sugar over an immutable class? They appear in Bytecode?
- grishka 3y agoI'm not sure how they appear in bytecode but they extend java.lang.Record under the hood, which is a new class that the desugaring library doesn't have. Switch expressions and all the pattern-matching stuff though — that's all implemented entirely in the compiler. I use it on Android quite extensively with no issues.