Back to all rules
What this rule checks
Writes to an element of a user-defined-class array (e.g. balls[0] = new Ball())
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 = random(400);
  void show() { ellipse(x, 200, 20, 20); }
}
Ball[] balls = new Ball[2];

void setup() {
  size(400, 400);
  balls[0] = new Ball();
  balls[1] = new Ball();
}

void draw() {
  balls[0].show();
}
FAIL — this code triggers the rule
class Ball {
  float x = random(400);
  void show() { ellipse(x, 200, 20, 20); }
}
Ball[] balls = { new Ball(), new Ball() };  // no element is ever assigned

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

void draw() {
  balls[0].show();
}
Overview
Category Topic Arrays
Level Advanced
Type Custom Zita
Priority 3 (1 = highest, 5 = lowest)
Status Active
PMD Configuration
Java class nl.utwente.processing.pmd.rules.ArrayUserModifyRule
Message template No element of a user-defined-class array is written to.