Back to all rules
What this rule checks
Creates an array when declaring it, e.g. new int[5], {1, 2, 3} or new Ball[3] (composed post-Zita from Marker-only rule 6 / ArrayUserInitRule)
Configuration
When off, this rule is excluded from pipeline runs. Changes apply immediately.
Code Examples
PASS — this code satisfies the rule
int[] scores = new int[3];

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

void draw() {
  background(255);
  scores[0] = mouseX;
  text(scores[0], 20, 20);
}
FAIL — this code triggers the rule
int[] scores;  // declared, but only created in setup()

void setup() {
  size(400, 400);
  scores = new int[3];
}

void draw() {
  background(255);
  scores[0] = mouseX;
  text(scores[0], 20, 20);
}
Overview
Category Topic Arrays
Level Basic
Type Custom Zita
Priority 1 (1 = highest, 5 = lowest)
Status Active
PMD Configuration
Message template No array is created where it is declared.