OneToMany initialisation via List.of() - was Tests only - new test on multiple many joins by apflieger · Pull Request #3581 · ebean-orm/ebean

While this test is Ok'ish in that it shows the issue with List.of(), it does actually rely incorrectly on field access ... which you can't do unless you explicitly enable a special enhancement flag entity-field-access.

That is the assert:

    assertThat(list2.get(0).orderInvoices).hasSize(2);

... is relying on the GETFIELD call for orderInvoices, and if that changes to an expected method call like getOrderInvoices() then the test fails to reproduce an error (because lazy loading is invoked and replaces the empty collection with a populated one via lazy loading).

So that means I'm concerned that your application code is incorrectly using field access? [Or why did the test case get written using field access? Did you just get lucky?]