Loop not running

hi i’m starting out with processing
currently using processing 3.3.3 core. i’m using processing core jar library and doing so in eclipse as described here:
https://processing.org/tutorials/eclipse/

my codes is as follows:

package org.processing;

import processing.core.PApplet;

public class ProcessingTest extends PApplet {

    final int WIDTH = 800;
    final int HEIGHT = 600;
    
    
    @Override
    public void draw() {
        super.draw();
        ellipse(width/2,height/2,second(),second());
        finished = false;
    }

    @Override
    public void settings() {
        super.settings();
        size(WIDTH, HEIGHT);
    }

    @Override
    public void setup() {
        super.setup();
        colorMode(RGB);
        fill(120,50,240);
    }

    
    public static void main(String[] args) {
        PApplet.main("org.processing.ProcessingTest");

    }

}

the trouble is if i remove the statement finished = false; in draw()
the loop stops running. initially the loop() didn’t run at all until i figured out to place the statement finished = false; in draw()

is this a normal behaviour? is that a bug e.g. that i’d need to update the core etc?

ok i found the ‘problem’

public class PApplet implements PConstants {
  public void draw() {
    // if no draw method, then shut things down
    //System.out.println("no draw method, goodbye");
    finished = true;
  }

hence, problem is solved by not calling the overridden superclass methods

You can also remove the statements

super.settings();
super.setup();
super.draw();

as these call empty methods in the PApplet class.

thanks, i’ve done just that. and as it turns out the superclass super.draw() in PApplet isn’t empty.
it might be a handy ‘feature’ in the sense that now the sketch can simply exit by setting
finished = true;
but in structured programming, this should probably be done by calling the superclass methods rather than setting the globals/instance variable that way

You are right, the draw() method in PApplet is not empty - it simply stops the sketch looping IF the user has not overridden the method. This is an even more compelling reason for not calling super.draw() because the developers may change the contents of the default draw() method so in future it might not do what you expect. In this case I would simply set finished = true; although this might also change if it is not a documented part of the API.