oracle-samples/clara-rules

Bean accessors don't account for IndexedPropertyDescriptors

EthanEChristian opened this issue · 3 comments

The compiler supports syntactic sugar when accessing fields off a bean-able object. To support this clara uses bean introspection to get the field accessors. However, this introspection allows for IndexedPropertyDescriptors to be returned.

IndexedPropertyDescriptors expect getIndexedReadMethod instead of getReadMethod, thus causing a NullPointerException to be thrown even if the field that is "Indexed" is not being used.

Currently non indexed fields look something like:

(defrule a-rule 
  [SomeBeanableClass (= "someFieldValue" theField)]
  ...)

However to support indexing, it would have to look something like:

(defrule a-rule 
  [SomeBeanableClass (= "someIndexedFieldValue" (theIndexedField 0))]
  ...)

That would mean that the compiler would have to understand the context of the indexed sugar, where today the non-indexed sugar can simply be replace by the appropriate java interop call, ie.

(.theField ?__fact__)

I would purpose that we ignore Indexed properties for the time being, as supporting it would convolute the syntax and the parsing of accessors today.

I would purpose that we ignore Indexed properties for the time being, as supporting it would convolute the syntax and the parsing of accessors today.

I agree with this.

#449 opened for this issue

As #449 has been merged, i am going to close this issue