Without seeing the (possible sample/example) code of your problem, it’s hard to say what is wrong.
The native Java Object class doesn’t have a “pos” attribute! How/why do you think one is added/defined?
Also consider:
class MyShape {
boolean is_circle;
float x, y;
MyShape(){
x = random(width);
y = random(height);
is_circle = random(1) < .5;
}
void render(){
if( is_circle ){
ellipse(x,y,20,20);
} else {
rect(x-10,y-10,20,20);
}
}
}