This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Both AttributesUtilities.Composite and AttributesUtilities.Immutable assume they will not receive AttributeSet-s with the AttributeSet.ResolveAttribute attribute set. Thus Immutable would need to call setResolveParent(). Composite.getAttribute() can't use delegate.isDefined() as isDefined explicitly doesn't go up the resolver hierarchy. A simple testcase to show the bug would send empty delegates that only have resolvers. The Composite will always return null attributes as delegate.isDefined() always returns false.
Created attachment 60532 [details] Patch Immutable / Composite to handle the resolver properly.
Thanks for the patch. May I ask for a usecase where this is needed? Btw the patch for Composite.getAttribute() changes semantics for attributes with the 'null' value. Which effectively means that an attribute from one delegate can't be masked out in a higher-level delegate by setting the attribute's value to null.
I have a custom FontColorSettings implementation (another editor storage impl) where I use ResolveAttribute. I guess the default storage module doesn't use ResolveAttribute and that's why the bug never showed up. Didn't notice null attributes but I guess you might be right, in this case we need to go up the getResolveParent() hierarchy and call isDefined(). I'll send you another patch.
Created attachment 60551 [details] Immutable / Composite new patch (allows null attribute values in delegates)
> I guess the default storage module doesn't use ResolveAttribute No, it does not. Thanks for the updated patch. I'll apply it and if all works (tests pass) I'll push the change to the main.
http://hg.netbeans.org/main/rev/5eb047464b65