lilive - 2021-05-01

Hello,
Strange error in a groovy class:

import javax.swing.DefaultListModel
class Candidates extends DefaultListModel<String>{
    void foo(){
        fireIntervalAdded( this, 0, 1 )
    }
}
test = new Candidates()
test.foo()

The error is:

No signature of method: Candidates.firelntervalAdded() is applicable for argument types: (Candidates, Integer, Integer) values: [[], 0, 1]

The class Candidates should inherit the method firelntervalAdded from DefaultListModel which inherit it from AbstractListModel

I have tried different fixes:

super.fireIntervalAdded( this, 0, 1 )

No signature of method:javax.swing.DefaultListModel.firelntervalAdded() is applicable for argument types: (Candidates, Integer, Integer) values: [[], 0, 1]

fireIntervalAdded( (DefaultListModel<String>) this, 0, 1 )

No signature of method: Candidates.firelntervalAdded() is applicable for argument types: (Candidates, Integer, Integer) values: [[], 0, 1]

The only fix I've found is:

    @CompileStatic
    void foo(){
        fireIntervalAdded( this, 0, 1 )
    }

but I'm not sure of what I'm exactly doing here.

So, my questions:
Why is it an error ? How to fix it ? May this error came from a java/groovy version problem in Freeplane 1.9 ?

This last question because the error occurs with Freeplane 1.9 pre18, MacOS and
~ java -version
openjdk version "1.8.0_242"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_242-b08)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.242-b08, mixed mode)

With the same system and Freeplane 1.8, there is no problem.

No error either with Freeplane 1.9 pre18, Windows 7 and
java version "1.8.0_251"
Java(TM) SE Runtime Environment (build 1.8.0_251-b08)
Java HotSpot(TM) 64-Bit Server VM (build 25.251-b08, mixed mode)

This error was reported by an user of the Jumper add-on and I'm trying to fix it.
I have attached the scripts used for the tests, if you want to try and see if you've got the error with your system.
Thank you.

 

Last edit: lilive 2021-05-01