- Drools 5.5.x still has Accessors : field readers and writers. They are created consistently (reader+writer) for declared types, but in case of non-declared types (java objects), only readers are created, and only when
a field is involved in a constraint.
- when a rule is added (dynamically) during an incremental construction process, the packagebuilder creates "redeclarations" (TypeDeclarations with
NATURE == DECLARATION) of involved classes, in order to process annotations
such as @Position or @Modifies.
- if a rule triggers the removal/update of a rule in its own KB, AbstractRuleBase.executeQueuedActions() is called, which tries to rewire the accessors
Problem: if the modified rule's package contains a TypeDeclaration for
an annotated java object, only the reader will exist and the rewiring
process will throw a NPE as it tries to rewire the writer.
a) make the rewiring process check that an accessor exists before trying to rewire it
b) change AbstractRuleBase.executeQueuedActions() - the code seems to have
been removed in 6.x (master)
c) limit the rewiring to TypeDeclarations with Nature == DEFINITION
d) always create the writer together with the reader