At the IR level, are there any rules or assumption...
# compiler
r
At the IR level, are there any rules or assumptions made about the ordering of statements in constructor bodies? In particular, I'd like to have the primary constructor set a field before calling the super constructor or instance initializer, but am worried that there's some level of platform incompatibility I'll run into.
e
I don't know if there are any expectations in IR that this would break, but the Java bytecode side would be fine, see https://openjdk.org/jeps/447#Dependencies
s
many assumptions are not documented, I recommend writing the code you want to generate, checking IR for it and generating the same thing
r
Yeah, that's what makes me nervous, there's no way to get the compiler to generate that code. It's possible it's something inherited from Java at the language level (where you can't write it, but the bytecode works fine) but it seems safer to avoid it altogether.