1. Compile and run the test below (a stage with three rectangles will appear).
2. Move mouse over the green rectangle (it should rise to the top of z-order).
3. Move mouse out of the green rectangle.
If AssignToBoundException (the stack is provided) is thrown the bug is reproduced.
The issue affects PhotoFlockr (aka FlickrFlockr) sample.
================================================================
import javafx.scene.Scene;
import javafx.scene.Node;
import javafx.scene.shape.Rectangle;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import javafx.scene.CustomNode;
import javafx.scene.Group;
Stage {
visible: true
scene: Scene {
width: 200
height: 200
var rects = [ Rect { translateX: 70 translateY: 70 color: Color.LIGHTGREEN},
Rect { translateX: 40 translateY: 40 },
Rect { translateX: 100 translateY: 100 } ]
content: [
Group {
content: bind rects[r | not r.selected]
},
Group {
content: bind rects[r | r.selected]
}
]
}
}
class Rect extends CustomNode {
var selected = false;
var color = Color.LIGHTGRAY;
public override function create(): Node {
return Rectangle {
width: 50
height: 50
fill: color
stroke: Color.RED
onMouseEntered: function(e) {
selected = true;
}
onMouseExited: function(e) {
selected = false;
}
}
}
}
=================================================================================
Exception in trigger:
com.sun.javafx.runtime.AssignToBoundException: Cannot mutate bound sequence
at com.sun.javafx.runtime.location.SequenceVariable.ensureNotBound(SequenceVariable.java:272)
at com.sun.javafx.runtime.location.SequenceVariable.replaceSlice(SequenceVariable.java:323)
at javafx.scene.Group$1.onChange(Group.fx:143)
at com.sun.javafx.runtime.location.SequenceVariable$4.action(SequenceVariable.java:218)
at com.sun.javafx.runtime.location.SequenceVariable$4.action(SequenceVariable.java:215)
at com.sun.javafx.runtime.util.AbstractLinkable.iterate(AbstractLinkable.java:55)
at com.sun.javafx.runtime.location.SequenceVariable.notifyListeners(SequenceVariable.java:215)
at com.sun.javafx.runtime.location.SequenceVariable$BoundLocationInfo$2.onChange(SequenceVariable.java:454)
at com.sun.javafx.runtime.sequence.AbstractBoundSequence.notifyListeners(AbstractBoundSequence.java:140)
at com.sun.javafx.runtime.sequence.AbstractBoundSequence.updateSlice(AbstractBoundSequence.java:73)
at com.sun.javafx.runtime.sequence.AbstractBoundComprehension$1.onChange(AbstractBoundComprehension.java:114)
at com.sun.javafx.runtime.sequence.AbstractBoundSequence.notifyListeners(AbstractBoundSequence.java:140)
at com.sun.javafx.runtime.sequence.AbstractBoundSequence.updateSlice(AbstractBoundSequence.java:73)
at com.sun.javafx.runtime.sequence.BoundCompositeSequence$MyListener.onChange(BoundCompositeSequence.java:185)
at com.sun.javafx.runtime.location.SequenceVariable$4.action(SequenceVariable.java:218)
at com.sun.javafx.runtime.location.SequenceVariable$4.action(SequenceVariable.java:215)
at com.sun.javafx.runtime.util.AbstractLinkable.iterate(AbstractLinkable.java:55)
at com.sun.javafx.runtime.location.SequenceVariable.notifyListeners(SequenceVariable.java:215)
at com.sun.javafx.runtime.location.SequenceVariable.bind(SequenceVariable.java:233)
at com.sun.javafx.runtime.location.SequenceVariable.rebind(SequenceVariable.java:240)
at com.sun.javafx.runtime.location.IndirectSequenceExpression$1.onChange(IndirectSequenceExpression.java:50)
at com.sun.javafx.runtime.location.IndirectSequenceExpression$1.onChange(IndirectSequenceExpression.java:48)
at com.sun.javafx.runtime.location.ObjectVariable$2.action(ObjectVariable.java:165)
at com.sun.javafx.runtime.location.ObjectVariable$2.action(ObjectVariable.java:162)
at com.sun.javafx.runtime.util.AbstractLinkable.iterate(AbstractLinkable.java:55)
at com.sun.javafx.runtime.location.ObjectVariable.notifyListeners(ObjectVariable.java:162)
at com.sun.javafx.runtime.location.ObjectVariable.replaceValue(ObjectVariable.java:117)
at com.sun.javafx.runtime.location.ObjectVariable.update(ObjectVariable.java:145)
at com.sun.javafx.runtime.location.AbstractVariable.invalidate(AbstractVariable.java:179)
at com.sun.javafx.runtime.location.AbstractLocation$4.action(AbstractLocation.java:141)
at com.sun.javafx.runtime.location.AbstractLocation$4.action(AbstractLocation.java:135)
at com.sun.javafx.runtime.util.AbstractLinkable.iterate(AbstractLinkable.java:60)
at com.sun.javafx.runtime.location.AbstractLocation.invalidateDependencies(AbstractLocation.java:162)
at com.sun.javafx.runtime.location.AbstractLocation.invalidate(AbstractLocation.java:115)
at com.sun.javafx.runtime.location.AbstractVariable.invalidate(AbstractVariable.java:177)
at com.sun.javafx.runtime.location.AbstractLocation$4.action(AbstractLocation.java:141)
at com.sun.javafx.runtime.location.AbstractLocation$4.action(AbstractLocation.java:135)
at com.sun.javafx.runtime.util.AbstractLinkable.iterate(AbstractLinkable.java:60)
at com.sun.javafx.runtime.location.AbstractLocation.invalidateDependencies(AbstractLocation.java:162)
at com.sun.javafx.runtime.location.AbstractLocation.invalidate(AbstractLocation.java:115)
at com.sun.javafx.runtime.location.AbstractVariable.invalidate(AbstractVariable.java:177)
at com.sun.javafx.runtime.location.AbstractLocation$4.action(AbstractLocation.java:141)
at com.sun.javafx.runtime.location.AbstractLocation$4.action(AbstractLocation.java:135)
at com.sun.javafx.runtime.util.AbstractLinkable.iterate(AbstractLinkable.java:60)
at com.sun.javafx.runtime.location.AbstractLocation.invalidateDependencies(AbstractLocation.java:162)
at com.sun.javafx.runtime.location.BooleanVariable.notifyListeners(BooleanVariable.java:174)
at com.sun.javafx.runtime.location.BooleanVariable.replaceValue(BooleanVariable.java:86)
at com.sun.javafx.runtime.location.BooleanVariable.setAsBoolean(BooleanVariable.java:111)
at fxbug.Main$Rect$2.lambda(Main.fx:46)
at fxbug.Main$Rect$2.lambda(Main.fx:46)
at fxbug.Main$Rect$2.invoke(Main.fx:45)
at fxbug.Main$Rect$2.invoke(Main.fx:45)
at fxbug.Main$Rect$2.invoke(Main.fx:45)
at fxbug.Main$Rect$2.invoke(Main.fx:45)
at javafx.scene.Node$1SGMouseAdapter$anon26.call(Node.fx:1098)
at javafx.scene.Node$1SGMouseAdapter$anon26.mouseExited(Node.fx:1112)
at com.sun.scenario.scenegraph.SGNode.processMouseEvent(SGNode.java:485)
at com.sun.scenario.scenegraph.JSGPanel$MouseInputDispatcher.deliverEnterExit(JSGPanel.java:276)
at com.sun.scenario.scenegraph.JSGPanel$MouseInputDispatcher.mouseMoved(JSGPanel.java:396)
at com.sun.scenario.scenegraph.JSGPanel$MouseInputDispatcher.mouseMoved(JSGPanel.java:386)
at java.awt.Component.processMouseMotionEvent(Component.java:6179)
at javax.swing.JComponent.processMouseMotionEvent(JComponent.java:3283)
at java.awt.Component.processEvent(Component.java:5903)
at java.awt.Container.processEvent(Container.java:2023)
at java.awt.Component.dispatchEventImpl(Component.java:4501)
at java.awt.Container.dispatchEventImpl(Container.java:2081)
at java.awt.Component.dispatchEvent(Component.java:4331)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4301)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3978)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3895)
at java.awt.Container.dispatchEventImpl(Container.java:2067)
at java.awt.Window.dispatchEventImpl(Window.java:2458)
at java.awt.Component.dispatchEvent(Component.java:4331)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
2. Move mouse over the green rectangle (it should rise to the top of z-order).
3. Move mouse out of the green rectangle.
If AssignToBoundException (the stack is provided) is thrown the bug is reproduced.
The issue affects PhotoFlockr (aka FlickrFlockr) sample.
================================================================
import javafx.scene.Scene;
import javafx.scene.Node;
import javafx.scene.shape.Rectangle;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import javafx.scene.CustomNode;
import javafx.scene.Group;
Stage {
visible: true
scene: Scene {
width: 200
height: 200
var rects = [ Rect { translateX: 70 translateY: 70 color: Color.LIGHTGREEN},
Rect { translateX: 40 translateY: 40 },
Rect { translateX: 100 translateY: 100 } ]
content: [
Group {
content: bind rects[r | not r.selected]
},
Group {
content: bind rects[r | r.selected]
}
]
}
}
class Rect extends CustomNode {
var selected = false;
var color = Color.LIGHTGRAY;
public override function create(): Node {
return Rectangle {
width: 50
height: 50
fill: color
stroke: Color.RED
onMouseEntered: function(e) {
selected = true;
}
onMouseExited: function(e) {
selected = false;
}
}
}
}
=================================================================================
Exception in trigger:
com.sun.javafx.runtime.AssignToBoundException: Cannot mutate bound sequence
at com.sun.javafx.runtime.location.SequenceVariable.ensureNotBound(SequenceVariable.java:272)
at com.sun.javafx.runtime.location.SequenceVariable.replaceSlice(SequenceVariable.java:323)
at javafx.scene.Group$1.onChange(Group.fx:143)
at com.sun.javafx.runtime.location.SequenceVariable$4.action(SequenceVariable.java:218)
at com.sun.javafx.runtime.location.SequenceVariable$4.action(SequenceVariable.java:215)
at com.sun.javafx.runtime.util.AbstractLinkable.iterate(AbstractLinkable.java:55)
at com.sun.javafx.runtime.location.SequenceVariable.notifyListeners(SequenceVariable.java:215)
at com.sun.javafx.runtime.location.SequenceVariable$BoundLocationInfo$2.onChange(SequenceVariable.java:454)
at com.sun.javafx.runtime.sequence.AbstractBoundSequence.notifyListeners(AbstractBoundSequence.java:140)
at com.sun.javafx.runtime.sequence.AbstractBoundSequence.updateSlice(AbstractBoundSequence.java:73)
at com.sun.javafx.runtime.sequence.AbstractBoundComprehension$1.onChange(AbstractBoundComprehension.java:114)
at com.sun.javafx.runtime.sequence.AbstractBoundSequence.notifyListeners(AbstractBoundSequence.java:140)
at com.sun.javafx.runtime.sequence.AbstractBoundSequence.updateSlice(AbstractBoundSequence.java:73)
at com.sun.javafx.runtime.sequence.BoundCompositeSequence$MyListener.onChange(BoundCompositeSequence.java:185)
at com.sun.javafx.runtime.location.SequenceVariable$4.action(SequenceVariable.java:218)
at com.sun.javafx.runtime.location.SequenceVariable$4.action(SequenceVariable.java:215)
at com.sun.javafx.runtime.util.AbstractLinkable.iterate(AbstractLinkable.java:55)
at com.sun.javafx.runtime.location.SequenceVariable.notifyListeners(SequenceVariable.java:215)
at com.sun.javafx.runtime.location.SequenceVariable.bind(SequenceVariable.java:233)
at com.sun.javafx.runtime.location.SequenceVariable.rebind(SequenceVariable.java:240)
at com.sun.javafx.runtime.location.IndirectSequenceExpression$1.onChange(IndirectSequenceExpression.java:50)
at com.sun.javafx.runtime.location.IndirectSequenceExpression$1.onChange(IndirectSequenceExpression.java:48)
at com.sun.javafx.runtime.location.ObjectVariable$2.action(ObjectVariable.java:165)
at com.sun.javafx.runtime.location.ObjectVariable$2.action(ObjectVariable.java:162)
at com.sun.javafx.runtime.util.AbstractLinkable.iterate(AbstractLinkable.java:55)
at com.sun.javafx.runtime.location.ObjectVariable.notifyListeners(ObjectVariable.java:162)
at com.sun.javafx.runtime.location.ObjectVariable.replaceValue(ObjectVariable.java:117)
at com.sun.javafx.runtime.location.ObjectVariable.update(ObjectVariable.java:145)
at com.sun.javafx.runtime.location.AbstractVariable.invalidate(AbstractVariable.java:179)
at com.sun.javafx.runtime.location.AbstractLocation$4.action(AbstractLocation.java:141)
at com.sun.javafx.runtime.location.AbstractLocation$4.action(AbstractLocation.java:135)
at com.sun.javafx.runtime.util.AbstractLinkable.iterate(AbstractLinkable.java:60)
at com.sun.javafx.runtime.location.AbstractLocation.invalidateDependencies(AbstractLocation.java:162)
at com.sun.javafx.runtime.location.AbstractLocation.invalidate(AbstractLocation.java:115)
at com.sun.javafx.runtime.location.AbstractVariable.invalidate(AbstractVariable.java:177)
at com.sun.javafx.runtime.location.AbstractLocation$4.action(AbstractLocation.java:141)
at com.sun.javafx.runtime.location.AbstractLocation$4.action(AbstractLocation.java:135)
at com.sun.javafx.runtime.util.AbstractLinkable.iterate(AbstractLinkable.java:60)
at com.sun.javafx.runtime.location.AbstractLocation.invalidateDependencies(AbstractLocation.java:162)
at com.sun.javafx.runtime.location.AbstractLocation.invalidate(AbstractLocation.java:115)
at com.sun.javafx.runtime.location.AbstractVariable.invalidate(AbstractVariable.java:177)
at com.sun.javafx.runtime.location.AbstractLocation$4.action(AbstractLocation.java:141)
at com.sun.javafx.runtime.location.AbstractLocation$4.action(AbstractLocation.java:135)
at com.sun.javafx.runtime.util.AbstractLinkable.iterate(AbstractLinkable.java:60)
at com.sun.javafx.runtime.location.AbstractLocation.invalidateDependencies(AbstractLocation.java:162)
at com.sun.javafx.runtime.location.BooleanVariable.notifyListeners(BooleanVariable.java:174)
at com.sun.javafx.runtime.location.BooleanVariable.replaceValue(BooleanVariable.java:86)
at com.sun.javafx.runtime.location.BooleanVariable.setAsBoolean(BooleanVariable.java:111)
at fxbug.Main$Rect$2.lambda(Main.fx:46)
at fxbug.Main$Rect$2.lambda(Main.fx:46)
at fxbug.Main$Rect$2.invoke(Main.fx:45)
at fxbug.Main$Rect$2.invoke(Main.fx:45)
at fxbug.Main$Rect$2.invoke(Main.fx:45)
at fxbug.Main$Rect$2.invoke(Main.fx:45)
at javafx.scene.Node$1SGMouseAdapter$anon26.call(Node.fx:1098)
at javafx.scene.Node$1SGMouseAdapter$anon26.mouseExited(Node.fx:1112)
at com.sun.scenario.scenegraph.SGNode.processMouseEvent(SGNode.java:485)
at com.sun.scenario.scenegraph.JSGPanel$MouseInputDispatcher.deliverEnterExit(JSGPanel.java:276)
at com.sun.scenario.scenegraph.JSGPanel$MouseInputDispatcher.mouseMoved(JSGPanel.java:396)
at com.sun.scenario.scenegraph.JSGPanel$MouseInputDispatcher.mouseMoved(JSGPanel.java:386)
at java.awt.Component.processMouseMotionEvent(Component.java:6179)
at javax.swing.JComponent.processMouseMotionEvent(JComponent.java:3283)
at java.awt.Component.processEvent(Component.java:5903)
at java.awt.Container.processEvent(Container.java:2023)
at java.awt.Component.dispatchEventImpl(Component.java:4501)
at java.awt.Container.dispatchEventImpl(Container.java:2081)
at java.awt.Component.dispatchEvent(Component.java:4331)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4301)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3978)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3895)
at java.awt.Container.dispatchEventImpl(Container.java:2067)
at java.awt.Window.dispatchEventImpl(Window.java:2458)
at java.awt.Component.dispatchEvent(Component.java:4331)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
- blocks
-
JDK-8107346 can violate scene graph invariants using bind
-
- Resolved
-