pjfanning opened a new pull request, #120: URL: https://github.com/apache/poi-xmlbeans/pull/120
Supersedes #119 by @dwarven-cleric, keeping their commit and adding a regression test. ### Bug In `SchemaTypeCodePrinter.printStaticFields` the `index` counter was declared inside the per-property loop, so it reset to zero on every iteration. Every property with more than one accepted QName (typically a substitution group head) was assigned `setSetIndex(0)`, and the generated impl class referenced `PROPERTY_QSET[0]` for all of them. When a type has two or more such properties, the second and later accessors silently matched the first property's element names. This is a regression from the XMLBEANS-644 change (December 2023). It shipped in 5.2.1, 5.3.0, 5.4.0 and 5.4.1. Before that, the index came from a map whose size supplied the next slot, which was correct. ### Fix Hoist `index` out of the loop (the one-line change from #119). ### Test `PropertyQSetIndexTest` compiles an inline schema with two substitution groups referenced from one complex type, captures the generated sources with an in-memory `Filer`, and asserts that `getHeadAArray` uses `PROPERTY_QSET[0]` and `getHeadBArray` uses `PROPERTY_QSET[1]`. Verified the test fails on trunk without the fix and passes with it. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
