FLEX-35323 compiler: fixed issue in BindingDestinationMaker where setting a dynmaic property with binding would result in a NullPointerException.
Dynamic properties are public, and the InstructionList is only created for non-public properties. We can simply check that the definition is null or not to fix this issue. Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/57a56977 Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/57a56977 Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/57a56977 Branch: refs/heads/master Commit: 57a56977f5f75fb8c41144cf035d78eadd9a75d0 Parents: 74d1487 Author: Josh Tynjala <[email protected]> Authored: Wed Jun 7 09:36:13 2017 -0700 Committer: Josh Tynjala <[email protected]> Committed: Wed Jun 7 09:36:13 2017 -0700 ---------------------------------------------------------------------- .../databinding/BindingDestinationMaker.java | 21 ++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/57a56977/compiler/src/main/java/org/apache/flex/compiler/internal/codegen/databinding/BindingDestinationMaker.java ---------------------------------------------------------------------- diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/codegen/databinding/BindingDestinationMaker.java b/compiler/src/main/java/org/apache/flex/compiler/internal/codegen/databinding/BindingDestinationMaker.java index 0e78d5d..89ad6a2 100644 --- a/compiler/src/main/java/org/apache/flex/compiler/internal/codegen/databinding/BindingDestinationMaker.java +++ b/compiler/src/main/java/org/apache/flex/compiler/internal/codegen/databinding/BindingDestinationMaker.java @@ -128,15 +128,20 @@ public class BindingDestinationMaker { IMXMLPropertySpecifierNode psn = (IMXMLPropertySpecifierNode)parent; IDefinition d = psn.getDefinition(); - Binding b = host.getInstanceScope().getBinding(d); - INamespaceReference ns = psn.getDefinition().getNamespaceReference(); - if (ns != NamespaceDefinition.getPublicNamespaceDefinition()) + //it's possible for the definition to be null if we're dealing with + //a dynamic property on a class like Object -JT + if (d != null) { - InstructionList insns = new InstructionList(); - insns.addInstruction(OP_getlocal0); - insns.addInstruction(OP_getlocal1); - insns.addInstruction(OP_setproperty, b.getName()); - ret = new InstructionListNode(insns); // Wrap the IL in a node and return it + Binding b = host.getInstanceScope().getBinding(d); + INamespaceReference ns = d.getNamespaceReference(); + if (ns != NamespaceDefinition.getPublicNamespaceDefinition()) + { + InstructionList insns = new InstructionList(); + insns.addInstruction(OP_getlocal0); + insns.addInstruction(OP_getlocal1); + insns.addInstruction(OP_setproperty, b.getName()); + ret = new InstructionListNode(insns); // Wrap the IL in a node and return it + } } } return ret;
