VBox class hierarchy shows getChildren() is implemented in Parent
and Pane. vbox.getChildren() returns an instance of Parent which is
protected rather than public found in Pane. Accessing the List
returned by Parent is an illegal reference because it is protected
while accessing the List returned by Pane should be legal, but
this isn't whats returned.

VBox Class Hierarchy:

java.lang.Object
javafx.scene.Node
javafx.scene.Parent -> protected ObservableList<Node> getChildren​()
javafx.scene.layout.Region
javafx.scene.layout.Pane -> public ObservableList<Node> getChildren()
javafx.scene.layout.VBox

Class instance of vbox.getChildren() is:

vbox.getChildren().getClass() -> class javafx.scene.Parent$3

Pane is widening the access restrictions of Parent. Is this intentional?
Does it have any effect? Should Parent's access restrictions of getChildren()
be public or should Pane's be protected?

My thought is public for both.

  

Reply via email to