New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throw friendly error message instead of “The nested type cannot hide an enclosing type” #4228

Closed
kasperkamperman opened this Issue Jan 11, 2016 · 0 comments

Comments

Projects
None yet
1 participant
@kasperkamperman

kasperkamperman commented Jan 11, 2016

Hi,

A student got this error because she named the class the same as the filename of the main sketch. Would it be possible to throw a friendlier error message? Like: "A class cannot have the same name as your the name of your sketch".

JitterBug bug;

void setup() {
  size(480, 120);
  bug = new JitterBug(width/2, height/2, 20);
}

void draw() {
  bug.move();
  bug.display();
}

class JitterBug {
  float x;
  float y; 
  int diameter;
  float speed = 2.5;

  JitterBug(float tempX, float tempY, int tempDiameter)  
  { 
    x = tempX;
    y = tempY;
    diameter = tempDiameter;
  }

  void move() {
      x += random(-speed, speed);
      y += random(-speed, speed);
  }

  void display() {
      ellipse(x, y, diameter, diameter);
  }
}

http://stackoverflow.com/questions/33902511/the-nested-type-cannot-hide-an-enclosing-type-class-java-processing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment