Closed ruffrick closed 2 months ago
Thanks for the report, when not using the annotation processor, everything should work fine as then reflection is used to access the method:
if (root instanceof Parent parent) {
ReflectionUtil.getChildrenList(instance.getClass(), parent).clear();
}
This should therefore be a relatively easy fix.
@LeStegii We could statically check whether the component type extends Pane in the processor and have it decide whether to generate the efficient getChildren call or the ReflectionUtil fallback.
Yep, I'd have suggested the same thing. We could also implement this in the reflection sidecar.
I will do that.
Describe the bug The generated sidecar classes for components extending
javafx.scene.Parent
tries to access the componentschildren
property, which is protected inParent
. Only children ofjavafx.scene.layout.Pane
, itself a child ofParent
, have this property publicly accessible, resulting in an exception when creating components extending e.g.javafx.scene.control.ListView
. The exception only occurrs if the component specifies a view resource (FXML).To Reproduce Steps to reproduce the behavior:
ListView
(a child ofParent
but not ofPane
)@Component
and specify theview
argumentExpected behavior The component is appropriately initialized and rendered.
Desktop
Additional context Relevant fulibFx snippet: https://github.com/fujaba/fulibFx/blob/master/annotation-processor/src/main/java/org/fulib/fx/FxClassGenerator.java#L306-L307