-
Bug
-
Resolution: Done
-
Major
-
1.3.0
-
None
Class RuleTriggerMethodAdapter is extended by all trigger adapters and encapsulates the functionality required to inject a trigger into a target method. It records a transform operation unconditionally at the end of the bytecode visit sequence. This is fine if the underlying adapter does actually inject a trigger point but is a problem if the rule fails to match a suitable location.
For example
RULE test case
CLASS foo
METHOD bar
AT CALL baz
IF TRUE
DO traceln("alas poor yorick")
ENDRULE
will record a successful transform if foo has a method bar even if it does not call baz. No injection will occur so no harm is done as far as execution is concerned. However, this does provide false info to listener clients. It also breaks the type checker with a NPE when it tries to process the false match because it gets handed a rule which has no attached info for the target type, trigger method descriptor etc.