[foreign-jextract] RFR: 8261642: improve jextract source generation mode and remove class generation [v2]
Jorn Vernee
jvernee at openjdk.java.net
Mon Feb 15 15:05:44 UTC 2021
On Mon, 15 Feb 2021 14:38:46 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> I can fix this
>
> forgot about this - I cannot really do this, as nested structs don't return a new builder - in other words, the OutputFactory code doesn't really know if it should begin a class or not. I could do `if (newBuilder != currentBuilder) newBuilder.classBegin() ...` but I don't think that improves much?
Yeah, I was looking at `classEnd()` where you use `if (prefixElementNames.isEmpty())` to check if the struct builder is for an anonymous nested struct or not. So I thought you could do the same for `classBegin()` and have:
@Override
void classBegin() {
if (prefixElementNames.isEmpty()) {
super.classBegin();
addLayout(layoutField(), ((Type.Declared)structType).tree().layout().get())
.emitGetter(this, MEMBER_MODS, Constant.SUFFIX_ONLY);
}
}
?
-------------
PR: https://git.openjdk.java.net/panama-foreign/pull/450
More information about the panama-dev
mailing list