Fix 23034 - child constructor no longer has invalid access to parent field

Closed
HU
8mo ago
+75-2

fixes #23034

Problem:
When using extensions with allOff and having a readonly field in the parent, then the generated child class, does not compile, as it access the private field in the parent class directly.

Solution:
This has been solved the same way as in the 'resteasy' library where the access type of the field in the parent is changed from 'private' to 'protected'.

Test:
A unittest has been added to verify the fix.

@bbdouglas @sreeshas@jfiala @lukoyanov @cbornet @jeff9finger @karismann @Zomzog @lwlee2608 @martin-mfg


Summary by cubic

Fixes a compile error in the MicroProfile generator when a child model extends a parent with a readOnly field. Parent fields are now generated as protected so child classes compile correctly.

  • Bug Fixes
    • Added a unit test asserting Parent.java uses a protected parentField and a spec fixture (issue_23034.yaml) with a classType discriminator to reproduce the inheritance case.