No viable alternative at input 'between'

After upgrading Openhabian 5.2.0~S5361-1 over 5.2.0~S5155-1 some of my dsl.rule files failed to load.

I found the cause to be the following line:

var myVar = java.time.Duration.between(myItem.lastUpdate(), now).toDays()

I think the DSL parser has changed and it now sees “between” as a built-in language feature rather than a java method name.

I tired the following double colon syntax as follows and that did not work:

var myVar = java.time.Duration::between(myItem.lastUpdate(), now).toDays()

Using a explicit Namespace has worked, however it does make a lot of my scripts harder to read:

val myVar = (java.time.Duration.getDeclaredMethod(“between”, java.time.temporal.Temporal, java.time.temporal.Temporal).invoke(null, myItem.lastUpdate(), now) as java.time.Duration).toDays()

Is this a bug that should be fixed our is there a more efficient way for me to calculate the number of days/hours since an item has been updated?

Thanks,

Harjit

Just try to use an exponent-sign e.g.

var myVar = java.time.Duration.^between(myItem.lastUpdate(), now).toDays()

and have a look on this thread

Hope this can help

Cheers - Peter

It has been fixed. Try with a more recent snapshot.

I upgraded from 5.2.0~S5361-1 to 5.2.0~S5375-1 and that resolved the issue. Thank you