OH 2.x : Could not invoke method: org.eclipse.xtext.xbase.lib.ObjectExtensions.operator_doubleArrow

Hi!

After migration from OH1.8 to 2.x I’m receiveing this error:
Could not invoke method: org.eclipse.xtext.xbase.lib.ObjectExtensions.operator_doubleArrow

This is the .rules (where I’ve removed the import as reported in OH2.x documentation)

rule "Vrf"
when
        Time cron "0 0 20 * * ?" or
        Time cron "0 0 23 * * ?"
then
        var month = now.getMonthOfYear
        if ((month <= 4) && (month => 9)) {

        [...]

        }
end

and this is the log

2018-03-15 23:00:03.770  [ERROR] [ntime.internal.engine.ExecuteRuleJob] - Error during the execution of rule 'Vrf': An error occurred during the script execution: Could not invoke method: org.eclipse.xtext.xbase.lib.ObjectExtensions.operator_doubleArrow(T,org.eclipse.xtext.xbase.lib.Procedures$Procedure1) on instance: null

It’s a systax-problem

if ((month <= 4) && (month >= 9)) {

but there seams to be also a logic-problem.
Either

if ((month <= 4) || (month >= 9)) {

or

if ((month >= 4) && (month <= 9)) {
1 Like

Why you don’t use this?

Time cron "0 0 20,23 ? APR,MAY,JUN,JUL,AUG,SEP * *"
1 Like

Ohh you are right!
Thank you!

The script is complex, with multiple functions, but it can be a solution in other case :wink:
Thanks

:thinking:

1 Like