Skip to main content

Module emit

Module emit 

Source
Expand description

Java source emission from the statement/expression tree.

Structs§

Printer

Functions§

escape_char
escape_string
format_float
is_java_keyword
Java reserved words (plus the null/true/false literals, and _ — a reserved IDENTIFIER since Java 9: Alipay’s instant-run patch system names fields _, and javac rejects it with “underscores are not allowed here”): Kotlin emits methods and fields named default (Companion.default()) — no Java program can name them, so both ddc’s declarations and these call sites map them to _<name> identically (which turns _ into __). NOTE: these are MEMBER-level escapes — locals/fields/params MAY legally carry the restricted contextual type names below (rt.jar has var locals), so those live in their own predicate.
is_restricted_type_name
Restricted CONTEXTUAL type names — javac rejects them in TYPE declarations and type references ('var' 是受限类型名称), but they stay legal as member/local names (rt.jar compiles var locals). Consulted ONLY where a CLASS name renders: type declarations, segment sanitizers, the qualified-new simple name.
java_ident
Kotlin emits method names like invokeSuspend$lambda-0 — - and any other non-identifier character is not legal Java. Deterministic mapping; ddc’s classdec applies the identical rule at declarations.
sanitize_source_name