Back to all rules
What this rule checks
Every user-defined class is created with new somewhere in the sketch
Configuration
When off, this rule is excluded from pipeline runs. Changes apply immediately.
Code Examples
PASS — this code satisfies the rule
class Ball {
  float x = 200;
  void show() { ellipse(x, 200, 20, 20); }
}
Ball b = new Ball();

void setup() {
  size(400, 400);
}

void draw() {
  b.show();
}
FAIL — this code triggers the rule
class Ball {
  float x = 200;
  void show() { ellipse(x, 200, 20, 20); }
}
// Ball is defined but never created with new

void setup() {
  size(400, 400);
}

void draw() {
  ellipse(200, 200, 20, 20);
}
Overview
Category Topic Classes
Level Basic
Type Custom Zita
Priority 3 (1 = highest, 5 = lowest)
Status Active
PMD Configuration
Java class nl.utwente.processing.pmd.rules.UsingUserDefinedClass
Message template A user-defined class is declared but not used.