Processing bug?

Note that this problem can be seen in a smaller example:

void setup() {
  Test t = new Test();
  int c = t.color(300, 100, 100);
  println(c);
}

class Test {
  int color(int r, int g, int b) {
    return 42;
  }
}

The problem seems to be with the color keyword. Renaming the function to color2 fixes the issue.

However, I’m not really sure this is a bug. In Processing, color is a reserved keyword. It’s just like you can’t name a function float:

void setup() {
  Test t = new Test();
  int c = t.float(300, 100, 100);
  println(c);
}

class Test {
  int float(int r, int g, int b) {
    return 42;
  }
}
1 Like