Bonjour,

J'ai commencé à apprendre le JiST-SWANS, donc sous Eclipse, j'ai codé un petit programme "hello world" et je l'ai compilé. Aucune erreur soulignée en rouge malgré ça le programme ne compile pas.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import jist.runtime.JistAPI;
 
class hello implements JistAPI.Entity {
 
    public static void main(String[] args)
    {
        System.out.println("simulation start");
        hello h = new hello();
        h.myEvent();
    }
 
    public void myEvent()
    {
        JistAPI.sleep(1);
        myEvent();
        System.out.println("hello world, t=" + JistAPI.getTime());
    }
}
Résultat :
simulation start
Exception in thread "main" java.lang.StackOverflowError
at hello.myEvent(hello.java:16)
at hello.myEvent(hello.java:16)
at hello.myEvent(hello.java:16)
at hello.myEvent(hello.java:16)
at hello.myEvent(hello.java:16)
at hello.myEvent(hello.java:16)
at hello.myEvent(hello.java:16) (boucle à l'infini)
Ça arrive pourquoi ce genre d'erreur ? Comment le corriger ?

Merci d'avance pour votre aide.