Thanks!, never new int.class was a thing, being int a primitive.
Here the complete working code:
import java.lang.reflect.*;
void setup() {
int c = g_color(g, 128);
}
Method colorCalcMethod_one_int;
Field calcColor;
public int g_color(PGraphics g, int c) {
try {
if (colorCalcMethod_one_int == null) {
colorCalcMethod_one_int = PGraphics.class.getDeclaredMethod("colorCalc", int.class);
colorCalcMethod_one_int.setAccessible(true);
}
if (calcColor == null) {
calcColor = PGraphics.class.getDeclaredField("calcColor");
calcColor.setAccessible(true);
}
colorCalcMethod_one_int.invoke(g, c);
return calcColor.getInt(g);
}
catch (Exception e) {
e.printStackTrace();
}
return -1;
}